Repository navigation
Conversation
…lt-in defaults
doctor --fix scaffolded empty {} entries for safeBins that already ship a
built-in profile (cut, uniq, head, tail, tr, wc, grep, sort, jq). Because
resolveSafeBinProfiles merges user fixtures over the built-ins by key, an
empty {} wiped the built-in maxPositional/allowedValueFlags/deniedFlags,
both blocking safe stdin-only usage and allowing unsafe file/recursive usage.
Now built-in bins are never scaffolded (plain doctor shows an info note),
custom bins scaffold { maxPositional: 0 } (stdin-only) instead of {}, the
safeBinProfiles holder is created lazily, and an empty {} override of a
built-in is warned in plain doctor and removed by doctor --fix across
global, agent, and inherited/default-safeBins scopes to restore the
shipped profile.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Thanks for the contribution. I reviewed the branch, and this PR is not a good landing base for OpenClaw. Close this stale PR: the latest review rated it F, it still lacks merge-ready proof, and there has been no human follow-up after the durable review. So I’m closing this PR rather than keeping an unmergeable branch open. A new narrow PR that carries only the useful part is welcome. Review detailsBest possible solution: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review. Do we have a high-confidence way to reproduce the issue? Yes, from source: an empty user fixture overwrites a shipped profile in Is this the best way to solve the issue? No, not as submitted. The central repair is appropriate, but it must be rebased onto the shared current roster abstraction and preserve the merged jq fail-closed policy rather than reviving legacy list-only behavior. Security review: Security review needs attention: The patch changes an execution-approval security boundary and currently fails to repair unsafe empty overrides in canonical keyed-agent configuration.
AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 807506381a03. |
|
@BKF-Gitty thanks for the PR. ClawSweeper is still waiting on real behavior proof before this can move forward. Useful proof can be a screenshot, short video, terminal output, copied live output, linked artifact, or redacted logs that show the changed behavior after the fix. Please redact private tokens, phone numbers, private endpoints, customer data, and anything else sensitive. Once proof is added to the PR body or a comment, ClawSweeper or a maintainer can re-check it. |
|
This pull request has been automatically marked as stale due to inactivity. |
|
ClawSweeper applied the proposed close for this PR.
|
What Problem This Solves
Fixes an issue where
openclaw doctor --fixsilently weakened exec safe-bin security for anyone who added a built-in stdin-only helper (cut,uniq,head,tail,tr,wc,grep,sort,jq) totools.exec.safeBins. Doctor scaffolded an empty{}profile for these bins, and becauseresolveSafeBinProfilesmerges user profiles over the built-ins by key (not a deep merge), the empty{}wiped the built-inmaxPositional,allowedValueFlags, anddeniedFlags. The result was the worst of both worlds: the safe stdin-only form was rejected (e.g.grep -e "pattern") while unsafe forms were allowed (e.g.grep pattern file.txt,grep -r /). The same empty-override hazard also lived in already-saved configs and was never repaired.Why This Change Was Made
doctor now distinguishes built-in bins from custom bins:
doctorshows an informational note ("uses built-in profile (no custom override needed)") instead of a warning, and they are dropped from the--fixscaffold suggestion.{ maxPositional: 0 }(a stdin-only default) instead of{}, matching the documented purpose of safeBins.safeBinProfilesholder is created lazily, so doctor no longer leaves an empty{}object behind when nothing is scaffolded.{}override of a built-in is flagged by plaindoctorand removed bydoctor --fixto restore the shipped profile. Detection is inheritance/fallback aware: it covers global scope, per-agent scope, agents that inherit the globalsafeBinslist, and configs relying on the default safeBins set with no explicitsafeBinskey.No config-shape, schema, or API change; no migration required (the runtime already reads the canonical shape — this only stops doctor from writing a harmful one and repairs existing harmful ones).
User Impact
safeBinskeeps its built-in protections: the safe-e/stdin form works and unsafe file/recursive forms stay blocked.doctor --fixself-heals existing broken configs that contain an empty{}override of a built-in.{}.Evidence
Tests (new + updated):
src/commands/doctor/shared/exec-safe-bins.test.ts: built-in info note + no scaffold; custom{ maxPositional: 0 }scaffold; empty-override warn +--fixremoval; explicit non-empty override preserved; global-safeBins-fallback (agent with no own safeBins) removal; default-safeBins (nosafeBinskey) detection; and a regression assertingresolveSafeBinProfilesreturns the intact built-ingrepprofile after--fix.src/commands/doctor/shared/preview-warnings.test.ts: plaindoctorwarns about an empty built-in override even with no explicitsafeBins.Local validation (macOS):
pnpm tsgo:coreclean;pnpm tsgo:core:testclean for changed files (one unrelated pre-existingpackages/sdk/src/package.e2e.test.tserror already onmain).oxfmt --checkandoxlintclean on all changed files.Review: the fix plan and the implementation were independently reviewed by Codex across three passes; all findings (inheritance/fallback detection gaps, message wording, and the plain-
doctorpreview gate for default-active safeBins) were addressed and confirmed resolved.Notes: branched off latest
main; independent of (and non-overlapping with) the other open PR on this fork.