Add tenant ID validation for Entra issuer in claims identity - #515
Merged
Matthew (matthewmeyer) merged 2 commits intoAug 3, 2026
Conversation
Matthew (matthewmeyer)
commented
Aug 3, 2026
Contributor
- TID Issuer cross check, resolves Add TID→Issuer cross-check in inbound JWT validation #423
- Added a new utility module for generating signed RS256 JWTs for testing purposes.
- Created comprehensive tests for the JwtTokenValidator, covering various scenarios including audience validation, signature verification, and issuer checks.
- Enhanced the AgentAuthConfiguration to support issuer lists from environment variables and improved validation logic for issuer settings.
- Ensured that the configuration defaults and behaviors are consistent with expected security practices, including handling of non-string audience claims.
- TID Issuer cross check - Added a new utility module for generating signed RS256 JWTs for testing purposes. - Created comprehensive tests for the JwtTokenValidator, covering various scenarios including audience validation, signature verification, and issuer checks. - Enhanced the AgentAuthConfiguration to support issuer lists from environment variables and improved validation logic for issuer settings. - Ensured that the configuration defaults and behaviors are consistent with expected security practices, including handling of non-string audience claims.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens inbound JWT validation in microsoft-agents-hosting-core by adding Entra issuer/tenant checks (tid↔iss binding) and an opt-in issuer allow-list, plus a substantial new test suite to cover audience/signature/issuer scenarios and cloud (public vs US Gov) routing behavior.
Changes:
- Add Entra issuer parsing utilities and enforce
tid↔isstenant binding inJwtTokenValidator.validate_token()(plus optional issuer allow-list viaVALIDATE_ISSUER). - Extend
AgentAuthConfigurationto supportISSUERSlists (including env-driven lists) and safe boolean coercion forVALIDATE_ISSUER. - Add shared JWT signing test utilities and comprehensive validator/configuration tests.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/hosting_core/test_auth_configuration.py | Adds coverage for issuer list normalization and VALIDATE_ISSUER behavior/defaults. |
| tests/hosting_core/authorization/test_jwt_token_validator.py | New comprehensive validator tests for audience/signature, issuer allow-list, tid binding, multi-tenant, and gov/public cloud cases. |
| tests/_common/jwt_test_utils.py | New helper utilities to generate RS256-signed JWTs for tests (including malformed-claim scenarios). |
| libraries/microsoft-agents-hosting-fastapi/microsoft_agents/hosting/fastapi/jwt_authorization_middleware.py | Minor formatting cleanup (no functional change). |
| libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/authorization/jwt/jwt_token_validator.py | Implements routing changes, tid↔issuer binding, and opt-in issuer validation. |
| libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/authorization/jwt/_authorize_request.py | Adjusts logging to avoid leaking validation details while still returning 401s. |
| libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/authorization/agent_auth_configuration.py | Adds issuer allow-list configuration and safe boolean parsing for issuer validation opt-in; improves audience handling. |
| libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/authorization/_entra_issuers.py | New shared issuer/tenant/cloud parsing and default issuer construction utilities. |
| libraries/microsoft-agents-hosting-aiohttp/microsoft_agents/hosting/aiohttp/jwt_authorization_middleware.py | Adds Authorization header normalization behavior before delegating to shared validation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Matthew (matthewmeyer)
enabled auto-merge (squash)
August 3, 2026 20:24
Rodrigo Brandão (rodrigobr-msft)
approved these changes
Aug 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.