Repository navigation
fix(configure): preserve unrelated gateway auth policy across reconfiguration - #131035
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 27, 2026, 1:31 PM ET / 17:31 UTC. ClawSweeper reviewWhat this changesThis PR preserves existing Gateway rate-limit, identity-scope, and Tailscale policies when interactive configure replaces the selected authentication mode’s credentials or proxy settings. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessNo introduced correctness defect was found: the PR repairs the current configure-path policy loss at its producing builder. Keep it open for the existing maintainer/security review and exact-head checks. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherThe configure wizard reads an existing Gateway configuration and rebuilds its authentication block before saving it. Gateway startup then consumes the retained rate-limit policy, while connection admission uses identity scopes for verified identities. flowchart LR
A[Existing Gateway config] --> B[Configure wizard]
B --> C[Auth configuration builder]
C --> D[Updated auth block]
D --> E[Gateway startup]
E --> F[Rate limits and identity scopes]
Decision needed
Why: This changes the persistence behavior of Gateway ingress protections and grants, so a Gateway/security owner should explicitly confirm the retained-policy boundary before merge. Before merge
Agent review detailsSecurityNone. PR surfaceSource -1, Tests +58, Docs +1. Total +58 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the producer-level split between independent auth policies and mode-owned credentials, then land once a Gateway owner accepts that boundary and exact-head checks complete. Do we have a high-confidence way to reproduce the issue? Yes—source inspection shows the pre-PR builder starts with an empty object and therefore drops rateLimit and identityScopes whenever configure calls it with existing auth. Is this the best way to solve the issue? Yes—the builder is the canonical producer of the rewritten auth block; copying existing policy and deleting mode-owned fields is narrower and safer than duplicating field preservation in callers. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fd7e9bbaceb1. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Replace fake auth factories and builder-call assertions with returned-config checks. Cover password policy preservation, generated-token parity, and SecretRef output without changing production behavior.
7285c50 to
4d7dd31
Compare
|
Merged via squash.
|
…guration (openclaw#131035) * fix(configure): preserve unrelated gateway auth policy across reconfiguration * test(configure): exercise real auth builder in gateway prompt tests Replace fake auth factories and builder-call assertions with returned-config checks. Cover password policy preservation, generated-token parity, and SecretRef output without changing production behavior.
What Problem This Solves
openclaw configure --section gatewaysilently deleted existing Gateway auth policies:buildGatewayAuthConfig()rebuilt auth from an empty object preserving onlyallowTailscale, so an operator's explicitly configuredrateLimitandidentityScopesvanished on any pass through the wizard — even selecting the same auth mode. Startup then fell back to default rate limits (src/gateway/server-runtime-state-prepare.ts:361) and verified identities lost their grants (ws-connection/connect-admission.ts:105). The empty-base defect ships in stable v2026.7.1-2 (there affectingrateLimit;identityScopespostdates that schema). Classic and non-interactive onboarding already spread the existing auth block — configure was the divergent owner.Why This Change Was Made
The builder now starts from a shallow copy of existing auth, deletes mode-owned fields, and applies the selected mode — adopting the siblings' independent-policy preservation while keeping configure's existing credential cleanup (which the siblings lack). The special-case
allowTailscalebranch is deleted. Net −1 production line. Complete field classification (fromzod-schema.gateway.ts:116):mode/token/password/trustedProxyare mode-owned (replaced; stale mode credentials removed),allowTailscale/identityScopes/rateLimitare independent policy (preserved verbatim, including explicit false). Fresh configs invent no policies.Deliberately unchanged + named follow-up: same-mode trusted-proxy reconfiguration still replaces the whole
trustedProxyblock from the prompted fields, omitting unpromptedallowLoopback/deviceAutoApprove— that nested trust-boundary ownership needs a security-owner decision (it interacts with the audit's separate finding that the wizard never surfaces theallowLoopbackopt-in at all).User Impact
Reconfiguring the gateway no longer silently strips brute-force rate limiting or identity scope grants. Mode switches still cleanly remove the abandoned mode's credentials.
Evidence
rateLimit+identityScopessurvive a same-mode pass (pre-fix: deleted); mode-switch matrix (token/password/trusted-proxy × all three, plus fresh config) covered in builder + prompt + gateway wizard tests.check-changedfull gates: pass. Codex autoreview: clean.