fix(gateway): allow trusted-proxy auth to bypass device-pairing gates#17705
Closed
dashed wants to merge 4 commits intoopenclaw:mainfrom
Closed
fix(gateway): allow trusted-proxy auth to bypass device-pairing gates#17705dashed wants to merge 4 commits intoopenclaw:mainfrom
dashed wants to merge 4 commits intoopenclaw:mainfrom
Conversation
aa0865f to
0246ca0
Compare
This was referenced Feb 16, 2026
4973d05 to
160a190
Compare
482b094 to
cfae5d8
Compare
The device-pairing layer only recognized "token" and "password" auth methods via sharedAuthOk, causing trusted-proxy connections to be incorrectly rejected at both the canSkipDevice and skipPairing gates. Add authOk && authMethod === "trusted-proxy" checks to both gates. resolve trusted-proxy-device-pairing root conflicts
Add 4 tests covering trusted-proxy auth interaction with device-pairing: - connection without device identity succeeds (canSkipDevice gate) - control-ui with device identity skips pairing (skipPairing gate) - connection from untrusted IP is rejected - connection with missing user header is rejected resolve resolve e2e test
…d scope-upgrade checks resolve
cfae5d8 to
7cd4a14
Compare
Contributor
Author
|
Closing: this fix has been absorbed upstream via the connect-policy.ts refactoring. The current main branch now has:
Both call sites in message-handler.ts now compute The related auth-fallback PR #17746 (shared-secret fallback for when proxy auth fails) remains open and has been rebased directly onto main. |
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.
Summary
"device identity required"(code 1008) because the device-pairing layer only recognizedtokenandpasswordauth methodsmessage-handler.tsnow also acceptauthOk && authMethod === "trusted-proxy"Root Cause
sharedAuthOk(used by bothcanSkipDeviceandskipPairinggates) only checks for"token"or"password"methods. Trusted-proxy auth correctly setsauthOk = trueandauthMethod = "trusted-proxy"via the primaryauthorizeGatewayConnect()call, but this was never consulted by the device-pairing layer.Changes
Two lines changed in
src/gateway/server/ws-connection/message-handler.ts:Gate 1 (
canSkipDevice, line 434):Gate 2 (
skipPairing, line 652):Comparison with PR #17378
This fix is more complete than #17378:
canSkipDevice)skipPairing)dangerouslyDisableDeviceAuth?Trusted-proxy inherently proves user identity via the reverse proxy — requiring an additional
dangerouslyDisableDeviceAuthflag is redundant and creates unnecessary operator friction.Test Plan
4 new e2e tests in
server.auth.e2e.test.ts:Closes #8529
Related: #7384, #4833
Supersedes #17378
Greptile Summary
Fixed trusted-proxy auth connections that were incorrectly rejected with "device identity required" errors. The device-pairing layer now recognizes
trusted-proxyauth method alongsidetokenandpasswordmethods in two critical gates (canSkipDeviceandskipPairing).message-handler.tsnow acceptauthOk && authMethod === "trusted-proxy"to allow trusted-proxy connections to bypass device pairingConfidence Score: 5/5
Last reviewed commit: 8f5d07b