Repository navigation
feat(ema): reject ID-JAGs with wrong typ, aud, exp or client_id at the Resource AS - #594
Draft
richardli515 wants to merge 2 commits into
Draft
richardli515 wants to merge 2 commits into
richardli515 wants to merge 2 commits into
Conversation
Signed-off-by: Takashi Norimatsu <takashi.norimatsu.ws@hitachi.com>
…e Resource AS Adds ResourceServerIdJagValidationScenario (ema/resource-authorization-server/error-path-id-jag-validation): a trusted IdP signs ID-JAGs that are each wrong in one field the Resource AS MUST validate, and every one must be rejected with 400 invalid_grant. - typ header not oauth-id-jag+jwt (draft-ietf-oauth-identity-assertion-authz-grant-04 §3.1, §4.4.1; RFC 8725 §3.11) - aud naming a different Resource AS (§4.4.1) - exp in the past (RFC 7523 §3) - client_id not matching the authenticated client (§4.4.1) The mock Resource AS now enforces the client_id rule, which it previously skipped, and gains an insecureSkipIdJagRules option so each check is proven to fail against a Resource AS that omits that rule. Builds on modelcontextprotocol#490 (issue modelcontextprotocol#470).
This branch has not been deployed
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.
Builds on #490 (issue #470). Stacked on top of that branch, so its commit shows here too — happy to rebase once #490 lands, or to move these commits onto the #490 branch if @tnorimat prefers.
What this adds
#490 covers untrusted
resource, unknownscope, bad signature and untrustediss. This PR adds the remaining ID-JAG fields the Resource AS MUST validate, as one scenario with 8 checks (ema/resource-authorization-server/error-path-id-jag-validation). A trusted IdP signs ID-JAGs that are each wrong in exactly one field; every one must be rejected with400 invalid_grant:typheader isJWT, notoauth-id-jag+jwt(e.g. a plain ID token replayed as an ID-JAG)resource-as-error-wrong-typ-{status,code}audnames a different Resource ASresource-as-error-wrong-audience-{status,code}invalid_grant)expin the pastresource-as-error-expired-{status,code}client_id≠ authenticated clientresource-as-error-client-id-mismatch-{status,code}invalid_grant)All checks are
FAILURE-severity since each rule is a MUST.Other changes
client_idrule — it previously accepted an ID-JAG whoseclient_iddidn't match the authenticated client.insecureSkipIdJagRules(negative tests only), so each check is proven to fail against a Resource AS that omits that rule.createIdJagaccepts atypoverride.Testing
npm run build,npm run lint,npm run typecheck,npm testall pass (623 tests).resource-authorization-server --scenario ema/resource-authorization-server/error-path-id-jag-validation): 8/8 against the conformant mock, 6/8 against a mock that skipsexp.All runs are against the in-repo mock; not yet run against a real Resource AS implementation.
Notes / questions
SKIPPEDwhen settings are missing. AGENTS.md prefersuntestableCheck()for missing prerequisites — happy to switch both if that's preferred.