fix(credential-groups): raise OAuth code cap so Atlassian callbacks validate - #7422
Merged
Merged
Conversation
…alidate The managed credential-group callback capped the OAuth `code` query param at 2048 characters. That bound was sized when the flow only supported Slack, whose authorization codes are short, and was never revisited as more providers were added. Providers that return a signed JWT as the authorization code exceed it, so the callback rejected the exchange with a validation error before it ran. Share a single MAX_OAUTH_CODE_LENGTH (8192) from the contract primitives and use it on both callback paths, so the two contracts cannot drift apart again. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013e5sXbYST2R4qNzM996GFg
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile SummaryThe PR raises the credential-group OAuth authorization-code limit to 8192 characters and centralizes that limit for the two bounded callback contracts.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/api/contracts/primitives.ts | Defines the shared 8192-character OAuth code bound and fixes the previously overstated adoption comment. |
| apps/sim/lib/api/contracts/credential-groups.ts | Replaces the credential-group callback’s 2048-character cap with the shared 8192-character limit. |
| apps/sim/lib/api/contracts/oauth-connections.ts | Reuses the shared OAuth code bound instead of a private equivalent constant. |
| apps/sim/lib/api/contracts/credential-groups.test.ts | Adds positive and boundary-rejection coverage for the raised callback-code limit. |
Reviews (2): Last reviewed commit: "fix(credential-groups): correct the OAut..." | Re-trigger Greptile
The constant's comment claimed every callback contract shares the bound, but the Shopify and MCP callback schemas leave `code` unbounded. Describe what the bound is and why it is sized as it is, without asserting an adoption scope that would go stale as contracts are migrated onto it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013e5sXbYST2R4qNzM996GFg
Collaborator
Author
Collaborator
Author
|
@cubic-dev-ai review this PR |
Contributor
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
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.
Summary
codequery param at 2048 characters, so providers that return a signed JWT as their authorization code (Atlassian's Confluence/Jira among them) failed validation before the token exchange ran.MAX_OAUTH_CODE_LENGTH(8192) from the contract primitives and used it on both callback paths.oauth-connections.tsalready used 8192 for the same field via its own private literal; the two contracts had drifted, and this collapses them onto one constant so they can't again.Type of Change
Testing
Tested manually. Added two contract tests: a JWT-sized code now parses, and a code past the new bound is still rejected. Verified the first test fails against the old 2048 cap and passes with the fix.
bun run lint,bun run check:audits(45 audits), andcheck:api-validation:strictall pass.Checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_013e5sXbYST2R4qNzM996GFg