fix(cli): resolve scoped web command SecretRefs#83020
Conversation
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: yes. source-level and report evidence are strong: the linked bug gives a concrete Real behavior proof Next step before merge Security Review detailsBest possible solution: Land a maintainer-reviewed version that keeps command-time SecretRef resolution limited to the selected web search/fetch provider and documented fallback credential surfaces, with focused regression coverage for gateway and local resolution. Do we have a high-confidence way to reproduce the issue? Yes, source-level and report evidence are strong: the linked bug gives a concrete Is this the best way to solve the issue? Yes, the proposed direction is the right owner-boundary fix: scope command-time web SecretRef resolution to the selected provider and its fallback credential paths instead of activating unrelated plugin secrets. The remaining decision is maintainer review and landing, not an automated rewrite. What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 7b96109920c5. |
Materialize agent-runtime plugin credentials through the shared command secret resolution path before local web search/fetch runs, matching gateway runtime behavior for plugins.entries.*.config.webSearch.apiKey refs. Fixes #82621 Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: wuyangfan <1102042793@qq.com> # Conflicts: # src/cli/capability-cli.test.ts # src/cli/capability-cli.ts
Co-authored-by: wuyangfan <1102042793@qq.com>
880060f to
95d14dd
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 95d14dd11c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ...(allowedPaths ? { allowedPaths } : {}), | ||
| ...(forcedActivePaths ? { forcedActivePaths } : {}), | ||
| ...(optionalActivePaths ? { optionalActivePaths } : {}), |
There was a problem hiding this comment.
Validate forcedActivePaths before forwarding secrets.resolve
secrets.resolve now forwards client-supplied forcedActivePaths/optionalActivePaths directly, but there is no check that those paths are command-scoped web paths (or even constrained to allowedPaths). In src/secrets/runtime-command-secrets.ts, resolveForcedActiveCommandSecretTargets resolves any matching SecretRef in targetIds as active, so an authenticated caller can force resolution of otherwise inactive credentials by choosing target IDs plus forced paths. This broadens secret exposure beyond the prior inactive-surface guard and should be rejected unless the forced paths are explicitly validated and tightly scoped.
Useful? React with 👍 / 👎.
|
Verification before merge:
Known proof gap: no separate full local pnpm check; GitHub CI run 25987285105 covered the broad check shards. |
Summary
Verification
Real behavior proof
Behavior addressed: openclaw infer web search/fetch now resolves only the selected command credential SecretRefs, including plugin-owned and fallback Firecrawl paths.
Real environment tested: local source checkout with bundled plugin test env.
Exact steps or command run after this patch: TAVILY_API_KEY=resolved-live-proof pnpm exec tsx scripts/repro/cli-web-search-secret-refs-live-proof.mjs
Evidence after fix:
console output from live repro:
unresolved apiKey is SecretRef object = true
resolveCommandConfigWithSecrets apiKey is string = true
resolved apiKey remains redacted = true
diagnostics count = 1
Observed result after fix: selected/fallback web provider SecretRefs resolve while non-selected, disabled, or later auto-detect provider refs stay inactive or optional.
What was not tested: full pnpm check locally; PR CI runs the broad check shards.
Fixes #82621.
Recreates #82699 because maintainer edits are disabled on the contributor fork branch.