Repository navigation
fix(config): warn when an empty tool allow list is the whole policy - #190269
jerome-queck wants to merge 18 commits into
Conversation
…y-allow-proof # Conflicts: # src/config/validation-core.ts # src/config/validation-plugin-rules.ts
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: ready, awaiting a maintainer decision. What this changesAdds informational Doctor findings and documentation explaining when an explicit empty tool allow list adds no restriction. Example: An operator configures tools.allow: [] and runs openclaw doctor.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Partial Merge readiness⏳ Ready, awaiting maintainer decision Keep open: this PR provides a useful, bounded diagnostic with no definite introduced defect; an owner still needs to choose between its Doctor advice and the companion validation warning. Priority: P2 Decision needed
Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherDoctor reads configured global, agent, provider, sender, sandbox, and channel tool policies and projects advisory findings through the existing security diagnostic collector without changing tool enforcement. flowchart TD
A[Configured tool policies] --> B[Empty allow diagnostic]
B --> C[Security finding collector]
C --> D[Doctor terminal advice]
C --> E[Structured health findings]
A --> F[Existing runtime policy matcher]
Technical reviewBest possible solution: Choose one diagnostic surface with the area owner, preserve existing enforcement semantics and contributor credit, and retain the scope-specific documentation. Do we have a high-confidence way to reproduce the issue? Current-main source confirms empty configured allow lists remain permissive after deny checks and Doctor lacks this explanation; contributor CLI output demonstrates the diagnostic gap, while this read-only review executed no target code. Is this the best way to solve the issue? The patch uses the existing structured Doctor finding owner, preserves runtime semantics, and correctly distinguishes sub-agent alsoAllow merging and sandbox inheritance; the remaining choice is where this advice belongs. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c230ae5c3c46. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +186, Tests +131, Docs +24, Other +2. Total +343 across 5 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (7 earlier review cycles)
Reviewed November 5, 2026, 8:18 AM ET / 13:18 UTC (Revision 8). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Stay silent when a non-empty deny or alsoAllow accompanies allow: [], so the warning targets only configs that read as deny-all but restrict nothing. Refs openclaw#147342. Builds on Navras98's openclaw#147490. Co-authored-by: Andrea Sforna <[email protected]>
The test-line ratchet grants 107 lines for the doctor coverage. The previous record credited 111, which is more than this branch adds. Co-authored-by: Jerome <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Removing an agent sandbox allow: [] inherits tools.sandbox.tools, including another empty list, before the built-in default. The doctor note and tool policy docs now say that, with a regression for the agent path. Co-authored-by: Jerome <[email protected]>
The sandbox inheritance regression brings this branch's test-line delta to 131. The previous grant of 107 is short of that delta. Co-authored-by: Jerome <[email protected]>
Co-authored-by: Jerome <[email protected]>
Refresh for test-line ceiling after main moved.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Companion to #147490 by @Navras98, who found and first fixed this gap; credit for spotting it and for the original patch (
99e3d45, authorship kept in history) is his. This revision replaces hisopenclaw config validatewarning with an advisoryopenclaw doctornote. The validation code and its test are reverted tomain. If he'd rather carry the doctor approach in #147490, I'll close this one.Refs #147342
What Problem This Solves
A tool policy whose only content is
allow: []reads as "no tools", but at that layer an empty allow list adds no restriction (globaldenyand the built-in sub-agent hard denies still apply). Nothing tells the user, so a policy that looks locked down blocks nothing.What Changed
src/commands/doctor-empty-tool-allow.ts, called fromcollectSecurityWarnings, adds an info note (doctor.empty_tool_allow) to Doctor's Security section.allowis[]and there is no non-emptydenyand noprofile.alsoAllowsuppresses the note only undertools.subagents.tools, where an empty allow merges withalsoAllow. In every other scope,alsoAllowbesideallow: []is still noted, and the note saysalsoAllowdoes not narrow that empty list.tools(includingbyProvider,toolsBySender,subagents.tools, andsandbox.tools), the same fields on each agent, and channel group, room, and directtools/toolsBySenderpolicies.deny: ["*"]for "no tools". Outside sandbox policy, removing the empty list leaves allow-all. For sandbox policy, removingallow: []restores the inherited global sandbox allow list, or the built-in default when none is configured. A globaltools.sandbox.tools.allow: []is itself a configured list, so removing only an agent copy still inherits that empty list and stays allow-all.allow: []stays a valid allow-all setting.docs/tools/subagents/tool-policy.mdmatches that note, including the sub-agentalsoAllowmerge and the sandbox inheritance sentence.Evidence
Linux, Node 24.22.1. Built this branch with
pnpm build, then rannode openclaw.mjs doctor --non-interactive.openclaw --versionprintedOpenClaw 2026.10.10 (3327e50): the version string still stamps 2026.10.10 because this branch predates the 2026.11.1 release bump, but the build is this head; the builtdist/doctor-security-*.mjscontains this commit's sandbox sentence (restores the inherited global sandbox allow list). Stable comparison is npm[email protected](latest stable), which printsOpenClaw 2026.11.1 (4ffdd20).Each scenario used an isolated
HOME,OPENCLAW_STATE_DIR, andOPENCLAW_CONFIG_PATH. Identifiers are synthetic (id:guest,id:owner, groupexample-group). No gateway token or provider key was set.Built CLI: provider, sender, sandbox, channel, and alsoAllow
Doctor's Security section included these notes for a config with top-level
allow: []plusalsoAllow: ["read"],tools.byProvider.openai.allow: [],tools.toolsBySender["id:guest"].allow: [], global andagents.entries.chatsandboxallow: [], and a WhatsApp groupexample-groupwithtools.allow: []andtoolsBySender["id:owner"].allow: []:tools.allow is []andalsoAllow does not narrow an empty allow in this scope.tools.byProvider.openai.allow is []tools.toolsBySender["id:guest"].allow is []tools.sandbox.tools.allow is []withRemoving tools.sandbox.tools.allow restores the built-in sandbox default allowlist.agents.entries.chat.tools.sandbox.tools.allow is []withRemoving agents.entries.chat.tools.sandbox.tools.allow restores the inherited global sandbox allow list, or the built-in default when none is configured.channels.whatsapp.groups.example-group.tools.allow is []channels.whatsapp.groups.example-group.toolsBySender["id:owner"].allow is []tools.subagents.tools.allowwas not noted. That is thealsoAllowchange: undertools.subagents.tools,{ allow: [], alsoAllow: ["read"] }narrows, so Doctor stays quiet. The earlier trace that said a top-levelalsoAllowsibling produced no note is stale and does not match this build.Legacy agent
A config whose only agent policy was
agents.list: [{ "id": "ops", "tools": { "allow": [] } }]printedMoved agents.list → keyed agents.entries.and thenagents.entries.ops.tools.allow is []. Doctor rewrites a list-only roster before the Security section, so the CLI note uses the migratedagents.entries.opspath. The pre-migration pathagents.list.0.tools.allowis covered bynoteSecurityWarningsinsrc/commands/doctor-security.test.ts.Upgrade from stable v2026.11.1 (existing state retained)
One proof home was used for both runs: the same
HOME,OPENCLAW_STATE_DIR, andOPENCLAW_CONFIG_PATHacross stable → built, never wiped or recreated. Before any doctor ran, the state directory was pre-seeded with the synthetic config above plus non-config state (devices/synthetic-device.json,agents/chat/NOTES.md). Those files survived both runs.[email protected]doctor --non-interactive(exit 0) left the config byte-for-byte equal to the seeded one and createdstate/openclaw.sqlite. It printed no empty-allow Security note.doctor --non-interactive, run against that retained state, stopped withFailed migrating shared state database schema: Error: Client credentials require backed-up migration custody; stop the app and run openclaw doctor --fix.(exit 1, before the Security section). This happens because the 2026.11.1 database is newer than this branch's 2026.10.10-based schema; this PR does not cause it.doctor --fix --non-interactiveon the same state (exit 0) ran the startup migrations, backing up first (openclaw.sqlite.pre-startup-migration-*.bak,openclaw.json.bak), and printed the empty-allow notes.doctor --non-interactivewith this build (exit 0) printed the same notes: all seven listed above, including the inherited sandbox remediation (restores the inherited global sandbox allow list, or the built-in default when none is configured) and the top-level sentencealsoAllow does not narrow an empty allow in this scope.tools.subagents.tools(allow: []+alsoAllow) stayed quiet.Config after stable vs after this build (
jq -S):toolsandagentswere equal, and so werechannels.whatsapp.groups(both group policies). The only differences came from--fixhousekeeping: it addedchannels.whatsapp.enabled: true("WhatsApp configured, enabled automatically"),meta/wizardstamps, and default-disabledskills.entries. No tool policy changed.Regression
src/commands/doctor-security.test.ts(says removing an agent sandbox allow: [] inherits the global list) fails on the old "restores the sandbox default allowlist" sentence foragents.entries.chat.tools.sandbox.toolsand passes on this wording. Doctor test types for that project passed locally.