-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
🧹 chore: Enhance config validation in EncryptCookie middleware #3491
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
🧹 chore: Enhance config validation in EncryptCookie middleware #3491
Conversation
WalkthroughThis update introduces explicit encryption key validation in the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Middleware
participant Utils
Client->>Middleware: Send request with encrypted cookie
Middleware->>Utils: validateKey(cfg.Key)
alt Key invalid
Utils-->>Middleware: error
Middleware-->>Client: Panic with error
else Key valid
Utils-->>Middleware: success
Middleware->>Utils: DecryptCookie(cookie, key)
alt Decryption fails
Utils-->>Middleware: error
Middleware->>Middleware: DelCookieBytes(key)
else Decryption succeeds
Utils-->>Middleware: decrypted value
Middleware->>Client: Proceed with request
end
end
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (4)
🧰 Additional context used🧠 Learnings (3)📓 Common learningsmiddleware/encryptcookie/config_test.go (4)middleware/encryptcookie/utils.go (2)🧬 Code Graph Analysis (1)middleware/encryptcookie/config_test.go (2)
⏰ Context from checks skipped due to timeout of 90000ms (4)
🔇 Additional comments (8)
✨ 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3491 +/- ##
==========================================
+ Coverage 83.81% 83.89% +0.07%
==========================================
Files 120 120
Lines 12261 12268 +7
==========================================
+ Hits 10277 10292 +15
+ Misses 1559 1553 -6
+ Partials 425 423 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50.
| Benchmark suite | Current: ab6755e | Previous: a779888 | Ratio |
|---|---|---|---|
Benchmark_Ctx_IsProxyTrusted/NoProxyCheckParallel |
1.421 ns/op 0 B/op 0 allocs/op |
0.9416 ns/op 0 B/op 0 allocs/op |
1.51 |
Benchmark_Ctx_IsProxyTrusted/NoProxyCheckParallel - ns/op |
1.421 ns/op |
0.9416 ns/op |
1.51 |
This comment was automatically generated by workflow using github-action-benchmark.
Summary