Skip to content

feat(security): queue Endor reachability scans for plugins - #3742

Open
jesse-merhi wants to merge 11 commits into
mainfrom
jesse/endor-plugin-scan-pipeline
Open

jesse-merhi wants to merge 11 commits into
mainfrom
jesse/endor-plugin-scan-pipeline

Conversation

@jesse-merhi

@jesse-merhi jesse-merhi commented Sep 16, 2026

Copy link
Copy Markdown
Member

Plugin publication and rescan requests enqueue Endor analysis in the existing security worker. The audit page reads the saved result, so a scan that takes about a minute does not hold the request open. The companion ClawScan adapter is PR #55.

Behavior

  • Show only findings tagged FINDING_TAGS_REACHABLE_FUNCTION, with a bounded summary and full count. Include that summary in the audit ZIP and retain the complete scanner report in private storage.
  • Reuse existing leases, retries, deduplication and paced admin bulk rescans. Run primary ClawScan and Endor concurrently, then settle both before removing their workspace.
  • Preserve the primary moderation verdict when Endor fails. A malicious primary result still quarantines the release; supplemental failures use the existing retry path while the release remains eligible.
  • Give each Endor invocation an ownership ID and remove its exact containers after success, failure or cancellation. Cleanup does not receive Endor credentials. Failed native artifacts with raw: null retain their actual scanner error.
  • Count Endor timeouts in the worker health summary while preserving primary judge diagnostics and the existing retry behavior.

Proof

Saved reachable-function finding in the local plugin audit

  • The browser rescan returned in 481 ms and displayed Scanning while retaining its saved result. A fresh isolated database also passed enqueue → lease → hydrate → report upload → completion → public audit display. These queue/UI completions use explicitly synthetic findings.
  • A real Slack scan in openclaw-nfr.clawhub completed in 54.439 seconds through the current helper using the 3026ed5 Endor image (npm 11.19.1), pinned Endor 1.7.1115 and unchanged 91b1eba scanner binary: 12 raw findings, one exact reachable-function finding. Original files were unchanged, the temporary scanner key was revoked, and no owned container remained.
  • A real parent-timeout test left no owned container behind. Tests cover mismatched ownership and cleanup failures without weakening the ownership check.
  • Backend-first upgrade preserved an existing release's public response. After saving an Endor result, an attempted old-schema rollback was rejected and the stored response remained intact.
  • Existing regression proof shows a plugin ZIP becoming unavailable after a malicious primary result despite Endor failure. Stale leases and mismatched targets cannot write analysis; the export includes the saved endor.json.

Local validation on 7eceb87c: 7,186 tests passed, plus static checks. All 38 worker tests, including the rendered timeout count, and TypeScript checks passed. Earlier type/build and schema/CLI/admin package checks remain applicable to unchanged sources and dependencies. Node 24.18.1 and Bun 1.4.2 were used. Native review of the current full PR and independent review of the changed worker paths are complete with no remaining actionable findings; independent evidence for the other 34 unchanged paths is retained. Earlier hosted CI applies to the previous remote head only.

Rollout and limits

Endor remains disabled until the additive backend is deployed and the worker has a released ClawScan adapter, digest-pinned image and scoped credentials. Stop Endor by disabling the worker flag while retaining the additive schema and handlers. Old schemas reject stored Endor fields. Later completed scans replace the combined report; this does not add report history.

Scans use Endor dry-run mode. Reports live in ClawHub and do not populate Endor's project dashboard. The adapter rejects target .npmrc files; private-registry configuration is unsupported. A report uploaded during hard deletion can remain unattached in private storage. When the primary scanner and Endor cleanup fail together, the recorded primary failure can hide the secondary cleanup detail; the job still fails and retries. These minor lifecycle/diagnostic limits remain documented.

Branch coverage is 78.56% (2,675/3,405), below AGENTS' documented 80% target while passing the configured 70% threshold. The baseline control emitted 78.18%, but that control command failed on an existing socket error. The missing coverage in changed files predates this PR; the new Endor branches are covered. Jesse approved an exception for this existing coverage gap on 2026-09-21; the configured threshold remains unchanged.

Change Breakdown

Part Files +LOC -LOC
Implementation 16 +439 -43
Tests and fixtures 11 +1815 -10
CI, config, and tooling 6 +814 -104
Dependencies and generated files 3 +87 -1
Total 36 +3155 -158

@clawsweeper

clawsweeper Bot commented Sep 16, 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.

@vercel

vercel Bot commented Sep 16, 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 Sep 21, 2026 6:10am UTC

Request Review

@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 21, 2026, 2:26 AM ET / 06:26 UTC (Revision 6).

ClawSweeper review

What this changes

Adds background Endor dependency scans for plugin releases, with saved reachability findings in audit pages, APIs, and report downloads.

Merge readiness

Ready for maintainer review

Keep open: the requested capability is absent from current main, and this maintainer-authored PR remains useful. No blocking findings were identified.

Priority: P2
Reviewed head: 7eceb87cb26dee73648b735e0cfc4645e15aeef8

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent integration with useful real behavior evidence, focused regression coverage, and documented rollout limits.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): Supplied runtime results exercise the actual Endor helper against Slack with the pinned image, showing one reachable finding and successful cleanup; separate real Convex/UI evidence covers queue completion, upgrade compatibility, and guarded writeback. The inspected screenshot proves the saved synthetic finding’s display, not scanner execution.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Supplied runtime results exercise the actual Endor helper against Slack with the pinned image, showing one reachable finding and successful cleanup; separate real Convex/UI evidence covers queue completion, upgrade compatibility, and guarded writeback. The inspected screenshot proves the saved synthetic finding’s display, not scanner execution.
Evidence reviewed 10 items Pinned scope and current state: Reviewed the introduced main-to-head delta across 36 files. Raw test-merge parents match the pinned main followed by the exact PR head; its tree equals the head tree. REST metadata confirms the PR remains open, mergeable, and MEMBER-authored.
Current main still lacks the integration: Main’s worker invokes the existing primary scan without the Endor branch. Current source, audit documentation, and the same-repository Endor search identify no merged replacement. The supplied generic-scanner RFC proposes a different storage abstraction.
Latest release comparison: The v0.23.3 worker likewise calls the primary scanner without Endor integration. Release source was inspected through GitHub REST after a local historical blob read failed.
Findings None None.
Security None None.

