Repository navigation
feat: mark session cookies Secure behind an https public URL - #110
Conversation
ADR 0004 deferred the Secure cookie attribute to deployment hardening. An operator now states the address people use (serve --public-url / CONSOLEBOOK_PUBLIC_URL; installer --public-url). It parses into a typed origin; an https:// one marks the sign-in and sign-out cookies Secure. The decision never comes from forwarded headers a direct client could forge. A misconfiguration is visible instead of silent: serve warns when it listens beyond loopback without an https public URL, /api/instance reports the public URL, and the sign-in page names it to a browser that arrived by another address (a dropped Secure cookie would otherwise make sign-in bounce without explanation). ADR 0025 records the decision and amends ADR 0004. The install guide gives a Caddy configuration, run in front of this build: setup and sign-in through it returned a Secure cookie that kept the session. Tests: parsing; Secure set with an https URL and absent otherwise, on both sign-in and sign-out (forcing it off fails the test); the instance field; a browser test for the sign-in note; a release-workflow step for the installer option. Closes #93 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts
# Conflicts: # CHANGELOG.md
# Conflicts: # CHANGELOG.md # docs/decisions/0023-linux-installation-lifecycle.md
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: db7758c73b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…tarts PublicUrl now refuses an empty host, a non-numeric or out-of-range port, an unclosed or invalid IPv6 literal, and malformed host names, so serve never advertises an address no browser can open. The installer's --no-service start command carries CONSOLEBOOK_PUBLIC_URL, which the release workflow now checks. Refs #93 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts
|
@codex review Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f7f98c9a3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…al IPv4 hosts The first-run log now sends operators to the public URL when one is set, not http://<bind>/, where setup would end at a sign-in whose Secure cookie never sticks. A host whose last label is numeric must be a plain dotted IPv4 address, since browsers refuse 999.999.999.999 and rewrite 0x7f.0.0.1. Refs #93 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts
|
@codex review Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5c8b33cabf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… changing anything A hidden check-public-url command parses the address exactly as serve does and prints its origin. The installer runs it from the unpacked release before stopping the service or writing settings, so a malformed address fails the install with nothing changed instead of leaving the service down. Refs #93 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts
|
@codex review Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2330800776
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Lowercase host, compressed IPv6, and no default port, so the sign-in page's comparison with location.origin does not warn a browser that is already at the configured address. Refs #93 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts
|
@codex review Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c13a4ad282
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…tarts Each session now records whether its cookie was issued Secure (migration 0016). serve, started with an https:// public URL, revokes every live session that was not, so a cookie a browser may still send over plain HTTP stops being a credential at once instead of lasting up to its 12-hour expiry. Refs #93 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts
|
@codex review Generated by Claude Code |
The schema-preservation guard (enrollment_event_schema) requires later migrations to add owners, never change existing objects, so migration 0016 creates session_secure_cookie instead of altering session. Session creation writes both rows in one immediate write transaction. Refs #93 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 595a489e89
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Primary Issue
Closes #93
Problem And Outcome
ADR 0004 deferred the
Securecookie attribute to deployment hardening. Without it, a browser sends the session cookie over plain HTTP whenever the installation is reached that way. The service speaks plain HTTP behind a TLS reverse proxy, so it can't tell on its own whether the browser used HTTPS, and forwarded headers can be forged.After this PR, an operator states the address people use:
--public-url,CONSOLEBOOK_PUBLIC_URL, or the installer's--public-url. Anhttps://address does two things:Secure. That decision comes only from this setting, never from request headers;Secure, so an old cookie stops being a credential at once.A wrong or missing address degrades visibly, never silently.
Changes
public_url.rs: the typedPublicUrlorigin.http(s)://, a host, and an optional port.session_cookieandremoval_cookietakesecure;sessions::createtakes a typedCookieTransport;session_secure_cookietable, a new owner, sosessionitself is unchanged as the schema guard requires;sessions::revoke_not_secureruns at start in Secure mode.serve:https://URL;/api/instancereportspublic_url. The sign-in page names the right address when the browser's origin differs.--public-urlis validated by the unpacked release's own parser (hiddencheck-public-url) before anything is stopped or written;--no-servicestart command.docs/install.md"HTTPS (required before real records)", with a tested Caddy recipe, and a note that enabling it signs everyone out once;Correction rung: 1. One typed setting decides
Secure; one parser serves both the server and the installer.Verification
tests/public_url.rs:Secure,HttpOnly, andSameSite=Stricton login and logout cookies with an https URL, and none without one or with an http one;/api/instancereports the URL;check-public-urlagrees with the parser.web/e2e/public-url.spec.ts(2 tests): the sign-in notice shows when the origin differs, and doesn't when it matches./api/instancecarry the URL;--public-urlis refused with the service still active and the setting unchanged;--no-servicecommand carries the URL.595a489(scripts/proof.py, euid 0 with DAC capabilities dropped): passed, all 7 gates. Browser suite 61 expected, 0 unexpected, 0 flaky. Receipt.proof/20261014T234746Z-595a489e89a2/receipt.json, sha25653fb5594f5d1ac319b935b312b8a06e6e01e7e9d6652514736284e63a125edfd.🤖 Generated with Claude Code
https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts