Policy: add model, network, and MCP conformance checks#80783
Conversation
|
Codex review: needs maintainer review before merge. Workflow note: Future ClawSweeper reviews update this same comment in place. How this review workflow works
Summary Reproducibility: not applicable. as a feature PR rather than a bug report. The source diff and inspected proof show the new model, MCP, and network policy checks are absent on current main and present on the PR head. 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 the category expansion only after maintainers accept the read-only Policy boundary and expected attestation refresh, keeping runtime enforcement in the separate follow-up PR. Do we have a high-confidence way to reproduce the issue? Not applicable as a feature PR rather than a bug report. The source diff and inspected proof show the new model, MCP, and network policy checks are absent on current main and present on the PR head. Is this the best way to solve the issue? Yes, subject to maintainer acceptance of the category boundary. The implementation keeps Policy read-only, uses existing OpenClaw config as evidence, and reuses the shared provider-id normalization contract instead of adding a separate provider registry. Label changes:
Label justifications:
What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against c49647ee238a. |
1fbe85d to
c12ae71
Compare
366f8ef to
7cf60f4
Compare
|
Fixed the review findings in the latest push (7cf60f4): invalid policy JSONC now emits a policy parse finding, MCP URL evidence is redacted to scheme/host, and agents.defaults.models allowlist keys are scanned as model refs. I also updated the proof section so the Real behavior proof gate is green. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
7cf60f4 to
c382517
Compare
|
Fixed the docs/check-id drift in c382517: policy.md now lists all 13 policy checks including invalid policy JSONC and unknown tool risk. I also brought over the policy health host-registry wiring and made workspace repair opt-in config-only, with a regression test so policy.jsonc cannot enable repairs by itself. Focused tests passed for policy doctor registration, bundled health checks, policy CLI, and runtime tool policy. @clawsweeper re-review |
62dc936 to
24a8bfd
Compare
24a8bfd to
e5767da
Compare
4244550 to
f2f954f
Compare
|
Restacked on the updated policy tool runtime branch and current origin/main (e643890). Fixed the policy docs check count and the strict partial-config test casts, then reran focused stack verification.\n\n@clawsweeper re-review |
6f6e7c8 to
d76802b
Compare
|
Fixed the latest ClawSweeper findings in d76802b:
Verification after rebasing onto current
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
d76802b to
0838fb1
Compare
|
Fixed the latest ClawSweeper P2 findings in signed commit
Verification:
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Fixed the ClawSweeper per-agent model map finding in 5ed7c62. Behavior addressed: policy evidence now scans documented per-agent
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Fixed the ClawSweeper provider-normalization finding in 84998bf. Behavior addressed: Policy model-provider evidence and model provider allow/deny policy comparison now use the runtime provider-id normalization contract from
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Policy: add model, network, and MCP conformance checks
Branch:
policy-conformance-examplesGitHub base:
mainLogical base:
mainafter #80056 mergedStatus: ready for maintainer review
Summary
This PR extends the bundled Policy plugin with three additional config-level conformance areas: model providers and model refs, private-network SSRF settings, and OpenClaw-managed MCP servers.
Policy stays a read-only conformance layer over existing OpenClaw config:
policy.jsoncdefines authored requirements.doctor --lintandpolicy checkreport drift without mutating config or runtime state.policy check --jsonemits the recordable audit tuple:policyHash + evidenceHash + findingsHash + clean result -> attestationHash.This follows the channels and tools policy slices, but keeps the added areas read-only. It proves the shape works across several OpenClaw settings categories without adding runtime enforcement or duplicate registries.
What Changed
policy check --json:modelProvidersandmodelRefs.models.providers.allowandmodels.providers.denypolicy support.policy/models-denied-providerandpolicy/models-unapproved-provider.policy check --json.network.privateNetwork.allow.policy/network-private-access-enabled.policy check --json.mcp.servers.allowandmcp.servers.denypolicy support.policy/mcp-denied-serverandpolicy/mcp-unapproved-server.Policy Shape
{ "models": { "providers": { "allow": ["openai", "anthropic"], "deny": ["openrouter"], }, }, "network": { "privateNetwork": { "allow": false, }, }, "mcp": { "servers": { "allow": ["docs"], "deny": ["untrusted"], }, }, }Category blocks are namespaces. A block such as
models: {},network: {}, ormcp: {}does not run a check by itself. A check runs when a concrete authored requirement is present, such asmodels.providers.allow,network.privateNetwork.allow, ormcp.servers.deny.Deny wins over allow. If a provider or server is denied, the finding reports the deny rule and does not also report the allowlist rule for the same target.
Evidence Shape
{ "evidence": { "modelProviders": [ { "id": "openai", "source": "oc://openclaw.config/models/providers/openai" } ], "modelRefs": [ { "ref": "openai/gpt-5.5", "provider": "openai", "model": "gpt-5.5", "source": "oc://openclaw.config/agents/defaults/model" } ], "network": [ { "id": "browser-private-network", "source": "oc://openclaw.config/browser/ssrfPolicy/dangerouslyAllowPrivateNetwork", "value": false } ], "mcpServers": [ { "id": "docs", "transport": "stdio", "source": "oc://openclaw.config/mcp/servers/docs", "command": "npx" } ] } }Safety
doctor --lintandpolicy checkare read-only for these areas. This PR does not:mcp.servers, start MCP runtimes, stop MCP runtimes, or contact remote MCP servers;Findings identify both sides of the decision:
targetpoints to the observed OpenClaw setting.requirementpoints to the authored policy rule.Real Behavior Proof
Behavior addressed: Enabled bundled Policy registers model-provider, MCP-server, and private-network health checks, collects config-derived evidence, and emits structured findings with
oc://target/requirement paths when configured model providers, MCP servers, or private-network SSRF posture violates policy.Real environment tested: Windows source worktree restacked on
origin/mainafter #80056 merge, head6f6e7c8283; previous before/after WSL proof artifact remains linked below.Exact steps or command run after this patch:
pnpm docs:listnode --no-maglev node_modules\\vitest\\vitest.mjs extensions/policy/src/policy-state.test.ts extensions/policy/src/cli.test.ts extensions/policy/src/doctor/register.test.ts src/flows/bundled-health-checks.test.ts --runnode node_modules\\@typescript\\native-preview\\bin\\tsgo.js --project tsconfig.json --noEmitpnpm docs:check-mdx -- docs/cli/policy.md docs/plugins/reference/policy.mdgit diff --check origin/main...HEADEvidence after fix:
Observed result after fix: Focused policy and bundled health-check tests passed 4 files and 70 tests.
tsgo, docs MDX, and diff whitespace checks passed. The restacked diff is limited to Policy docs, Policy source/tests, and the bundled health-check registration test.What was not tested: Runtime policy enforcement, approval metadata propagation, approval UI, supervisor protocol, gateway protocol, Swift protocol surfaces, and MCP runtime execution are intentionally not part of this PR. Local
oxfmtcould not be run in this Windows worktree because the formatter process failed withspawn EPERM/Access is denied; docs MDX and whitespace checks passed.Related
Policy stack links
This PR is part of the Policy 1.0 proof stack: