Skip to content

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
modelcontextprotocol:mainfrom
richardli515:ema-resource-as-id-jag-claim-checks
Draft

richardli515 wants to merge 2 commits into
modelcontextprotocol:mainfrom
richardli515:ema-resource-as-id-jag-claim-checks

Conversation

@richardli515

@richardli515 richardli515 commented Nov 21, 2026 •

Copy link
Copy Markdown

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, unknown scope, bad signature and untrusted iss. 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 with 400 invalid_grant:

Case Check ids Requirement
typ header is JWT, not oauth-id-jag+jwt (e.g. a plain ID token replayed as an ID-JAG) resource-as-error-wrong-typ-{status,code} ID-JAG draft-04 §3.1 (MUST), §4.4.1; RFC 8725 §3.11
aud names a different Resource AS resource-as-error-wrong-audience-{status,code} ID-JAG draft-04 §4.4.1 (MUST, invalid_grant)
exp in the past resource-as-error-expired-{status,code} RFC 7523 §3 (MUST), via §4.4.1 / RFC 7521 §5.2
client_id ≠ authenticated client resource-as-error-client-id-mismatch-{status,code} ID-JAG draft-04 §4.4.1 (MUST, invalid_grant)

All checks are FAILURE-severity since each rule is a MUST.

Other changes

  • Mock Resource AS now enforces the client_id rule — it previously accepted an ID-JAG whose client_id didn't match the authenticated client.
  • Mock gains insecureSkipIdJagRules (negative tests only), so each check is proven to fail against a Resource AS that omits that rule.
  • createIdJag accepts a typ override.

Testing

  • npm run build, npm run lint, npm run typecheck, npm test all pass (623 tests).
  • New vitest cases: 8/8 SUCCESS against the conformant mock; for each of the four rules, a mock that skips it fails exactly that case's 2 checks.
  • Via the CLI (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 skips exp.

All runs are against the in-repo mock; not yet run against a real Resource AS implementation.

Notes / questions

tnorimat and others added 2 commits September 4, 2026 17:52
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

No deployments
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.

2 participants