-
-
Notifications
You must be signed in to change notification settings - Fork 16
fix: add max_length constraint to refresh token schema #818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add `max_length=1024` constraint to the refresh token field in TokenRefreshRequest schema, matching MAX_JWT_TOKEN_LENGTH. This provides defense-in-depth validation, with Pydantic catching oversized tokens at the schema level (422) before business logic (401). Also updates tests to reflect this behavior change: - Unit test now expects ValidationError for oversized tokens - Integration tests no longer test oversized tokens (handled by schema)
📝 WalkthroughWalkthroughThe changes implement schema-level validation for JWT refresh tokens by adding a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
What
Add
max_lengthconstraint to the refresh token field inTokenRefreshRequestschema, usingMAX_JWT_TOKEN_LENGTHconstant.Why
Provides defense-in-depth validation, with Pydantic catching oversized
tokens at the schema level (422) before business logic (401).
Changes
MAX_JWT_TOKEN_LENGTHconstant instead of hardcodingValidationErrorfor oversized tokensMAX_JWT_TOKEN_LENGTHimport from integration testsReferences
#31Summary by CodeRabbit
Security
Changes
✏️ Tip: You can customize this high-level summary in your review settings.