Skip to content

v1 hardening: gate localhost WS origin behind a flag; document ID_HEADER#81

Merged
windoze95 merged 1 commit into
mainfrom
fix/v1-api-hardening
Jun 26, 2026
Merged

v1 hardening: gate localhost WS origin behind a flag; document ID_HEADER#81
windoze95 merged 1 commit into
mainfrom
fix/v1-api-hardening

Conversation

@windoze95

Copy link
Copy Markdown
Owner

Two items from the v1 release audit.

  • WS localhost origin: CheckOrigin accepted any http://localhost:* origin unconditionally — dev convenience that shouldn't be live in prod. Now gated behind ALLOW_DEV_ORIGINS (defaults off), so production rejects localhost browser origins. The cooking socket is already token-authenticated (?token=), so this is defense-in-depth, not a fix for an open hole. The Flutter app sends no Origin and the prod domains stay whitelisted, so nothing user-facing changes. TestCheckOrigin updated to cover both states.
  • ID_HEADER docs: it's a required shared secret that gates the API to the official client (X-SaltyBytes-Identifier), but .env.example left it blank and unexplained — an onboarding/fresh-deploy trap. Documented it, plus the new ALLOW_DEV_ORIGINS toggle.

Full go test ./... green.

Deliberately not changed

  • The upgrade endpoint's 501 — the app depends on that exact response to show its "not yet available" message; changing the status/envelope would break it.
  • Context/S3 error-detail wrapping (audit "should-fix") — these are internal "should never happen" paths or get logged, not blockers; left to avoid churning handlers for negligible gain.

🤖 Generated with Claude Code

- The cooking WebSocket CheckOrigin accepted any http://localhost origin
  unconditionally — dev convenience that should not be live in production.
  Gate it behind ALLOW_DEV_ORIGINS (defaults off) so prod rejects localhost
  browser origins. The socket is already token-authenticated; this is
  defense-in-depth. Test updated to cover both states.
- Document ID_HEADER in .env.example (required shared secret that gates the
  API to the official client via the X-SaltyBytes-Identifier header) and add
  the new ALLOW_DEV_ORIGINS toggle.

Full go test ./... green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@windoze95 windoze95 merged commit 672d073 into main Jun 26, 2026
1 check passed
@windoze95 windoze95 deleted the fix/v1-api-hardening branch June 26, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant