infra-feat: harden edge origin trust#430
Conversation
|
🚅 Deployed to the euler-lite-pr-430 environment in euler-lite
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: euler-xyz/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (13)
🚧 Files skipped from review as they are similar to previous changes (12)
📝 WalkthroughWalkthroughThis PR hardens production request validation by introducing a trusted ingress system using ChangesTrusted Ingress and Internal Request Validation
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
f1f97fc to
249d1c9
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@server/utils/deploy-env.ts`:
- Around line 12-14: isDevelopmentRuntime() currently compares
process.env.DOPPLER_ENVIRONMENT raw value which can mis-detect values with
whitespace; update isDevelopmentRuntime() to normalize the env var the same way
as isProductionRuntime() (trim() and optionally toLowerCase()) before comparing
to 'dev' so inputs like 'dev ' or ' DEV' are correctly recognized; adjust the
comparison in the isDevelopmentRuntime function (and ensure consistency with
isProductionRuntime) referencing the isDevelopmentRuntime and
isProductionRuntime functions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: euler-xyz/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ad8855cf-ef17-4f66-b5e2-ac094a21dbff
📒 Files selected for processing (13)
.env.exampledocs/architecture.mddocs/geo-blocking.mdserver/middleware/cors.tsserver/middleware/geo-gate.tsserver/utils/deploy-env.tsserver/utils/internal-headers.tsserver/utils/rate-limit.tsserver/utils/trusted-ingress.tstests/server/cors.test.tstests/server/geo-gate.test.tstests/server/internal-request.test.tstests/server/rate-limit.test.ts
249d1c9 to
88992a8
Compare
88992a8 to
85e30c5
Compare
Summary
CF-Connecting-IPinternal sentinel with a private internal request header for server-side$fetchcalls.Changes
NODE_ENV=productionis present without a known Doppler environment.x-euler-internal-requestheader, with an optional sharedINTERNAL_FETCH_SECRETfor multi-worker deployments.DevOps rollout notes
EDGE_ORIGIN_SECRET.x-euler-edge-origin-secret: <EDGE_ORIGIN_SECRET>on requests forwarded to the app origin.x-euler-edge-origin-secret,x-euler-internal-request, andCF-*forwarding headers before forwarding to origin./api/*directly must either run through trusted ingress or include the trusted ingress header. The Docker health check currently calls/api/tenderly/status.INTERNAL_FETCH_SECRETis optional. Only set it if server-internal relative$fetchcalls can cross worker/process boundaries; otherwise the process-local random default is fine.DOPPLER_ENVIRONMENT=devorDOPPLER_ENVIRONMENT=stg. If they run withNODE_ENV=productionand no known Doppler environment, they now behave production-like and require trusted ingress.Test plan
npm run test:run -- tests/server/internal-request.test.ts tests/server/cors.test.ts tests/server/geo-gate.test.ts tests/server/rate-limit.test.tsnpm run test:runnpm run typechecknpm run lintNODE_ENV=productionfallback.Summary by CodeRabbit
New Features
Documentation
Tests