{"record":{"id":"021391e7c2955a1d","repo":"microsoft/semantic-kernel","slug":"allowedcallersclaimsvalidator-config-object-canno","errorCode":null,"errorMessage":"AllowedCallersClaimsValidator: config object cannot be None.","messagePattern":"AllowedCallersClaimsValidator: config object cannot be None\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"python/samples/demos/copilot_studio_skill/src/api/auth.py","lineNumber":15,"sourceCode":"# Copyright (c) Microsoft. All rights reserved.\n\n# See https://github.com/microsoft/BotBuilder-Samples/blob/main/samples/python/80.skills-simple-bot-to-bot/echo-skill-bot/authentication/allowed_callers_claims_validator.py\nfrom collections.abc import Awaitable, Callable\n\nfrom botframework.connector.auth import JwtTokenValidation, SkillValidation\nfrom config import Config\n\n\nclass AllowedCallersClaimsValidator:\n    config_key = \"ALLOWED_CALLERS\"\n\n    def __init__(self, config: Config):\n        if not config:\n            raise TypeError(\"AllowedCallersClaimsValidator: config object cannot be None.\")\n\n        # ALLOWED_CALLERS is the setting in config.py file\n        # that consists of the list of parent bot ids that are allowed to access the skill\n        # to add a new parent bot simply go to the AllowedCallers and add\n        # the parent bot's microsoft app id to the list\n        caller_list = getattr(config, self.config_key)\n        if caller_list is None:\n            raise TypeError(f'\"{self.config_key}\" not found in configuration.')\n        self._allowed_callers = frozenset(caller_list)\n\n    @property\n    def claims_validator(self) -> Callable[[list[dict]], Awaitable]:\n        async def allow_callers_claims_validator(claims: dict[str, object]):\n            # if allowed_callers is None we allow all calls\n            if \"*\" not in self._allowed_callers and SkillValidation.is_skill_claim(claims):\n                # Check that the appId claim in the skill request is in the list of skills configured for this bot.\n                app_id = JwtTokenValidation.get_app_id_from_claims(claims)\n                if app_id not in self._allowed_callers:","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/samples/demos/copilot_studio_skill/src/api/auth.py#L1-L33","documentation":"A TypeError raised by AllowedCallersClaimsValidator's constructor when the passed config object is falsy (None, empty). The validator needs a Config instance to read the ALLOWED_CALLERS list, so a null config is a programming error rather than a runtime condition.","triggerScenarios":"Instantiating AllowedCallersClaimsValidator(config) with config=None or an otherwise falsy value, typically a wiring/DI mistake in the bot startup code.","commonSituations":"The Config singleton wasn't initialized before constructing the validator; a refactor passed None by mistake; import order caused config to be unavailable at construction.","solutions":["Pass a fully constructed Config instance: AllowedCallersClaimsValidator(config).","Ensure config = Config(); config.validate() runs before the validator is created.","Guard the call site: construct the validator only after confirming config is not None."],"exampleFix":"// before\nvalidator = AllowedCallersClaimsValidator(None)\n\n// after\nfrom config import config\nvalidator = AllowedCallersClaimsValidator(config)","handlingStrategy":"type-guard","validationCode":"from config import config\nassert config is not None, \"Config must be initialized before building the validator\"\nvalidator = AllowedCallersClaimsValidator(config)","typeGuard":"from config import Config\n\ndef is_valid_config(c) -> bool:\n    return isinstance(c, Config) and bool(c)","tryCatchPattern":null,"preventionTips":["Construct Config and run validate() before instantiating the claims validator.","Use dependency injection so a non-None config is guaranteed at the call site."],"tags":["configuration","validation","authentication","bot-framework","copilot-studio"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}