fix(auth): local sign-in works behind trusted HTTPS proxies - #177
Merged
vincentkoc merged 1 commit intoAug 27, 2026
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Contributor
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(auth): local sign-in works behind trusted HTTPS proxies This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
vincentkoc
marked this pull request as ready for review
August 27, 2026 07:50
vincentkoc
deleted the
security/codeql-clickclack-secure-cookies-20260827
branch
August 27, 2026 07:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes the cookie-policy approach in #171. That draft remains open and untouched pending maintainer reconciliation.
What Problem This Solves
Fixes an issue where local sign-in could lose OAuth state when an untrusted forwarded-scheme header forced Secure cookies onto loopback HTTP. It also resolves CodeQL alerts 1 and 2 for authentication cookies that did not have a statically guaranteed Secure policy.
Why This Change Was Made
HTTPS is now derived from direct TLS or a verified loopback proxy with one unambiguous forwarded protocol value. Both authentication cookies share that decision, all configured HTTPS public surfaces force Secure cookies, and intentional loopback HTTP development remains supported without adding configuration.
The accepted proxy contract is the repository's existing bundled Nginx example: it overwrites
Host,X-Forwarded-For,X-Real-IP, andX-Forwarded-Protobefore forwarding to the loopback API. Other proxy topologies must use configured public URLs or establish their own verified edge identity.User Impact
Local OAuth sign-in continues to work over loopback HTTP, trusted local reverse proxies produce HTTPS callback URLs and Secure cookies, and arbitrary forwarded headers can no longer influence the scheme decision.
Evidence
TestSessionCookiesDefaultSecureOutsideLocalDevfailed for spoofed forwarding and the OpenClaw ID HTTPS sibling: https://crabbox.openclaw.ai/portal/runs/run_7dda5d05b008mainat5c664e0dbe32ca12694e1782baa76baa989e36e5reproduces that unrelatedTestWriteClientConfigFilePreservesWritableModefailure: https://crabbox.openclaw.ai/portal/runs/run_f5587c9ac47edeploy/nginx/clickclack.conf.example:67-70anddocs/deployment.md:171-184.