How this fits together

ClawHub’s security worker processes published plugin artifacts and rescan requests. It stores scanner results for audit displays while the primary ClawScan verdict controls moderation.

flowchart TD
  A[Plugin publication or rescan] --> B[Existing scan queue]
  B --> C[Worker claims release lease]
  C --> D[Primary ClawScan review]
  C --> E[Optional Endor Docker scan]
  D --> F[Validate lease and save results]
  E --> F
  F --> G[Audit page and report download]
  F --> H[Primary verdict moderation]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Diff size +3155/-158 across 36 files The change spans worker execution, persistent results, public schemas, and audit presentation.
Production versus test growth Production +1222/-146; tests and fixtures +1744/-10 Production growth implements the scanner lifecycle and result integration; generated files, workflow, and spec are excluded.

Technical review

Best possible solution:

Retain one scan queue and primary moderation authority, using the documented backend-first rollout and enabling Endor only with the compatible released adapter and pinned image.

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

Not applicable as a bug reproduction: this adds a scanner capability, with supplied real-run and fixture evidence covering its behavior.

Is this the best way to solve the issue?

Yes: extending the existing worker and lease contract is the narrowest suitable approach; synchronous scans would delay requests, while a generic scanner-storage migration would expand scope unnecessarily.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded plugin-security improvement with opt-in execution and no demonstrated urgent regression.
  • merge-risk: 🚨 compatibility: Persisted Endor fields prevent old-schema rollback; the maintainer explicitly documents and tests retaining the additive backend during rollback.
  • 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. Sufficient (live_output): Supplied runtime results exercise the actual Endor helper against Slack with the pinned image, showing one reachable finding and successful cleanup; separate real Convex/UI evidence covers queue completion, upgrade compatibility, and guarded writeback. The inspected screenshot proves the saved synthetic finding’s display, not scanner execution.
  • proof: sufficient: Contributor real behavior proof is sufficient. Supplied runtime results exercise the actual Endor helper against Slack with the pinned image, showing one reachable finding and successful cleanup; separate real Convex/UI evidence covers queue completion, upgrade compatibility, and guarded writeback. The inspected screenshot proves the saved synthetic finding’s display, not scanner execution.

Evidence

What I checked:

  • Pinned scope and current state: Reviewed the introduced main-to-head delta across 36 files. Raw test-merge parents match the pinned main followed by the exact PR head; its tree equals the head tree. REST metadata confirms the PR remains open, mergeable, and MEMBER-authored. (7eceb87cb26d)
  • Current main still lacks the integration: Main’s worker invokes the existing primary scan without the Endor branch. Current source, audit documentation, and the same-repository Endor search identify no merged replacement. The supplied generic-scanner RFC proposes a different storage abstraction. (scripts/security/run-codex-scan-worker.ts:2100, ff6c118c132a)
  • Latest release comparison: The v0.23.3 worker likewise calls the primary scanner without Endor integration. Release source was inspected through GitHub REST after a local historical blob read failed. (scripts/security/run-codex-scan-worker.ts:1522, 87ca030c30f3)
  • Result authority and persistence: Completion checks running state, target release, and lease token inside the mutation before attaching results and consuming the lease. Failure writeback uses the same target/lease guard and preserves primary malicious-verdict quarantine. Regression coverage includes concurrent completion, stale leases, mismatched releases, private storage, and download rejection. (convex/packages.ts:12763, 7eceb87cb26d)
  • Affirmative dependency contract: The new helper executes ClawScan’s endor adapter in Docker, supplies a run ownership ID, and consumes its native scanner artifact. This directly establishes the ClawScan dependency boundary; its source and policy were inspected. (scripts/security/run-endor-plugin-scan.ts:443, 7eceb87cb26d)
  • Adapter and isolation contract: Inspected the Endor adapter, Docker lifecycle owner, and pinned image definition at the companion head. They preserve native findings, reject target .npmrc files, isolate resolver credentials, suppress install scripts, and verify container ownership before removal. feat(scanners): add Endor dependency reachability analysis clawscan#55 remains open and unmerged; rollout is explicitly deferred until a compatible release exists. (internal/runner/endor_scanner.go, 3026ed5c7f82)

Likely related people:

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

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.

History

Review history (5 earlier review cycles)
  • reviewed 2026-09-16T06:25:31.782Z sha f048d3c :: blocked before merge. :: none
  • reviewed 2026-09-16T06:30:01.105Z sha f048d3c :: blocked before merge. :: none
  • reviewed 2026-09-16T06:45:58.322Z sha f048d3c :: blocked before merge. :: none
  • reviewed 2026-09-21T06:12:57.834Z sha 7eceb87 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-21T06:20:51.912Z sha 7eceb87 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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. proof: sufficient Contributor real behavior proof is sufficient. labels Sep 16, 2026
@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@jesse-merhi
jesse-merhi requested a review from a team as a code owner September 21, 2026 06:16
Copilot AI lite review requested due to automatic review settings September 21, 2026 06:16
@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

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 reached their quota limit.

@clawsweeper

clawsweeper Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot removed the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal backlog priority with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants