Skip to content

fix(config): warn when an empty tool allow list is the whole policy - #190269

Open
jerome-queck wants to merge 18 commits into
openclaw:mainfrom
jerome-queck:companion/147490-empty-allow-proof
Open

jerome-queck wants to merge 18 commits into
openclaw:mainfrom
jerome-queck:companion/147490-empty-allow-proof

Conversation

@jerome-queck

@jerome-queck jerome-queck commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

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 his openclaw config validate warning with an advisory openclaw doctor note. The validation code and its test are reverted to main. 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 (global deny and the built-in sub-agent hard denies still apply). Nothing tells the user, so a policy that looks locked down blocks nothing.

What Changed

  • New src/commands/doctor-empty-tool-allow.ts, called from collectSecurityWarnings, adds an info note (doctor.empty_tool_allow) to Doctor's Security section.
  • It fires when allow is [] and there is no non-empty deny and no profile. alsoAllow suppresses the note only under tools.subagents.tools, where an empty allow merges with alsoAllow. In every other scope, alsoAllow beside allow: [] is still noted, and the note says alsoAllow does not narrow that empty list.
  • It checks tools (including byProvider, toolsBySender, subagents.tools, and sandbox.tools), the same fields on each agent, and channel group, room, and direct tools / toolsBySender policies.
  • Remediation suggests deny: ["*"] for "no tools". Outside sandbox policy, removing the empty list leaves allow-all. For sandbox policy, removing allow: [] restores the inherited global sandbox allow list, or the built-in default when none is configured. A global tools.sandbox.tools.allow: [] is itself a configured list, so removing only an agent copy still inherits that empty list and stays allow-all.
  • Config validation, the JSON output, exit codes, and runtime matching are unchanged. allow: [] stays a valid allow-all setting.
  • Docs: docs/tools/subagents/tool-policy.md matches that note, including the sub-agent alsoAllow merge and the sandbox inheritance sentence.

Evidence

Linux, Node 24.22.1. Built this branch with pnpm build, then ran node openclaw.mjs doctor --non-interactive. openclaw --version printed OpenClaw 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 built dist/doctor-security-*.mjs contains this commit's sandbox sentence (restores the inherited global sandbox allow list). Stable comparison is npm [email protected] (latest stable), which prints OpenClaw 2026.11.1 (4ffdd20).

Each scenario used an isolated HOME, OPENCLAW_STATE_DIR, and OPENCLAW_CONFIG_PATH. Identifiers are synthetic (id:guest, id:owner, group example-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: [] plus alsoAllow: ["read"], tools.byProvider.openai.allow: [], tools.toolsBySender["id:guest"].allow: [], global and agents.entries.chat sandbox allow: [], and a WhatsApp group example-group with tools.allow: [] and toolsBySender["id:owner"].allow: []:

  • tools.allow is [] and alsoAllow 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 [] with Removing tools.sandbox.tools.allow restores the built-in sandbox default allowlist.
  • agents.entries.chat.tools.sandbox.tools.allow is [] with Removing 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.allow was not noted. That is the alsoAllow change: under tools.subagents.tools, { allow: [], alsoAllow: ["read"] } narrows, so Doctor stays quiet. The earlier trace that said a top-level alsoAllow sibling 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": [] } }] printed Moved agents.list → keyed agents.entries. and then agents.entries.ops.tools.allow is []. Doctor rewrites a list-only roster before the Security section, so the CLI note uses the migrated agents.entries.ops path. The pre-migration path agents.list.0.tools.allow is covered by noteSecurityWarnings in src/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, and OPENCLAW_CONFIG_PATH across 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.

  1. Stable [email protected] doctor --non-interactive (exit 0) left the config byte-for-byte equal to the seeded one and created state/openclaw.sqlite. It printed no empty-allow Security note.
  2. This build's doctor --non-interactive, run against that retained state, stopped with Failed 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.
  3. Following that instruction, this build's doctor --fix --non-interactive on 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.
  4. A second plain doctor --non-interactive with 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 sentence alsoAllow 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): tools and agents were equal, and so were channels.whatsapp.groups (both group policies). The only differences came from --fix housekeeping: it added channels.whatsapp.enabled: true ("WhatsApp configured, enabled automatically"), meta/wizard stamps, and default-disabled skills.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 for agents.entries.chat.tools.sandbox.tools and passes on this wording. Doctor test types for that project passed locally.

@clawsweeper

clawsweeper Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: M labels Nov 1, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. 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 clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 1, 2026
@clawsweeper

clawsweeper Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: ready, awaiting a maintainer decision.

What this changes

Adds 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.

  • Before: Doctor provides no targeted explanation that the empty list adds no restriction.
  • After: Doctor explains the policy semantics and recommends deny: ["*"] when the operator intends to disable all tools.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused, supported by shipped-CLI evidence and green exact-head checks, but remains a partial alternative awaiting an owner decision.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The updated body records the reviewed Linux build running the shipped Doctor CLI across affected scopes, the sub-agent alsoAllow exception, legacy-agent migration, and corrected sandbox guidance; retained-state comparison from stable v2026.11.1 includes backed-up recovery and a successful repeat run, resolving the previous review's upgrade-proof gap.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Partial
User problem: Operators can mistake allow: [] for disabling tools even though that policy layer permits every tool not otherwise denied.
Reason: The diagnostic has concrete value, but it deliberately leaves the canonical issue's validation expectation unchanged and competes with an explicitly retained alternative surface.

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
Reviewed head: 3327e508c1ec53f510092e2988bd8710b8fb0ddc
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should empty tool allow-list advice appear as an informational Doctor finding here or as a config-validation warning in fix(config): warn on empty allow tool policies in validate #147490?
  • Recommendation: Adopt the bounded Doctor advisory: Use this informational diagnostic while keeping config validation and enforcement unchanged, then reconcile the companion PR with joint credit.
  • Why: Both contributors explicitly leave the surface choice to maintainers, and no recorded owner decision resolves whether this valid configuration warrants regular Doctor advice or validation warnings.

Before merge

None.

Findings

None.

Agent review details

How this fits together

Doctor 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]
Loading

Technical review

Best 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

  • Sub-agent tool-policy documentation keeps the original intent (309ae03: The documentation split in docs(tools): split the Sub-agents page into an index plus seven child pages #142999 preserved existing content; this PR adds the missing empty-list qualification without changing enforcement.)
  • Doctor security finding model keeps the original intent (63401b7: Keep each security condition as one canonical structured finding with producer-owned severity and remediation.)
  • Regular Doctor output changes intended behavior with a stated reason (eb7c151: Keep routine Doctor output focused on problems and actionable repairs; the PR explains why an explicit empty allow list merits advisory attention despite remaining valid.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Pinned PR scope: The introduced diff adds the diagnostic collector, its existing Doctor integration, regression coverage, documentation, and the test-line allocation; it changes no runtime matcher or persisted format. (src/commands/doctor-empty-tool-allow.ts:169, 3327e508c1ec)
  • Current-main policy semantics: The matcher checks denies first and permits tools when the configured allow list is empty; current main's Doctor security collector has no equivalent empty-tool-allow diagnostic. (src/agents/tool-policy-match.ts:66, c230ae5c3c46)
  • Scope-specific semantics preserved: The sub-agent resolver merges allow with alsoAllow, while the sandbox resolver preserves explicit empty lists and selects agent configuration before global configuration and defaults; the new diagnostic and corrected sandbox remediation respect these differences. (src/agents/sandbox/tool-policy.ts:19, 3327e508c1ec)
  • Updated shipped-CLI and retained-state proof: The current PR body records Linux built-CLI output at the reviewed head for provider, sender, channel, sandbox, alsoAllow, and legacy-agent scenarios. Its stable v2026.11.1 comparison retains the same state, records backed-up Doctor recovery, and confirms unchanged tool policies and surviving synthetic state files. (3327e508c1ec)
  • Companion work and contributor credit: fix(config): warn on empty allow tool policies in validate #147490 remains open and cleanly mergeable as the validation alternative for [Bug]: empty allow: [] means allow-all but config validate stays silent — warn on permissive empty allow #147342. Navras98 and jerome-queck explicitly preserve joint credit and leave the diagnostic-surface choice to a maintainer; no maintainer direction was found in the inspected discussion or reviews.
  • Exact-head checks: All paginated check runs are completed with success, skipped, or neutral conclusions; openclaw/ci-gate and the dependency-review and security-sensitive-review statuses succeed for the reviewed head. (3327e508c1ec)

Likely related people:

  • Peter Steinberger: Raw commit 63401b7 adds src/commands/doctor-security.ts:202 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 63401b730b55; files: src/commands/doctor-security.ts)
  • Josh Avant: Raw commit 83aad86 adds src/commands/doctor-security.ts:177 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 83aad863fd77; files: src/commands/doctor-security.ts)
  • Dallin Romney: Raw commit 7133cee adds src/commands/doctor-security.ts:66 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 7133cee79246; files: src/commands/doctor-security.ts)

PR surface

Source +186, Tests +131, Docs +24, Other +2. Total +343 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 186 0 +186
Tests 1 131 0 +131
Docs 1 25 1 +24
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 5 344 1 +343

Preflight source

Source 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

Metric Value Why it matters
Production versus test growth Production +186/-0; tests +131/-0 Growth supplies one integrated diagnostic collector and distinct policy-scope, suppression, and sandbox-remediation regressions.

Root-cause cluster

Relationship: partial_overlap
Canonical: #147342
Summary: This PR implements the Doctor alternative for the canonical diagnostic problem, while the companion PR implements validation warnings.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • remove status: 📣 needs proof: Current PR status label is status: ⏳ waiting on maintainer.

Label justifications:

  • P2: This is a bounded diagnostic improvement for advanced tool configuration, with no enforcement change or demonstrated availability regression.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (7 earlier review cycles)
  • reviewed 2026-11-01T11:32:22.904Z sha 884b51cd4c78535b5b88e998b386bbda122d2f29 :: needs maintainer review before merge. :: none
  • reviewed 2026-11-01T11:48:56.882Z sha 74c89a81dfd1f27ebe654cea151d9c84e06efac5 :: blocked before merge. :: none
  • reviewed 2026-11-01T12:31:41.165Z sha 9596cf256e66bf817d11ffe4dfda74e66a7de00d :: blocked before merge. :: none
  • reviewed 2026-11-02T06:28:22.048Z sha 05f8150b8c8bea15ecf0ecf85f990c073d1042fc :: needs changes before merge. :: [P2] Describe the local policy layer instead of claiming all tools are allowed | [P2] Document the sub-agent alsoAllow exception
  • reviewed 2026-11-02T06:54:32.772Z sha 08970b9eb0f6eb51c05708a44def8563626cc221 :: needs maintainer review before merge. :: none
  • reviewed 2026-11-05T02:14:30.218Z sha 99c3ea7 :: needs real behavior proof before merge. :: [P2] [P2] Describe inherited sandbox policy when removing an agent allow list
  • reviewed 2026-11-05T11:17:59.442Z sha 3327e50 :: needs real behavior proof before merge. :: none

Reviewed November 5, 2026, 8:18 AM ET / 13:18 UTC (Revision 8).

@jerome-queck

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed 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. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 1, 2026
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]>
@jerome-queck jerome-queck changed the title fix(config): warn on empty allow tool policies in validate (companion to #147490) fix(config): warn when an empty tool allow list is the whole policy Nov 1, 2026
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]>
@jerome-queck

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 5, 2026
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]>
@openclaw-barnacle openclaw-barnacle Bot removed the app: web-ui App: web-ui label Nov 5, 2026
Refresh for test-line ceiling after main moved.
@jerome-queck

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 5, 2026
@jerome-queck

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 5, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants