Skip to content

fix(secrets): fail closed for configured references - #127669

Merged
steipete merged 8 commits into
mainfrom
steipete/laughing-spence-a1f1de
Aug 22, 2026
Merged

steipete merged 8 commits into
mainfrom
steipete/laughing-spence-a1f1de

Conversation

@steipete

@steipete steipete commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where an explicitly configured SecretRef that was unavailable could be discarded and replaced by unrelated ambient credentials. This affected Gateway password onboarding and probes, Buzz credentials, the default IRC password, the default Nextcloud Talk bot secret, and GitHub Copilot discovery and embeddings.

Why This Change Was Made

Explicit SecretRefs now remain authoritative across the shared Gateway, probe, provider, channel-account, and outbound-selection boundaries. Historical environment, plaintext, and credential-file precedence remains unchanged when no SecretRef owns the exact credential surface. The repair absorbs duplicated policy into the owning boundaries and is net-negative production code.

AI-assisted: yes.

User Impact

When a configured secret backend is unavailable, OpenClaw no longer authenticates, probes, discovers, embeds, or sends as an unintended account using an ambient fallback. The affected owner instead reports a redacted unavailable state and performs no outbound action. Existing configurations without SecretRefs retain their shipped precedence.

Evidence

  • Added pre-fix regression matrices for Gateway auth/onboarding/probes, account isolation, direct sends, Buzz discovery, IRC connections, Nextcloud Talk delivery, and GitHub Copilot discovery/embeddings.
  • Focused owner proof passed across the affected core and plugin surfaces, including post-rebase Gateway/model/Copilot suites, Gateway status and CLI regressions, and native xAI/Ollama stream coverage.
  • Isolated process proof: a Gateway configured for password auth with a missing SecretRef and a competing ambient OPENCLAW_GATEWAY_PASSWORD exited before listening, did not log the ambient credential, and reported the SecretRef failure.
  • Exact-head CI passed for 34b28a30ae5c55eb233c0654fbaf73753038290e: https://github.com/openclaw/openclaw/actions/runs/32541049227
  • OPENCLAW_TESTBOX=1 scripts/pr prepare-run 127669 passed with hosted_exact_or_recent_parent gates and verified the remote PR tree matches the prepared head.
  • Fresh P1 autoreview reported no actionable findings. Current-head ClawSweeper reports no findings and marks proof sufficient.
  • Production LOC: +422/-517 (net -95). Tests: +1346/-311.
  • Proof gap: no authenticated third-party channel/provider account was used; the deterministic credential-owner invariant is covered by boundary matrices, exact-head CI, and the isolated Gateway process proof.

@clawsweeper

clawsweeper Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added channel: nextcloud-talk Channel integration: nextcloud-talk gateway Gateway runtime commands Command implementations channel: irc extensions: github-copilot channel: buzz size: XL maintainer Maintainer-authored PR labels Aug 21, 2026
@steipete
steipete marked this pull request as ready for review August 21, 2026 22:50
@steipete
steipete requested a review from a team as a code owner August 21, 2026 22:50
@clawsweeper clawsweeper Bot added merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 21, 2026
@clawsweeper

clawsweeper Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 21, 2026, 8:45 PM ET / August 22, 2026, 00:45 UTC.

ClawSweeper review

What this changes

This PR makes configured SecretRefs authoritative across Gateway, provider, and selected channel credential paths so an unavailable reference cannot silently use an unrelated ambient credential.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

No blocking correctness finding at the current head. The PR repairs the prior reviewer’s slow-progress stream coverage and consistently makes unavailable configured SecretRefs stop rather than borrow ambient credentials; it remains open because it is maintainer-labeled and exact-head CI/Testbox preparation is still pending.

Priority: P1
Reviewed head: 34b28a30ae5c55eb233c0654fbaf73753038290e

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The implementation and focused behavioral evidence are strong; exact-head CI and Testbox preparation remain the material merge gate.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR body reports an after-fix isolated Gateway process run showing a missing configured reference prevents listening and does not use or log the competing ambient credential.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body reports an after-fix isolated Gateway process run showing a missing configured reference prevents listening and does not use or log the competing ambient credential.
Evidence reviewed 6 items Current-head fail-closed owner boundary: The shared resolver now returns an unresolved result for a configured SecretRef instead of invoking its fallback; Gateway callers preserve that diagnostic and omit credentials.
Regression matrix covers active and sibling credentials: Gateway tests cover local and remote token/password references, no ambient substitution, inactive references, explicit credentials, and a healthy configured sibling credential.
Prior stream finding addressed: The native Ollama test now streams 24 chunks at 250 ms intervals under a 5 s timeout and asserts completion, exercising a response that advances for roughly six seconds.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw --help

Result: PASS (completed)

pnpm openclaw --help
runner@runnervm76f27:/tmp/clawsweeper-live-proof-127669-Zw04sY/target$ pnpm openclaw --help
$ node scripts/run-node.mjs --help
pnpm openclaw --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 106.23 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

[tsdown-build] invocation 2/2 finished in 14.5s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 4477ms (slowest: built plugin control-plane loads 3702ms)

OpenClaw 2026.8.1 (34b28a3) — All your chats, one OpenClaw.

Usage: openclaw [options] [command]

Options:
  --container ‹name›   Run the CLI inside a running Podman/Docker container named ‹name› (default: env OPENCLAW_CONTAINER)
  --dev                Dev profile: isolate state under ~/.openclaw-dev, default gateway port 19001, and shift derived ports (browser/canvas)
  -h, --help           Display help for command
  --log-level ‹level›  Global log level override for file + console
… output truncated …

Assertions:

  • PASS expect_output: Usage:

How this fits together

Gateway, provider, and channel credential resolvers turn configuration and environment inputs into credentials for startup, probes, discovery, and outbound actions. The changed boundary records an unavailable configured reference and prevents the affected action before authentication or network I/O.

flowchart LR
A[Config and environment] --> B[Credential resolver]
B --> C{Configured reference available?}
C -->|Yes| D[Use configured credential]
C -->|No| E[Record unavailable owner]
E --> F[Stop probe startup or send]
D --> G[Gateway provider or channel action]
Loading

Before merge

  • Resolve merge risk (P1) - Existing installations with an unresolved configured SecretRef will now stop the affected auth, probe, startup, discovery, or send path instead of using ambient credentials; that is the intended security change, but it needs exact-head CI and Testbox upgrade validation before merge.
  • Complete next step (P2) - This maintainer-labeled security-boundary PR has no mechanical review finding, but exact-head CI and Testbox upgrade proof must gate its merge.
Agent review details

Security

None.

PR surface

Source -95, Tests +1035. Total +940 across 50 files.

View PR surface stats
Area Files Added Removed Net
Source 21 422 517 -95
Tests 29 1346 311 +1035
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 50 1768 828 +940

Review metrics

Metric Value Why it matters
Production versus test delta production +413/-514 (net -101); tests +1293/-268 The broad security repair is net-negative in production while adding boundary coverage across Gateway and plugin credential owners.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor-gateway-auth-token.test.ts, migration/backfill/repair: src/commands/doctor-gateway-auth-token.ts, migration/backfill/repair: src/flows/doctor-core-checks.ts, migration/backfill/repair: src/flows/doctor-health-contributions.ts, serialized state: src/commands/gateway-status.test.ts, unknown-data-model-change: src/commands/doctor-gateway-auth-token.test.ts, and 1 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Validate the intended upgrade behavior (recommended)
    Complete exact-head CI and Testbox preparation while confirming unavailable configured references fail visibly and configurations without references retain their established precedence.
  2. Pause for a narrower rollout
    Pause if maintainers decide existing ambient fallback must remain available for a particular shipped credential surface.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Require exact-head CI and Testbox evidence for configured-unavailable and no-reference precedence paths.

Technical review

Best possible solution:

Land the single fail-closed ownership rule after exact-head CI and Testbox confirm both configured-reference failure and no-reference legacy precedence across the affected Gateway and plugin paths.

Do we have a high-confidence way to reproduce the issue?

Yes: current-main source shows the fallback after an unresolved configured reference, while the PR’s focused Gateway and plugin tests encode the competing ambient-credential scenario.

Is this the best way to solve the issue?

Yes: centralizing the fail-closed result at the configured-secret resolver and enforcing it at owner boundaries is preferable to scattered downstream fallback guards.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 0a704810e411.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body reports an after-fix isolated Gateway process run showing a missing configured reference prevents listening and does not use or log the competing ambient credential.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body reports an after-fix isolated Gateway process run showing a missing configured reference prevents listening and does not use or log the competing ambient credential.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: The patch changes existing Gateway and channel authentication behavior and prevents unintended credential use.
  • merge-risk: 🚨 compatibility: Users with unresolved configured references will observe fail-closed behavior where ambient fallback previously occurred.
  • merge-risk: 🚨 auth-provider: Gateway and GitHub Copilot credential source selection changes across probes and runtime discovery.
  • merge-risk: 🚨 security-boundary: The patch controls whether unavailable configured credentials can be replaced by unrelated ambient credentials before side effects.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body reports an after-fix isolated Gateway process run showing a missing configured reference prevents listening and does not use or log the competing ambient credential.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body reports an after-fix isolated Gateway process run showing a missing configured reference prevents listening and does not use or log the competing ambient credential.

Evidence

What I checked:

Likely related people:

  • steipete: Peter Steinberger authored the current PR head and prior Gateway configured-auth work in the central resolver history. (role: recent area contributor; confidence: high; commits: 34b28a30ae5c, fd6e042d8794; files: src/gateway/auth-surface-resolution.ts, src/gateway/resolve-configured-secret-input-string.ts)
  • Vincent Koc: Vincent Koc’s history includes the shared Gateway SecretRef resolution refactor and related diagnostics work. (role: adjacent credential-resolution contributor; confidence: medium; commits: 07821e4bb829, 38039f5ea825; files: src/gateway/resolve-configured-secret-input-string.ts, src/gateway/auth-surface-resolution.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Complete exact-head CI and mandatory Testbox preparation against the current head.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-08-21T22:56:54.713Z sha 5c66c55 :: found issues before merge. :: [P1] Honor configured Copilot refs before stored profiles
  • reviewed 2026-08-21T23:05:14.415Z sha 5ace6d9 :: needs changes before merge. :: [P1] Resolve configured Copilot refs before stored profiles | [P1] Preserve ambient-token precedence without a SecretRef
  • reviewed 2026-08-22T00:09:44.384Z sha 17c2f8d :: found issues before merge. :: [P2] Preserve slow progressing stream coverage

@steipete
steipete force-pushed the steipete/laughing-spence-a1f1de branch from 17c2f8d to 77646b4 Compare August 22, 2026 00:34
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 22, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for 34b28a30ae5c55eb233c0654fbaf73753038290e:

  • Exact-head CI is green: https://github.com/openclaw/openclaw/actions/runs/32541049227
  • OPENCLAW_TESTBOX=1 scripts/pr prepare-run 127669 passed with hosted_exact_or_recent_parent gates and verified the prepared tree matches the remote PR head.
  • Current-head ClawSweeper has no findings, marks proof sufficient, and its remaining exact-head CI/Testbox rank-up move is complete.
  • Focused Gateway, model-probe, channel, Copilot, onboarding, and outbound matrices passed; CI-discovered stale expectations and load-sensitive stream tests were repaired and revalidated.
  • Isolated process proof confirmed a missing configured Gateway password SecretRef rejects the competing ambient password before listening and does not expose it.
  • Production LOC: +422/-517 (net -95). Tests: +1346/-311.

Proof gap: no authenticated third-party channel/provider account was used; the deterministic owner-selection invariant is covered by boundary tests, exact-head CI, and the isolated Gateway process proof.

@steipete
steipete merged commit 9929483 into main Aug 22, 2026
243 checks passed
@steipete
steipete deleted the steipete/laughing-spence-a1f1de branch August 22, 2026 01:00
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 22, 2026
* fix(secrets): fail closed for configured references

Keep explicit SecretRefs authoritative across Gateway auth, onboarding, probes, channel credentials, outbound sends, and GitHub Copilot discovery/embeddings. Ambient credentials remain available only when no reference owns the surface.

* test(secrets): align gateway fallback expectations

* test(providers): remove load-sensitive stream timing

* test(xai): normalize stream capture failures

* fix(copilot): preserve direct auth precedence

* test(ollama): keep progressing streams alive

* test(models): mark resolved config fixtures

* fix(models): drop stale probe import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: buzz channel: irc channel: nextcloud-talk Channel integration: nextcloud-talk cli CLI command changes commands Command implementations extensions: github-copilot extensions: ollama extensions: xai gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant