Restrict origin#3342
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR adds origin header validation to Turnkey endpoints. It introduces a reusable Express middleware that parses an allowlist from configuration, performs case-insensitive exact-match validation of incoming Origin headers, and rejects non-matching origins with a 403 response while allowing requests without an Origin header to pass through. ChangesOrigin Header Allowlist Validation
Sequence DiagramsequenceDiagram
participant Client
participant originAllowlistMiddleware
participant Handler
participant Response
Client->>originAllowlistMiddleware: POST /turnkey/signin<br/>(with Origin header)
alt Origin in allowlist
originAllowlistMiddleware->>originAllowlistMiddleware: Vary: Origin
originAllowlistMiddleware->>Handler: next()
Handler->>Response: 200 OK
else Origin not in allowlist
originAllowlistMiddleware->>Response: 403 Forbidden<br/>(JSON error)
else No Origin header
originAllowlistMiddleware->>Handler: next()
Handler->>Response: 200 OK
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsStopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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 |
Changelist
[Describe or list the changes made in this PR]
Test Plan
[Describe how this PR was tested (if applicable)]
Author/Reviewer Checklist
state-breakinglabel.indexer-postgres-breakinglabel.PrepareProposalorProcessProposal, manually add the labelproposal-breaking.feature:[feature-name].backport/[branch-name].refactor,chore,bug.Summary by CodeRabbit
New Features
TURNKEY_ALLOWED_ORIGINSto specify a comma-separated list of allowed request origins.Tests