Default CORS origin to PUBLIC_APP_URL instead of reflecting any origin with credentials #29
Labels
No labels
bug
decision
docs
enhancement
integration
ops
security
tech-debt
testing
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
rbrooks/BatteryStorageCalculator#29
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
backend/src/app.js:73passesorigin: true, credentials: truewheneverCORS_ORIGIN=*, which is the default inconfig.js:7,.env.example:3, anddocker-compose.full.yml:17. Reflected-origin + credentials is unsafe by construction; the currentsameSite: 'lax'session cookie is the only thing keeping it theoretical.Fix: when auth is enabled, use
PUBLIC_APP_URL(already configured) as the default allowed origin and reject*; keep permissive CORS only forAUTH_MODE=disabledlocalhost development. Update.env.exampleand compose defaults to match.Acceptance criteria
Relations: relates to #8
(Audit finding F-08, 2026-07-16 — Severity: Medium, Confidence: High)