Policy: add tool posture conformance checks#85482
Conversation
|
Codex review: needs maintainer review before merge. Latest ClawSweeper review: 2026-05-23 21:23 UTC / May 23, 2026, 5:23 PM ET. Workflow note: Future ClawSweeper reviews update this same comment in place. How this review workflow works
PR Surface View PR surface stats
Summary Reproducibility: not applicable. as a bug reproduction; this is a feature PR for new Policy conformance behavior. The PR body provides real-output proof for the new checks, and this review inspected the source and patch rather than executing the read-only checkout. PR rating Rank-up moves:
What the crustacean ranks mean
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. Real behavior proof Risk before merge
Maintainer options:
Next step before merge Security Review detailsBest possible solution: Land only after maintainer approval of the Policy tool-posture contract, with any chosen drift guard or stack sequencing handled before merge. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction; this is a feature PR for new Policy conformance behavior. The PR body provides real-output proof for the new checks, and this review inspected the source and patch rather than executing the read-only checkout. Is this the best way to solve the issue? Unclear until maintainer review confirms the contract. The implementation is plausibly scoped to the bundled Policy plugin and config-only, but the local tool-group map and attestation semantics need explicit acceptance or a drift guard. Label justifications:
Security concerns:
What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 05c6e7a55391. |
|
ClawSweeper PR egg 🔥 Warming up: real-behavior proof passed; findings, security review, or rank-up moves are still in progress. Hatch commandComment Hatchability rules:
What is this egg doing here?
|
|
No dependency changes detected. Learn more about Socket for GitHub. 👍 No dependency changes detected in pull request |
845ee6c to
21990bb
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
47accbb to
1343d77
Compare
1343d77 to
7a33874
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
7a33874 to
6f956cd
Compare
6f956cd to
87bb373
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@galiniliev when you review this one, the contract question is intentionally narrow:
ClawSweeper has no discrete code finding on the current head, but it is asking for maintainer confirmation of that operator-facing policy contract and whether a separate drift guard for tool-group expansion is required before merge. |
galiniliev
left a comment
There was a problem hiding this comment.
Reviewed the current head 2a4ee05eaba1764ddaf4d58382422c0764396082.
No blocking findings. I’m comfortable with this as a config-only Policy conformance contract: the new tools.* policy syntax observes configured global/per-agent posture, records alsoAllow in toolPosture evidence for attestation drift, and stays inside the bundled Policy plugin without adding a new public SDK subpath or core dependency. The Policy-local tool group map is acceptable for this operator-facing check surface; if we later want it to be canonical across runtime and Policy, that can be a follow-up guard/refactor rather than a blocker here.
What I checked:
extensions/policy/src/doctor/register.tsfor check registration, policy shape validation, finding IDs, and conformance logic.extensions/policy/src/policy-state.tsandextensions/policy/src/tool-policy-conformance.tsfor evidence shape, inherited agent/global posture,alsoAllow, elevated, fs, exec, and deny group handling.- Adjacent runtime contracts in
src/agents/tool-policy-shared.ts,src/agents/tool-fs-policy.ts,src/agents/sandbox-tool-policy.ts,src/agents/exec-defaults.ts,src/agents/bash-tools.exec-runtime.ts, andsrc/auto-reply/reply/reply-elevated.ts. - Docs updates in
docs/cli/policy.mdanddocs/plugins/reference/policy.md.
Verification:
node scripts/run-vitest.mjs extensions/policy/src/doctor/register.test.ts extensions/policy/src/cli.test.ts -- --reporter=dotin a detached PR worktree: 149 passed.- Live PR checks at this head show the relevant CI/check lanes green, including docs, lint, prod types, test types, dependency/boundary checks, and real behavior proof.
I did not run a runtime tool-execution E2E because this PR deliberately does not enforce runtime tool calls; the covered behavior is config conformance and attestation evidence.
Summary
#85096 is merged; this PR is now rebased directly on
main. This PR adds config-only policy conformance checks for global and per-agent tool posture. The goal is policy conformance over existing OpenClaw config, not runtime tool enforcement and not a second policy engine.For anyone new to the Policy plugin, the CLI surface is provided by the bundled Policy plugin:
openclaw plugins enable policy openclaw policy check openclaw policy check --json openclaw policy check --severity-min error openclaw doctor --lintopenclaw policy checkruns only the policy checks and emits evidence, findings, and attestation hashes. The same findings also flow intoopenclaw doctor --lintwhen the Policy plugin is enabled.This PR adds the following
policy.jsoncsyntax:{ "tools": { "profiles": { "allow": ["messaging", "minimal"] }, "fs": { "requireWorkspaceOnly": true }, "exec": { "allowSecurity": ["deny", "allowlist"], "requireAsk": ["always"], "allowHosts": ["sandbox"] }, "elevated": { "allow": false }, "denyTools": ["group:runtime", "group:fs"] } }The checks observe
tools.profile,tools.allow,tools.alsoAllow,tools.deny,tools.fs.workspaceOnly,tools.exec.security,tools.exec.ask,tools.exec.host,tools.elevated.enabled, and per-agentagents.list[].tools.*overrides. Tool posture policy does not read runtime/operator approval state such asexec-approvals.json, and it does not enforce tool calls at runtime.The tool-group membership used by these checks is local to the Policy plugin. This does not add a public
openclaw/plugin-sdk/*subpath, package export, SDK docs row, or generated SDK baseline change.Verification
git fetch fork policy-tool-posture-conformancegit rebase fork/policy-tool-posture-conformancegit log --show-signature -1 --format=fuller(signed merge head 2a4ee05; local keyring lacks GitHub public key, prior author commit ae17007 has good signature)node scripts/run-vitest.mjs extensions/policy/src/doctor/register.test.ts extensions/policy/src/cli.test.ts -- --reporter=dot(149 passed)pnpm exec oxfmt --check --threads=1 extensions/policy/src/tool-policy-conformance.ts extensions/policy/src/policy-state.ts extensions/policy/src/doctor/register.ts extensions/policy/src/doctor/register.test.ts docs/cli/policy.md docs/plugins/reference/policy.md src/config/types.tools.tspnpm docs:check-mdx docs/cli/policy.md docs/plugins/reference/policy.mdgit diff --check/mnt/c/src/claws-hapi/.agents/skills/autoreview/scripts/autoreview --mode branch(clean: no accepted/actionable findings on 2a4ee05)Real behavior proof
Behavior addressed: Policy-only conformance for configured global/per-agent tool posture without runtime enforcement, including
alsoAllowposture in evidence and attestation.Real environment tested: WSL checkout at
/root/src/openclaw-policy-tools-conformanceon Ubuntu-24.04.Exact steps or command run after this patch: direct
policyCheckCommand({ cwd, json: true, severityMin: "error" })against temp OpenClaw configs under/tmp/policy-proof-85482-refresh, plus focused policy tests foralsoAllowattestation behavior.Evidence after fix: A nonconforming tool config produced profile, fs workspace-only, exec security/ask/host, elevated, and required-deny findings; the accepted posture produced
ok: truewith zero findings; a global/per-agentalsoAllowchange is now recorded intoolPostureevidence and changes the accepted attestation.Observed result after fix: Policy reports and clears expected findings for tool profile, filesystem workspace-only posture, exec security/ask/host posture, elevated mode, required deny tools, inherited global posture, alias normalization, group coverage, sandbox-sensitive omitted exec defaults, and
alsoAllowattestation drift.What was not tested: Broad CI and runtime tool execution; this PR is config conformance only and intentionally does not add runtime enforcement.
Redacted CLI evidence
Nonconforming tool posture:
{ "exitCode": 1, "ok": false, "checksRun": 37, "findings": [ { "checkId": "policy/tools-profile-unapproved", "message": "global tools config uses unapproved tool profile 'coding'.", "ocPath": "oc://openclaw.config/tools/profile" }, { "checkId": "policy/tools-fs-workspace-only-required", "message": "global tools config does not require workspace-only filesystem tools.", "ocPath": "oc://openclaw.config/tools/fs/workspaceOnly" }, { "checkId": "policy/tools-exec-security-unapproved", "message": "global tools config uses unapproved exec security 'full'.", "ocPath": "oc://openclaw.config/tools/exec/security" }, { "checkId": "policy/tools-exec-ask-unapproved", "message": "global tools config uses unapproved exec ask 'off'.", "ocPath": "oc://openclaw.config/tools/exec/ask" }, { "checkId": "policy/tools-exec-host-unapproved", "message": "global tools config uses unapproved exec host 'gateway'.", "ocPath": "oc://openclaw.config/tools/exec/host" }, { "checkId": "policy/tools-elevated-enabled", "message": "global tools config permits elevated tool mode.", "ocPath": "oc://openclaw.config/tools/elevated/enabled" }, { "checkId": "policy/tools-required-deny-missing", "message": "global tools config does not deny required tool 'exec'.", "ocPath": "oc://openclaw.config/tools/deny" } ] }Accepted tool posture:
{ "exitCode": 0, "ok": true, "checksRun": 37, "findings": [] }