Skip to content

fix(security): stop Endor errors failing Endor-only scan jobs - #4488

Merged
jesse-merhi merged 2 commits into
mainfrom
jesse/endor-report-only-failures
Nov 9, 2026
Merged

jesse-merhi merged 2 commits into
mainfrom
jesse/endor-report-only-failures

Conversation

@jesse-merhi

Copy link
Copy Markdown
Member

What this PR does

Since Nov 7, most community code-plugin scan jobs in Production have been recorded as failed jobs. This PR makes those jobs complete and store an Endor result, and it fixes the three causes of the failures.

  1. An Endor error no longer fails the job. feat(security): activate scanner-only Codex plugin adjudication #4411 added Endor-only jobs (scanMode: "endor-report-only") for automatic plugin publishes. In that path, an Endor error failed the whole job. The full scan path already saves an Endor error on the release as a failed analysis. Both paths now share one helper, runEndorReport, that does that.
  2. Owner-only files are readable inside the scanner. The worker now makes its disposable copy of the artifact readable by the container's node user. Without that, files the artifact stored as 0600 failed with Permission denied.
  3. pnpm packages are skipped with a clear reason. endorctl needs pnpm for a package with a pnpm-lock.yaml and refused to start (host-check-failure). The scanner image only isolates npm and Yarn, so these are now saved as skipped: Endor cannot scan pnpm packages yet.
  4. Endor reports can be up to 64 MiB. The limit was 8 MiB, and large community dependency trees went past it. Only the bounded summary (50 findings) is stored, and diagnostics stay capped at 20k characters.

Moderation and publication are unaffected, before and after: Endor-only jobs can only write endorAnalysis.

Proof

From the diagnostics artifacts of four Production worker runs on Nov 9 (42565938606, 42561922928, 42564563877, 42563274816), there were 87 plugin release jobs:

Outcome on main today Jobs After this PR
Endor completed 19 unchanged
Endor exit 1: dependency resolution failed (unable to build target package) 23 job completes, Endor saved as failed
Endor exit 1: host-check-failure: Cannot access the "pnpm" command 15 Endor saved as skipped (pnpm)
Endor exit 1: cp: cannot open '/workspace/./openclaw.plugin.json' … Permission denied 12 files readable; Endor runs
Endor stdout over the 8 MiB limit 18 limit raised to 64 MiB

Tests:

  • New worker test: an Endor-only job whose Endor scan exits 1 completes and saves endorAnalysis: { status: "failed" }. Run against main's worker, it fails: expected { completed: false, …(2) } to deeply equal { completed: true, …(2) }. With this PR it passes.
  • New scan tests: a 0600 file in a 0700 directory is readable after the copy; a package with pnpm-lock.yaml is skipped without starting Docker.
  • Affected suites pass: run-endor-plugin-scan, endor/scan, run-codex-scan-worker-clawscan and run-codex-scan-worker, 141 tests. bun run ci:static and tsrs --noEmit also pass.

Not done here: running pnpm packages through Endor. That needs pnpm in the scanner image, behind the same credential-stripping shim as npm and Yarn, plus a rerun of the isolation harness. The dependency-resolution failures are genuine: Endor can't build those packages, so they're stored as failed, not as clean.

Endor-only jobs (added in #4411) let an Endor error fail the whole job,
so most community code-plugin publishes recorded a failed scan job.
Save a failed Endor analysis instead, as the full scan path already
does, and fix the three causes seen in Production:

- make the copied artifact readable by the container's node user
  (owner-only files failed with Permission denied);
- skip pnpm packages, which endorctl cannot scan without pnpm;
- raise the Endor report limit from 8 MiB to 64 MiB.
Copilot AI balanced review requested due to automatic review settings November 9, 2026 05:42
@vercel

vercel Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
clawhub Ready Ready Preview Nov 9, 2026 6:01am UTC

Request Review

@clawsweeper

clawsweeper Bot commented Nov 9, 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@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. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 9, 2026
@clawsweeper

clawsweeper Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR saves Endor errors as failed analyses, makes copied artifacts readable, skips unsupported pnpm packages, and increases the report limit.

Example: An automatic community code-plugin job runs Endor, which exits with code 1.

  • Before: The scan job fails without saving the failed Endor analysis.
  • After: The job completes and saves a failed Endor analysis with a rescan instruction.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, source-supported repair with the prior finding fixed; candidate evidence remains harness-based.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; supplied tests exercise the worker and scanner wrapper with fake Docker, while the production diagnostics describe pre-fix symptoms.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Community plugin releases can lose their Endor report when an advisory scanner error fails the background job.
Reason: The maintainer-authored repair restores the documented report-only contract and addresses concrete artifact and scanner limitations without expanding publication authority.

Regression provenance

Regression provenance — suspected predecessor, not a causality claim: source commit 35aa372b24a3 by Peter Steinberger; no PR verified.

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

Merge readiness

✅ Ready for maintainer review

Keep open: current main still fails Endor-only jobs on scanner errors, and this maintainer-authored PR repairs that behavior. The prior pnpm-message finding is resolved; no actionable patch defects remain.

Priority: P2
Reviewed head: c6be7f5e15d855e5ea91c4468e0b4f8c919a32ce

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied candidate coverage uses fake Docker and a mocked completion client rather than a real-container scan persisted through the backend.
Agent review details

How this fits together

The security worker consumes leased release jobs and verified artifacts, runs Endor in an isolated container, and submits bounded reports through the backend completion action for display on the security audit page.

flowchart LR
  A[Leased release job] --> B[Verified artifact workspace]
  B --> C[Disposable readable copy]
  C --> D[Isolated Endor scanner]
  D --> E[Bounded report or failed analysis]
  E --> F[Lease checked completion]
  F --> G[Release security audit]
Loading

Technical review

Best possible solution:

Share report-only error handling between both worker paths while retaining isolated scanning, bounded reports, and canonical lease-checked persistence.

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

Current-main source shows that a nonzero Endor exit throws through the Endor-only branch into job failure; the added regression exercises this input with an executable fake Docker command, but no tests were run during this read-only review.

Is this the best way to solve the issue?

Best-fix verdict: best for the stated job-outcome bug; sharing the existing full-scan handler avoids divergent semantics, while adding pnpm to the scanner image would require separate credential-isolation work.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 6fe2dc0c9503.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Patrick Erichsen: Raw commit 560125d adds scripts/security/run-codex-scan-worker.ts:2513 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 560125d8ef84; files: scripts/security/run-codex-scan-worker.ts)
  • Jesse Merhi: Raw commit 46dbc1f adds scripts/security/run-endor-plugin-scan.ts:27 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 46dbc1f6e3ee; files: scripts/security/run-endor-plugin-scan.ts)

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
Patch scope Production +50/-29; tests +61/-1; specification +3/-1 The focused growth shares existing failure semantics and covers distinct scanner inputs.

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: The repair restores background dependency reporting without evidence that publication, downloads, or moderation are blocked.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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 (1 earlier review cycle)
  • reviewed 2026-11-09T05:56:58.718Z sha b1d63e7 :: needs changes before merge. :: [P3] Explain the next action when pnpm analysis is skipped

Reviewed November 9, 2026, 1:02 AM ET / 06:02 UTC (Revision 2).

@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 9, 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. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 9, 2026
@jesse-merhi
jesse-merhi merged commit 86905c3 into main Nov 9, 2026
78 of 83 checks passed
@jesse-merhi
jesse-merhi deleted the jesse/endor-report-only-failures branch November 9, 2026 06:56

This branch was successfully deployed

1 active deployment
Preview – clawhub — c6be7f5e Deployed Nov 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants