Handle legacy jwt TokenLookup migration#240
Conversation
|
Warning Rate limit exceeded@ReneWerner87 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 51 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (1)
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughModified the JWT package import detection regex in the migration tool to accept both legacy and new import paths ( Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
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 |
Summary of ChangesHello @ReneWerner87, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the JWT extractor migration tool by extending its compatibility to include older Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly expands the JWT extractor migration to handle legacy github.com/gofiber/jwt import paths. The change to the import path regex is accurate, and the addition of a regression test for this legacy path is excellent for ensuring the migration works as expected. I have one suggestion to simplify the new test case to improve its clarity and consistency with other tests in the file.
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
cmd/internal/migrations/v3/jwt_extractor_test.go (1)
127-155: LegacyImportPath test validates migration forgithub.com/gofiber/jwtThis regression test confirms that configs using the legacy
github.com/gofiber/jwt/v2import are migrated to a cookieExtractor, with thefiber/v3/extractorsimport and migration notice present, which is exactly what the new regex is supposed to enable. If you want to keep the fixture minimal (as suggested in the earlier review), you could drop the extraErrorHandler/SigningKeyfields since they don’t affect the text-based migration being asserted.
🧹 Nitpick comments (1)
cmd/internal/migrations/v3/jwt_extractor.go (1)
16-16: Regex extension correctly supports both contrib and legacy jwt importsThe updated
reImportpattern cleanly handles optional aliases, bothgithub.com/gofiber/contrib/jwtandgithub.com/gofiber/jwt(with optional/vN), and inline//comments without changing the alias capture group index. You might optionally add a short comment above it documenting the accepted import forms, since the regex is getting dense.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
cmd/internal/migrations/v3/jwt_extractor.go(1 hunks)cmd/internal/migrations/v3/jwt_extractor_test.go(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
cmd/internal/migrations/v3/jwt_extractor_test.go (1)
cmd/internal/migrations/v3/jwt_extractor.go (1)
MigrateJWTExtractor(15-95)
🪛 GitHub Actions: golangci-lint
cmd/internal/migrations/v3/jwt_extractor_test.go
[error] 39-39: golangci-lint: File is not properly formatted (gci).
🪛 GitHub Check: lint
cmd/internal/migrations/v3/jwt_extractor_test.go
[failure] 39-39:
File is not properly formatted (gci)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Build (1.25.x, macos-13)
- GitHub Check: Build (1.25.x, ubuntu-latest)
- GitHub Check: Build (1.25.x, macos-latest)
- GitHub Check: Build (1.25.x, windows-latest)
🔇 Additional comments (2)
cmd/internal/migrations/v3/jwt_extractor_test.go (2)
91-95: Custom-alias migration assertions look correctThese assertions confirm that
TokenLookupis removed, the cookie extractor is emitted, the extractors import is present, and the migration notice is printed for a custom alias, which matches the intended behavior.
97-125: ImportWithComment test covers inline-comment import regressionThis test exercises a
jwtimport line with an inline//comment and verifies thatTokenLookupis migrated toExtractor, thefiber/v3/extractorsimport is added, and the migration notice is printed. That gives good, focused coverage for the new regex support of commented imports.
Summary
github.com/gofiber/jwtimport pathsTesting
Codex Task
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.