Skip to content

Add tenant ID validation for Entra issuer in claims identity - #515

Merged
Matthew (matthewmeyer) merged 2 commits into
mainfrom
users/matthewm/tid-issuer-validation
Aug 3, 2026
Merged

Add tenant ID validation for Entra issuer in claims identity#515
Matthew (matthewmeyer) merged 2 commits into
mainfrom
users/matthewm/tid-issuer-validation

Conversation

@matthewmeyer

Copy link
Copy Markdown
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.
Copilot AI review requested due to automatic review settings August 3, 2026 18:39
@matthewmeyer
Matthew (matthewmeyer) requested a review from a team as a code owner August 3, 2026 18:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 tidiss tenant binding in JwtTokenValidator.validate_token() (plus optional issuer allow-list via VALIDATE_ISSUER).
  • Extend AgentAuthConfiguration to support ISSUERS lists (including env-driven lists) and safe boolean coercion for VALIDATE_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.

Copilot AI review requested due to automatic review settings August 3, 2026 19:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

@matthewmeyer
Matthew (matthewmeyer) enabled auto-merge (squash) August 3, 2026 20:24
@matthewmeyer
Matthew (matthewmeyer) merged commit 8db52de into main Aug 3, 2026
11 checks passed
@matthewmeyer
Matthew (matthewmeyer) deleted the users/matthewm/tid-issuer-validation branch August 3, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add TID→Issuer cross-check in inbound JWT validation Cleanup JWT valid audience and tenant id resolution

4 participants