Use __Host- prefixed names for the dashboard session and challenge cookies
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- authentication, security
Research direction
Start by reading the cookie handling in server/orcaster_server/deps.py and server/orcaster_server/auth/router.py, then trace the session lookups in auth/factory.py and the Origin check in main.py. Run or add the tests named in the acceptance criteria for secure and insecure settings, migration, challenge cookies, and logout. Done means those behaviors pass and an Unreleased CHANGELOG entry explains the old-cookie removal and promoted-session window.
Written by the indexing model from the issue text.
Description
Problem
The dashboard session cookie is named session (server/orcaster_server/deps.py:37, passed as cookie_name at server/orcaster_server/main.py:330). The passkey challenge cookie is named webauthn_challenge (server/orcaster_server/auth/router.py:33). It is set when a login or a registration begins (server/orcaster_server/auth/router.py:147-155, :341), read when it completes (:162, :359) and deleted after (:186, :420). Neither uses the __Host- prefix.
Without the prefix, a page on a sibling subdomain can set a cookie with the same name for the parent domain. That allows login CSRF or session fixation: the victim ends up signed in as another account. The Origin check (server/orcaster_server/auth/origin.py:103) does not cover this case, because it only runs when the session cookie is already present.
A browser accepts a __Host- cookie only when it is Secure, has Path=/ and has no Domain. The session and challenge cookies already use path="/" and no Domain (server/orcaster_server/auth/router.py:121-130, server/orcaster_server/auth/router.py:147-155, server/orcaster_server/auth/router.py:340-348). Secure follows SESSION_COOKIE_SECURE, which defaults to false (server/orcaster_server/config.py:117) and is set to true by the server installer (setup-scripts/debian13/03-app-install.sh:161).
Proposed change
- When
SESSION_COOKIE_SECUREis true, set the session cookie as__Host-sessionand the challenge cookie as__Host-webauthn_challenge. When it is false (local http development), keep the current names, because a browser rejects a__Host-cookie withoutSecure. - Read the session in one helper used by
server/orcaster_server/deps.py:66,server/orcaster_server/auth/factory.py:39,server/orcaster_server/auth/router.py:193andserver/orcaster_server/auth/router.py:282. It prefers the new name and falls back to the old one. - When a request authenticates with the old name, set the new cookie with the same token and delete the old one.
- Every challenge cookie set and delete (
server/orcaster_server/auth/router.py:147-155,:186,:341,:420) uses the new name. The challenge reads (:162for login,:359for registration) prefer__Host-webauthn_challengeand fall back towebauthn_challenge. The delete after a completed ceremony also removes the old name. - The Origin check middleware (
server/orcaster_server/main.py:348-352) treats either name as "session present". - Logout deletes both names.
Compatibility
- Signed-in users are not logged out by the upgrade. The old
sessioncookie is still accepted for one release and is replaced by__Host-sessionon the next request. - Deployments with
SESSION_COOKIE_SECURE=falsekeep the current names and see no change. - The challenge cookie lives for minutes only (
challenge_ttl_seconds,server/orcaster_server/auth/config.py:51). A login or registration that began before the upgrade still completes, because the challenge reads fall back to the old name (step 4). - Step 3 promotes any old-name session cookie, including one planted from a sibling subdomain. So the fixation risk lasts until the fallback is removed, plus up to
session_ttl_seconds(30 days,server/orcaster_server/auth/config.py:48) for sessions promoted from the old name. The release that drops the old name also revokes sessions promoted from it, or the release note documents this residual window. That release is announced in the CHANGELOG. - The challenge cookie fallback only needs to cover
challenge_ttl_secondsafter the upgrade. It can be dropped earlier than the session fallback. - API clients that use a PAT bearer token are not affected.
Acceptance criteria
- With
SESSION_COOKIE_SECURE=true, login sets__Host-sessionwithSecure,HttpOnly,Path=/and noDomain(test). - With
SESSION_COOKIE_SECURE=false, login setssessionas today (test). - A request with only the old
sessioncookie is authenticated, and the response sets__Host-sessionand deletessession(test). - When both cookies are present, the
__Host-one wins (test). - The Origin check rejects a cross-origin unsafe request that carries either cookie name (test).
- Logout clears both names (test).
- With
SESSION_COOKIE_SECURE=true, a login and a registration that began with the oldwebauthn_challengecookie still complete, and the old cookie is deleted (tests). - Login and registration begin set
__Host-webauthn_challenge, and the complete steps delete it (tests). - The old cookie is still accepted for one release, so existing sessions survive the upgrade.
- CHANGELOG entry under Unreleased that names the new cookie names and the release that drops the old ones, and how sessions promoted from the old name are revoked or how long they can remain.
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 10
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AInvirion/orcaster
-
enhancement P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
enhancement good first issue P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug P2 server
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
bug P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
enhancement P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
All issues in AInvirion/orcaster
Similar issues
-
[Resource]: SpaicelyOpenresource-submission validation-passed
Difficulty 1/5 Under an hour Newbie friendliness 68/100
hesreallyhim/awesome-claude-code#3875 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
bvis/aegis-hass#725 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
datasektionen/cashflow#468 ·
-
dont call alembic upgrade until we check whether or not the cache DB has an alembic version stampOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Bug: AttributeError: 'GptOssConfig' object has no attribute 'rope_scaling_factor' with transformers >= 5.xPossibly taken @NimaVaziri claimed this today. OpenPytorch
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NVIDIA/TensorRT-LLM#23406 ·
Maintainers usually reply within 1 day