Skip to content

fix(ci): reject malformed advisories and bound audit delays - #137960

Merged
steipete merged 1 commit into
mainfrom
codex/audit-integrity-and-coverage
Sep 4, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/audit-integrity-and-coverage

Conversation

@steipete

@steipete steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Related: #137881. Supersedes the single-request proposal in #137865; thanks @vincentkoc for that simplification.

What Problem This Solves

Fixes an issue where dependency audits could report no findings after receiving malformed advisory data, while ordinary CI still spent minutes waiting for an unavailable npm advisory service. Incomplete coverage also needed a visible summary and a separately owned strict check.

Why This Change Was Made

The shared npm boundary now validates advisory maps, entries, identifiers, severities, and vulnerable-version fields before either the production or release audit consumes them. Each non-empty dependency graph is sent in one request, preserving separate release product/tooling graphs and removing both caller-side batching loops. Invalid severity levels cannot match inherited object keys.

Ordinary CI selects a 30-second total request budget, including retry backoff and response reading. It continues to downgrade only the unavailable exit code; findings, malformed data, and permanent errors remain blocking. Local and release callers retain their strict behavior and longer retry policy. Both CLI outcomes and early failures publish bounded, escaped GitHub job summaries with outcome, package count, elapsed time, and timestamp.

A separate daily/manual Dependency Audit workflow runs the strict production audit with read-only permissions and no dependency installation. It names @steipete as the triage owner. Documentation explains recovery and GitHub's notification ownership/settings; summary mentions are not treated as delivered alerts. This workflow is not added to the ordinary PR merge gate.

User Impact

Malformed registry responses can no longer masquerade as a successful audit. Ordinary CI has fewer registry requests and a bounded wait during outages. Maintainers can see exactly when coverage was incomplete and use the strict scheduled audit to track failures and verify recovery.

Evidence

  • Pre-fix malformed-response regression run: 10 failed, 46 passed. Original CLI probes also returned 0 for null, arrays, malformed package entries, and unknown severity.
  • Focused audit, executable CI/scheduled-shell, release, and GitHub advisory suites: 186 tests passed. Coverage includes one complete 401-package graph, malformed responses, permanent failures, timeout cancellation, total-budget backoff, strict scheduled exits, summaries, and unchanged GitHub partial-coverage semantics.
  • Real Node 24 CLI and actual YAML-extracted shell against a local HTTP server: clean returns 0; findings, null, unknown severity, and permanent 403 return 1; ordinary CI turns 429/reset/unavailable into a warning. A no-header stall ended at 30.19 seconds; permanent 403 with a stalled body remained blocking at 30.27 seconds. The scheduled 503 case returned 2. Missing lockfiles retained unknown package count; remote backticks/newlines stayed within the summary's code fence.
  • Real npm probes used the unchanged full production graph (1,190 packages, 1,308 versions, 36,111 bytes) and all-dependency graph (1,513 packages, 1,659 versions, 47,138 bytes), plain and gzip. All timed out before headers, as did tiny clean and known-vulnerable controls; registry ping returned 200 in 297 ms. No payload filtering occurred; every version was valid semver.
  • A real Node 24 production CLI run using the new CI budget exited 2 after 30.7 seconds and wrote an unavailable summary for all 1,190 packages.
  • The pinned actionlint build and repository workflow ownership/interpolation guards passed. Changed-scope guards, script/test types, script lint, and corrected test lint passed; the final audit suite rerun passed 62 tests after the test-only lint fixes. Final independent Codex review found no actionable P0-P2 defects (correctness 0.89).

Successful full-size npm response proof remains unavailable during the observed endpoint outage. The complete-graph shape follows the directly inspected npm implementation and pnpm implementation. Controlled HTTP proof verifies the actual full-graph submission and all policy outcomes; no live success is claimed. The new manual workflow can only be dispatched after it exists on the default branch; its first hosted run will be verified immediately after landing.

This maintainer-owned replacement preserves Vincent Koc's contribution credit and leaves his original branch untouched. No release candidate, package, dependency pin, product configuration, or persistent storage changes.

Production/tooling/workflow delta: +208/-118 (net +90), including the new 33-line scheduled workflow. Growth implements the explicitly requested validation contract, total deadline, and visible coverage reporting while deleting batching and silent-discard paths. Tests/test support: +154/-36 (net +118). Documentation: +30/-1 (net +29).

Reject malformed npm advisory responses before filtering. Submit each dependency graph once, cap ordinary CI requests at 30 seconds, and publish audit summaries. Add a daily strict production audit with documented ownership and recovery.

Builds on the single-request simplification in #137865 and the incomplete-coverage policy in #137881.

Co-authored-by: Vincent Koc <[email protected]>
@steipete steipete added the maintainer Maintainer-authored PR label Sep 4, 2026
@steipete steipete self-assigned this Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts size: L labels Sep 4, 2026
@steipete
steipete marked this pull request as ready for review September 4, 2026 05:58
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. 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. labels Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 4, 2026, 2:06 AM ET / 06:06 UTC.

ClawSweeper review

What this changes

The PR validates npm advisory responses before filtering, limits ordinary CI audit outages to a 30-second budget, adds a strict scheduled audit, and documents the behavior.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 5 items remain

Keep open: current main still chunks audit graphs and silently skips malformed entries, while this branch moves validation to the shared boundary. No introduced P0–P2 defect was found; the live successful full-graph npm response remains the only material pre-merge proof gap.

Priority: P2
Reviewed head: 2958994f0f71805f9b6668b3557362dfb7a84485
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is coherent and well-covered at the shared boundary; its only material confidence gap is a live successful full-graph npm response.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless records controlled real Node CLI and extracted CI-shell runs, while a successful full-size live npm response remains unavailable during the observed outage.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless records controlled real Node CLI and extracted CI-shell runs, while a successful full-size live npm response remains unavailable during the observed outage.
Evidence reviewed 7 items Current main remains affected: Current main still passes a 400-package batch loop to the production audit, normalizes unknown severities, and silently skips malformed map entries, so the central behavior is not already implemented.
Shared repair boundary: The branch validates parsed advisory maps before either caller consumes them and applies the total deadline around request attempts, response reading, and retry backoff.
Sibling release caller: The release vulnerability gate delegates its all and production graph requests to the same shared bulk-advisory boundary, so validation is not limited to ordinary CI.
Findings None None.
Security None None.

How this fits together

Dependency-audit scripts convert lockfile dependency graphs into npm advisory requests for CI and release checks. The validated response determines whether ordinary CI warns about incomplete coverage, blocks on findings/errors, or lets the scheduled audit fail strictly.

flowchart LR
  A[Lockfile dependency graph] --> B[Production audit script]
  B --> C[npm bulk advisory service]
  C --> D[Validated advisory map]
  D --> E[Severity filtering]
  E --> F[Ordinary CI warning or block]
  E --> G[Release vulnerability gate]
  E --> H[Strict scheduled audit]
Loading

Decision needed

Question Recommendation
Should this PR wait for a successful full-size live npm bulk response, or may it land with the documented outage limitation and controlled boundary proof? Verify live success before merge: Run the existing full production graph once the npm bulk endpoint responds and confirm a valid response completes under the intended CI path.

Why: The implementation and controlled Node CLI evidence cover malformed, error, timeout, and scheduling outcomes, but a live successful full-graph response could not be observed during the endpoint outage.

Before merge

  • Resolve merge risk (P0) - The new strict validator and scheduled workflow depend on the live npm bulk response matching the documented shape; the supplied real probes could only demonstrate outage behavior, not a successful full-size endpoint response.
  • Resolve merge risk (P1) - Production/tooling/workflow code grows by net 90 lines. The added validation, deadline accounting, job summary, and 33-line strict workflow have a direct contract purpose; no net-neutral owner-boundary refactor is apparent because current main lacks those behaviors.
  • Complete next step (P0) - Capture a successful full-size live npm bulk response before merge, or record maintainer acceptance of the documented outage-limited proof gap.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Tests +118, Docs +29, Config +33, Other +57. Total +237 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 3 154 36 +118
Docs 1 30 1 +29
Config 2 34 1 +33
Generated 0 0 0 0
Other 2 174 117 +57
Total 8 392 155 +237

Review metrics

Metric Value Why it matters
Production versus test delta production/tooling/workflow +208/-118; tests +154/-36; docs +30/-1 The positive production growth is tied to one shared validation/deadline/reporting contract and the new strict workflow, rather than unrelated churn.

Stored data model

Persistent data-model change detected: serialized state: scripts/pre-commit/pnpm-audit-prod.mjs, unknown-data-model-change: scripts/pre-commit/pnpm-audit-prod.mjs. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: canonical
Canonical: #137960
Summary: This PR is the integrated owner-path repair for malformed response handling and bounded ordinary-CI outage delays; the related single-request proposal is subsumed, while the merged availability policy is an adjacent prerequisite.

Members:

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

Merge-risk options

Maintainer options:

  1. Capture a live full-graph success (recommended)
    Before merge, verify one successful full-size npm bulk response so the new strict parser and scheduled automation are proven against the endpoint rather than only controlled responses.
  2. Accept the documented endpoint gap
    A maintainer may accept the controlled boundary coverage while the npm endpoint remains unavailable, with the first hosted scheduled run treated as follow-up verification.

Technical review

Best possible solution:

Retain the shared validation and deadline owner, then capture one successful full-size npm bulk response before merge; if the outage persists, explicitly accept the documented endpoint-proof limitation rather than weakening validation.

Do we have a high-confidence way to reproduce the issue?

Yes, source-reproducible: current main silently drops malformed advisory entries at the filtering boundary, while the branch’s focused tests exercise those exact malformed shapes and total-budget outcomes.

Is this the best way to solve the issue?

Yes: placing validation in the shared bulk-advisory reader protects both ordinary CI and the release gate, instead of duplicating consumer-side guards; successful live full-graph endpoint evidence remains unobserved.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 28f2f0a823c9.

Labels

Label changes:

  • add P2: This is a bounded CI audit reliability and integrity repair, with no demonstrated user-runtime outage.
  • add merge-risk: 🚨 automation: The PR changes ordinary CI behavior and adds a strict scheduled workflow whose live successful npm-response path is not yet observed.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless records controlled real Node CLI and extracted CI-shell runs, while a successful full-size live npm response remains unavailable during the observed outage.

Label justifications:

  • P2: This is a bounded CI audit reliability and integrity repair, with no demonstrated user-runtime outage.
  • merge-risk: 🚨 automation: The PR changes ordinary CI behavior and adds a strict scheduled workflow whose live successful npm-response path is not yet observed.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless records controlled real Node CLI and extracted CI-shell runs, while a successful full-size live npm response remains unavailable during the observed outage.

Evidence

What I checked:

  • Current main remains affected: Current main still passes a 400-package batch loop to the production audit, normalizes unknown severities, and silently skips malformed map entries, so the central behavior is not already implemented. (scripts/pre-commit/pnpm-audit-prod.mjs:673, 28f2f0a823c9)
  • Shared repair boundary: The branch validates parsed advisory maps before either caller consumes them and applies the total deadline around request attempts, response reading, and retry backoff. (scripts/pre-commit/pnpm-audit-prod.mjs:832, 2958994f0f71)
  • Sibling release caller: The release vulnerability gate delegates its all and production graph requests to the same shared bulk-advisory boundary, so validation is not limited to ordinary CI. (scripts/dependency-vulnerability-gate.mts:252, 2958994f0f71)
  • Boundary regression coverage: Tests cover malformed maps, entries, IDs, severities, stalled bodies, retry-budget exhaustion, complete 401-package submissions, exit outcomes, summaries, and the release caller. (test/scripts/pnpm-audit-prod.test.ts:598, 2958994f0f71)
  • Workflow contract: Ordinary CI alone adds --ci and retains exit 2 as its warning path; the new daily/manual workflow has read-only contents permission, a pinned checkout, disabled persisted credentials, and runs the strict audit without --ci. (.github/workflows/dependency-audit.yml:1, 2958994f0f71)
  • Current-main and release provenance: The PR head is not an ancestor of fetched main, while its base is; neither the earlier merged availability-policy commit nor this head is contained by a locally available release tag. The related availability behavior was merged by commit e5d413f. (e5d413f7e54a)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Capture one redacted successful full-size npm bulk response when the endpoint recovers, or record maintainer acceptance of that outage-limited gap.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Review follow-through for 2958994:

  • The exact-head CI run is green. Its hosted security job ran the actual --ci path: npm timed out after 30.09 seconds, the audit returned exit 2, and the shell emitted the explicit incomplete-coverage warning and succeeded. This is live proof of the outage path being repaired.
  • The successful full-size npm-response rank-up is deferred while the endpoint is unavailable. Under the requested live-test-and-land scope, the landing disposition accepts that documented service-availability limitation: full and tiny control requests fail alike, upstream npm and pnpm implementations establish the full-graph contract, and actual Node CLI/HTTP tests cover successful responses and malformed data. No live successful response or complete vulnerability clearance is claimed. The first hosted strict audit will be dispatched and checked immediately after merge.
  • Net production/tooling/workflow growth of 90 lines is accepted for the four requested capabilities. The new strict workflow accounts for 33 lines; shared validation, one total deadline and visible outcome reporting account for the rest. Both batching loops and silent malformed-entry discard paths were removed. There is no equivalent net-neutral implementation that retains all requested behavior.
  • The persistent-data compatibility item is not applicable. The new serialization writes a bounded GitHub job-summary artifact through GITHUB_STEP_SUMMARY; it does not change an application store, schema, migration, cache, lockfile, or persisted user data. The wire response is validated at its existing npm boundary, using the directly inspected upstream contract.

No source change follows the review. The strict local/release/scheduled policy remains intact, and the ordinary PR gate only downgrades explicit service unavailability.

@steipete
steipete merged commit ec87f91 into main Sep 4, 2026
206 checks passed
@steipete
steipete deleted the codex/audit-integrity-and-coverage branch September 4, 2026 06:11
@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Post-merge hosted verification is complete.

Landed through the native maintainer flow as ec87f91 after the exact-head CI run passed. Its ordinary-CI audit observed the live npm outage, stopped after 30.09 seconds, and continued with the explicit incomplete-coverage warning.

I manually dispatched the new Dependency Audit workflow on main at 1df85448ef9335c8345d39bdd2c18eb8438a8adf, verified that commit contains the merge, and confirmed the audit scripts and workflow are byte-identical to the tested PR head. The hosted run failed with exit 2 as intended for the continuing npm outage. Its rendered job summary shows unavailable, 1,190 packages, 184.0 seconds, the three-attempt timeout reason, and @steipete as triage owner. Checkout and Node setup succeeded. The daily workflow is active.

This verifies both live policies: ordinary PR CI remains usable during an advisory outage, while the separate strict audit visibly reports missing coverage. It does not establish a successful full-size npm response or vulnerability clearance; that endpoint-recovery proof remains outstanding. #137865 is closed as superseded with contributor credit preserved and its original branch untouched.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 5, 2026
…#137960)

Reject malformed npm advisory responses before filtering. Submit each dependency graph once, cap ordinary CI requests at 30 seconds, and publish audit summaries. Add a daily strict production audit with documented ownership and recovery.

Builds on the single-request simplification in openclaw#137865 and the incomplete-coverage policy in openclaw#137881.

Co-authored-by: Vincent Koc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant