fix(gateway): add missing validation for custom JWT claim values#644
Merged
aidandaly24 merged 1 commit intoaws:mainfrom Mar 25, 2026
Merged
Conversation
matchValueString and matchValueStringList items lacked regex validation, allowing characters (e.g. / :) that the API rejects at deploy time. Also blocks 'client_id' as a reserved custom claim name (server-side business rule) and fixes stale mcp.json references in comments. Validation constraints sourced from the ClaimMatchValueType and CustomClaimValidationType API reference documentation. - matchValueString: added regex [A-Za-z0-9_.-]+ and max(255) - matchValueStringList items: same regex and max(255) per item - inboundTokenClaimName: added max(255) and reserved name blocklist - Updated stale mcp.json comment references to agentcore.json
71c1d09 to
b1d0358
Compare
notgitika
approved these changes
Mar 25, 2026
Contributor
notgitika
left a comment
There was a problem hiding this comment.
LGTM thanks for adding this validation!
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.
Description
Add missing Zod validation for custom JWT claim values to catch invalid input at CLI time instead of failing at deploy time.
matchValueStringandmatchValueStringListitems lacked regex validation, allowing characters (e.g./,:) that the API rejects. Added[A-Za-z0-9_.-]+pattern andmax(255)per the ClaimMatchValueType API docs.inboundTokenClaimName: Addedmax(255)length constraint and a blocklist forclient_id— a server-side reserved claim name that the API rejects but doesn't document in its schema.mcp.jsoncomment references →agentcore.json.Related Issue
Documentation PR
N/A — no user-facing doc changes needed.
Type of Change
Testing
How have you tested the change?
npm run test:unitandnpm run test:integnpm run typechecknpm run lintsrc/assets/, I rannpm run test:update-snapshotsand committed the updated snapshotsChecklist
Companion CDK PR: https://github.com/aws/agentcore-l3-cdk-constructs/pull/107
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.