Skip to content

fix(security): harden env ignore, host allowlist, and logout cookies - #925

Open
dakota2499 wants to merge 1 commit into
builderz-labs:mainfrom
dakota2499:dakota2499/add-chatgpt-openai-integration
Open

fix(security): harden env ignore, host allowlist, and logout cookies#925
dakota2499 wants to merge 1 commit into
builderz-labs:mainfrom
dakota2499:dakota2499/add-chatgpt-openai-integration

Conversation

@dakota2499

Copy link
Copy Markdown

Summary

  • Ignore all .env* variants by default (including .env.bak*) so backup env files with secrets cannot be accidentally committed; keep .env.example and .env.test trackable.
  • Make production host filtering fail-closed when MC_ALLOWED_HOSTS is empty (only implicit local hosts), unless MC_ALLOW_ANY_HOST=1 is set.
  • On logout, revoke and expire both __Host-mc-session and legacy mc-session cookies so HTTP→HTTPS transitions cannot leave a valid session behind.
  • Add regression tests for the host gate and dual-cookie session helpers.

Context

These changes came from a local security audit of Mission Control. They are small, high-value hardening fixes with unit test coverage.

Test plan

  • vitest run src/proxy.test.ts (includes empty MC_ALLOWED_HOSTS fail-closed case)
  • vitest run src/lib/__tests__/session-cookie.test.ts
  • CI green on this PR
  • Manual: production-mode host with empty allowlist blocks unrelated Host header; localhost still works
  • Manual: logout clears both cookie names

Prevent accidental .env.bak credential commits, fail-closed production
host filtering when MC_ALLOWED_HOSTS is empty, and clear both secure and
legacy session cookies on logout. Adds regression tests from Codex audit
triage (Hermes agreed).
@dakota2499
dakota2499 requested a review from 0xNyk as a code owner August 11, 2026 17:56
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