test(policy): add config coverage report#87081
Conversation
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
|
Codex review: needs changes before merge. Reviewed June 26, 2026, 9:21 PM ET / 01:21 UTC. Summary PR surface: Config +1, Other +993. Total +994 across 3 files. Reproducibility: yes. Source inspection shows Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Security Review findings
Review detailsBest possible solution: Keep the internal report shape, but make no-schema exemptions exact or explicitly classified so Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows Is this the best way to solve the issue? No. The report is the right owner-boundary shape, but the stale-path exemption should be exact or explicitly classified before this becomes the maintainer baseline. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 072d3ed7b5e4. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Config +1, Other +993. Total +994 across 3 files. View PR surface stats
Security concerns:
Acceptance criteria:
What I checked:
Likely related people:
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. How this review workflow works
|
|
ClawSweeper PR egg ✨ Hatched: 🌱 uncommon Neon Merge Sprite Hatch commandComment Hatchability rules:
Rarity: 🌱 uncommon. What is this egg doing here?
|
| "gateway.auth.mode", | ||
| "gateway.auth.rateLimit.*", | ||
| "gateway.bind", | ||
| "gateway.controlUi.allowInsecure", |
There was a problem hiding this comment.
This monitored path does not exist in the config schema. The concrete Control UI leaves Policy scans are gateway.controlUi.allowInsecureAuth, gateway.controlUi.dangerouslyDisableDeviceAuth, and gateway.controlUi.dangerouslyAllowHostHeaderOriginFallback; similarly the Tailscale and HTTP entries below use gateway.tailscale.mode / preserveFunnel and gateway.http.endpoints.<endpoint>... paths. Since the matching classifications are allowed to have no schema path, --check can pass while these real gateway exposure leaves are not counted. Please classify the concrete schema paths, including the HTTP URL-fetch allowUrl leaves that drive the allowlist policy.
There was a problem hiding this comment.
Fixed in 7b9b6865da2.
The coverage inventory now monitors/classifies the concrete schema leaves Policy actually observes:
gateway.controlUi.allowInsecureAuthgateway.controlUi.dangerouslyDisableDeviceAuthgateway.controlUi.dangerouslyAllowHostHeaderOriginFallbackgateway.tailscale.modegateway.tailscale.preserveFunnelgateway.http.endpoints.*.enabledgateway.http.endpoints.*.*.allowUrlgateway.http.endpoints.*.*.urlAllowlist.*
I also removed the allowNoSchemaPath escape for those Gateway classifications so stale synthetic paths no longer pass --check. pnpm policy:config-coverage -- --check --show-covered now reports no stale classifications and shows the concrete Gateway leaves covered.
galiniliev
left a comment
There was a problem hiding this comment.
This PR adds an internal maintainer report for Policy config coverage. The useful part is the final stacked commit, which wires pnpm policy:config-coverage to a new script and classification inventory.
Findings: request changes.
LOC: +10770/-1861 (12 files). Final commit 66eb73dbb199705d30343ded51f4e04391bd87e8: +922/-0 (3 files).
- Blocking: the gateway coverage inventory uses non-schema or stale paths, so
--checkcan report success while omitting real Policy-observed gateway exposure config. The new inventory monitors/classifiesgateway.controlUi.allowInsecure,gateway.tailscale.funnel, andgateway.http.*/gateway.http.*.urlAllowlist.*, but the schema and Policy evidence usegateway.controlUi.allowInsecureAuth,gateway.controlUi.dangerouslyDisableDeviceAuth,gateway.controlUi.dangerouslyAllowHostHeaderOriginFallback,gateway.tailscale.mode,gateway.tailscale.preserveFunnel, andgateway.http.endpoints.<endpoint>...including the URL-fetchallowUrlleaves. Because the current entries either do not match the baseline at all or are hidden behindallowNoSchemaPath, the report undercounts the exact security/config leaves it is meant to inventory. Please switch these to the concrete schema paths and include the URL-fetchallowUrlpaths that Policy uses to decide whether an allowlist is required.
Best fix verdict: the script shape is reasonable, but the coverage source data needs correction before merge; otherwise this becomes a false confidence report for gateway policy coverage.
Evidence read: scripts/check-policy-config-coverage.ts, scripts/lib/policy-config-coverage.jsonc, src/config/zod-schema.ts, src/config/doc-baseline.ts, extensions/policy/src/policy-state.ts, extensions/policy/src/doctor/register.ts.
Verification run: node --import tsx -e 'import {renderConfigDocBaselineArtifacts, flattenConfigDocBaselineEntries} from "./src/config/doc-baseline.ts"; const {baseline}=await renderConfigDocBaselineArtifacts(); for (const e of flattenConfigDocBaselineEntries(baseline).filter(e=>!e.hasChildren && /^(gateway\\.controlUi\\.(allowInsecure|allowInsecureAuth|dangerouslyDisableDeviceAuth|dangerouslyAllowHostHeaderOriginFallback)|gateway\\.tailscale\\.(funnel|mode|preserveFunnel)|gateway\\.http\\.)/.test(e.path)).map(e=>e.path).sort()) console.log(e);'
66eb73d to
7b9b686
Compare
|
@galiniliev fixed the Gateway inventory issue in What changed:
Fresh validation:
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
7b9b686 to
881cfe9
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Rebased #87081 over the cleaned unsupported-key branch after removing the release-owned changelog edit from the lower policy stack. Current signed head: Validation:
@clawsweeper re-review |
b2550f7 to
373f83c
Compare
|
Rebased #87081 onto current Result:
Validation from
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review Pushed Change made:
Validation on the pushed head:
Negative proof: temporarily added monitored pattern PR remains ready-for-review with maintainer-can-modify enabled; the old GitHub requested-changes review still needs reviewer/maintainer supersession after this code repair. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Current exact-head readiness check for #87081:
Requesting review refresh to supersede the stale requested-changes state. |
24733ac to
6897345
Compare
|
Merged via squash.
Thanks @giodl73-repo! |
Summary
This is the final policy-series maintainer follow-up. It adds an internal, report-only coverage inventory for the OpenClaw config fields that Policy currently watches for conformance or attestation drift.- adds
pnpm policy:config-coverage- keeps the tool internal to repo maintainers, not anopenclaw policyuser command- classifies monitored config leaf paths as observed by the policy surface- supports--check,--json, and--show-coveredfor policy maintainer workflowsDefault mode is intentionally report-only so ordinary config PRs do not have to update Policy. Policy maintainers can runpnpm policy:config-coverage --checkwhen they want unclassified or stale monitored paths to fail locally.## Stack noteThis branch is currently opened againstmainfor GitHub visibility, but the reviewable change is the final commit:-66eb73dbb19 test(policy): add config coverage reportIt is stacked after the active policy line, including #85572, #85744, #86768, #87056, and #87074.## Verification-pnpm policy:config-coverage --check-pnpm policy:config-coverage --check --json-pnpm exec oxfmt --check --threads=1 package.json scripts/check-policy-config-coverage.ts scripts/lib/policy-config-coverage.jsonc-pnpm tsgo:core-node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.scripts.json scripts/check-policy-config-coverage.ts-git diff --check-~/.codex/skills/codex-review/scripts/codex-review --mode localUpdate after stale-pattern review
Head
24733ac67daddresses the latest P1 review finding by reporting monitored patterns that no longer match any generated config leaf. These unmatched monitored patterns now appear in text output, appear in JSON asunmatchedMonitored, setok: false, and make--checkexit nonzero unless covered by an explicitallowNoSchemaPathclassification.Additional proof on the pushed head:
pnpm policy:config-coverage --check --json->ok: true,monitoredPaths: 209,unclassified: [],unmatchedMonitored: [],stale: [].pnpm policy:config-coverage --check --show-covered.node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.scripts.json scripts/check-policy-config-coverage.ts.pnpm exec oxfmt --check --threads=1 package.json scripts/check-policy-config-coverage.ts scripts/lib/policy-config-coverage.jsonc.OPENCLAW_VITEST_FS_MODULE_CACHE_PATH=/tmp/openclaw-87081-stale-pattern-ff-cache OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs extensions/policy/src/doctor/register.test.ts extensions/policy/src/cli.test.ts --reporter=dot --testTimeout=30000-> 2 files, 310 tests passed.pnpm tsgo:core.git diff --check.Negative proof: temporarily added monitored pattern
zz.codexNegativeProof.missing;pnpm policy:config-coverage --check --jsonexited nonzero withok: falseandunmatchedMonitored: [{ "pattern": "zz.codexNegativeProof.missing" }]. The temporary pattern was removed before commit.