Skip to content

feat: flag session cookies Secure behind HTTPS proxies - #5

Merged
danielglh merged 2 commits into
mainfrom
feat/secure-cookie
Aug 27, 2026
Merged

feat: flag session cookies Secure behind HTTPS proxies#5
danielglh merged 2 commits into
mainfrom
feat/secure-cookie

Conversation

@danielglh

Copy link
Copy Markdown
Owner

Delivers roadmap item 1 (see #4 for the plan).

Behavior

  • The session cookie is flagged Secure automatically when a login arrives
    with X-Forwarded-Proto: https — the standard reverse-proxy setup. Logout's
    clearing cookie carries the same flag.
  • Pin the behavior with OMP_WEB_SECURE_COOKIE=true|false (config.json key
    secureCookie also works) for setups where forwarded headers cannot be
    trusted. Default stays auto; plain HTTP keeps working as before.

Resolution order

loadConfig override → env → config file → "auto".

Tests

  • auto mode: login through a forwarded-https request yields …; Secure, plain
    request does not; logout clear-cookie mirrors it
  • overrides: secureCookie: true forces Secure without any header;
    secureCookie: false ignores the header
  • resolution precedence: config file value read and beaten by env
  • existing auth suite unchanged and green

Docs: README auth bullet rewritten, env table gains
OMP_WEB_SECURE_COOKIE, roadmap item checked off.

The server now marks its session cookie Secure automatically when a login
arrives with X-Forwarded-Proto: https — the standard reverse-proxy setup.
Behavior is pinable via OMP_WEB_SECURE_COOKIE=true|false (or the config.json
key secureCookie) for setups where forwarded headers cannot be trusted; the
default remains "auto". Logout clears the cookie with the same flag.

Tests cover auto-detection on/off, both override directions, and resolution
precedence (env > config file). README documents the new env var and drops
the manual "no Secure flag" caveat from the auth notes; roadmap item checked
off.
@danielglh
danielglh merged commit e02b28e into main Aug 27, 2026
1 check passed
@danielglh
danielglh deleted the feat/secure-cookie branch August 27, 2026 06:17
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