Skip to content

Endor: scan all code plugins (report-only) and remove unused Endor code - #4322

Merged
jesse-merhi merged 5 commits into
mainfrom
jesse/endor-simplify-code-plugins
Nov 6, 2026
Merged

jesse-merhi merged 5 commits into
mainfrom
jesse/endor-simplify-code-plugins

Conversation

@jesse-merhi

@jesse-merhi jesse-merhi commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

What this PR does

  1. Endor scans every code plugin, not just official ones. Today Endor (dependency vulnerability and reachability analysis) only runs on @openclaw/* code plugins. After this PR it runs on community code plugins too. Skills and bundle plugins are still never scanned.
  2. Endor stays report-only. Its result appears on the plugin's security audit page and nothing else. It never reaches the AI judge, so it can't publish, block, quarantine or moderate anything. The judge's verdict alone decides moderation.
  3. It deletes the Endor code Production never uses (about 900 lines net):
    • the Endor-to-judge mode;
    • the package selector;
    • a multi-step Docker cleanup protocol;
    • a local batch script and a dry-run mode.

The scanner's isolation (firewall, unprivileged user, credential-stripping npm/Yarn, no dependency scripts) is unchanged. This PR adds proof that it holds in the real Production image, because it now sees community code.

Rollout: read before merging

  • Merging turns this on. The security worker runs from main and Production already has CODEX_SECURITY_SCAN_ENDOR_ENABLED=1. Community code-plugin publishes and rescans start running Endor on the next worker run, with no deploy step. To hold it, set that Production variable to 0 before merging.
  • Endor capacity: saved mode creates one persistent Endor project per release version. Covering community plugins grows that count without limit, so confirm the Endor tenant/licence can absorb it.
  • No image rebuild needed. The current pinned image works with this worker. The proofs below ran against it.
  • No backfill. Existing releases get an Endor result the next time they are scanned for any reason.
  • After merge, delete the now-unused GitHub variables CODEX_SECURITY_SCAN_ENDOR_PACKAGES (Production) and CODEX_SECURITY_SCAN_ENDOR_JUDGE_ENABLED (Production and Test).

Proof

1. Who gets scanned

These are the outputs of calling the old and new eligibility functions with Production's settings:

Release Family Before After
official @openclaw/slack code-plugin Endor runs Endor runs
community @acme/community-plugin code-plugin skipped Endor runs
official @openclaw/some-bundle bundle-plugin skipped skipped
community @acme/some-bundle bundle-plugin skipped skipped

With the switch at 0, a community code plugin is skipped. Skill jobs never reach this check, because only package releases do.

2. Isolation holds in the real Production image against hostile dependencies

I ran scripts/security/endor/fixtures/run.sh in the pinned Production image ghcr.io/openclaw/clawhub-endor@sha256:3db43b8b…2b2a. It ran behind the real entrypoint (egress guard, then drop to node), with the worker's container flags and this PR's scan.sh. A stand-in endorctl gets synthetic Endor/VirusTotal/unknown secrets and uses the image's real npm and Yarn to install from a local registry that records every Authorization header:

  • a registry dependency;
  • Git dependencies with prepare scripts that try to record the secrets;
  • dependency .npmrc files that try to send the secrets as registry tokens.

A separate container on the Docker bridge served as a private listener. Without the egress guard it is reachable:

without-guard 192.168.215.2 connected
with-guard 192.168.215.2 blocked (timeout)

The full harness:

egress 169.254.169.254:80 blocked (timed out)
egress 10.0.0.1:80 blocked (timed out)
egress 172.17.0.1:80 blocked (timed out)
egress 192.168.215.2:8000 blocked (timed out)
fixture-ok
exit=0

fixture-ok means all of the following held:

  • the scan ran as a non-root user;
  • no private destination accepted a connection;
  • no dependency prepare script ran, under npm or Yarn;
  • Yarn refused the .npmrc that tried to use a secret;
  • the registry saw installs, but no request carried any synthetic secret.

On macOS the REJECT's ICMP reply doesn't reach the emulated amd64 process, so a block shows as a timeout. The rule's packet counter confirmed the hits.

Negative control: I also ran it with a mutated scan.sh whose npm/Yarn shims keep the environment (env -i removed). The harness failed:

Yarn accepted a dependency config with a missing credential variable
exit=1

3. Container cleanup with the real image and the real worker code

I called runEndorPluginScan against the real image for a community release, with no Endor credentials:

[timeout] rejected timedOut=true: Endor scan timed out after 4076ms
[scanner failure] rejected timedOut=false: Endor scan exited 1 after 6424ms

Both were recorded as Endor failures, and the worker force-removed the container. One edge case showed up: if the timeout lands while Docker is still creating the container, the daemon can finish creating it after the removal. That container stays Created and is never started, so nothing runs in it, and the disposable runner discards it. With the 20-minute production timeout this is practically unreachable. The spec documents it.

4. Report-only through the real worker path

processJob tests for a community code plugin, with both a completed and a failed Endor scan, check three things:

  • the Endor result goes to completeCodexScanJob;
  • the fake ClawScan exits non-zero if it receives --config, --context, --scanner-result endor= or any ENDOR_* credential;
  • the judge's metadata.json holds no stored endorAnalysis.

Not proven here

A real Endor scan with real credentials. I don't hold them, and this PR doesn't change how endorctl is called: the call is the same as the one Production already runs for official plugins. The first community scans after merge are that proof. They show up on the release's security audit page.

What changed, file by file

Removed or simplified

  • Endor-to-judge mode: clawHubEndorProfile.ts (a custom ClawScan profile with a hand-copied judge prompt), CODEX_SECURITY_SCAN_ENDOR_JUDGE_ENABLED, and the Endor evidence checks in the artifact validator. Production forced this off, and only Test ran it, so Test wasn't checking the same behaviour Production runs.
  • Package selector: CODEX_SECURITY_SCAN_ENDOR_PACKAGES and the @openclaw/* selector are replaced by family === "code-plugin".
  • Docker lifecycle: create → start → inspect label → late-create polling → EndorContainerCleanupError → stop worker and keep workspace is replaced by docker run --rm --name <uuid>. On failure or timeout the worker runs docker rm --force. A real removal failure is added to the recorded error; "No such container" after --rm already cleaned up is not.
  • Dead code: scan-local-plugins.ts and the clawscan:plugins script; scan.sh's dry-run mode and its duplicate JSON-shape check (the worker validates with zod); assertNoExternalSymlinks (the worker already refuses tarballs with links); the deploy-test.yml exception for the deleted branch codex/endor-plugin-scan-main-20261001.
  • Specs: specs/endor-plugin-scans.md is rewritten around the remaining behavior. Stale Endor-judge text is removed from specs/security-consumer-model-policy.md, specs/deploy.md and docs/security-audits.md.

Kept or added on purpose

  • Container egress firewall, drop to the unprivileged user, npm/Yarn shims that strip credentials and disable scripts, .npmrc rejection, the fresh Git snapshot, the reachable-function filter and the bounded summary.
  • scripts/security/endor/fixtures/run.sh and probe_server.py: the real-container isolation proof above. This PR adds the non-root check, the egress probe and a fail-fast for a dead probe registry. The spec says to run it before changing the image, npm, Yarn, scan.sh or the egress guard.

Known tradeoff, not changed here: ClawScan still waits for Endor (up to 20 minutes) before judging. That order made sense when the judge consumed Endor's result. Running them in parallel is a reasonable follow-up, but it changes how failures and cleanup are ordered.

Local checks

  • Affected suites: run-endor-plugin-scan, endor/scan, run-codex-scan-worker-clawscan, run-codex-scan-worker and deploy-test-workflow. 144 passed.
  • bun run ci:static, tsrs --noEmit and bun run build passed.
  • Full ci:unit locally: only load-related subprocess timeouts. Those files pass when run alone. One of them (clawscan-diagnostic-fixed-registry) fails the same way on unmodified main.
  • CI on the previous head passed every GitHub check. The Vercel preview fails on every recent PR, not just this one, while main deploys fine.
Part Files +LOC -LOC
Source, scanner scripts and package.json 6 +102 -601
Tests and fixtures 7 +328 -646
Specs and docs 4 +116 -197
CI workflows 2 +1 -19
Total 19 +547 -1463

Endor stays report-only and now covers every code-plugin release, official
and community. Skills and bundle plugins remain out of scope.

- Remove the unused Endor-to-judge mode, its custom ClawScan profile and the
  CODEX_SECURITY_SCAN_ENDOR_JUDGE_ENABLED flag.
- Replace the CODEX_SECURITY_SCAN_ENDOR_PACKAGES selector with a code-plugin
  family check behind the existing master switch.
- Run the scanner with `docker run --rm` and force-remove it on failure,
  replacing the create/inspect/label/late-create cleanup protocol.
- Drop the local batch script, dry-run mode, unreferenced fixture harness,
  stale deploy-test branch exception and duplicate report validation.
- Rewrite the Endor spec around the remaining behavior.
@vercel

vercel Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
clawhub Error Error Nov 6, 2026 2:16am UTC

Request Review

@clawsweeper

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

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 3, 2026
@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR enables report-only Endor scans for community code plugins and removes cohort selection, judge integration, and supporting tooling.

Example: Scan @acme/community-plugin 1.0.0 with Endor enabled.

  • Before: Production skips Endor because the plugin is outside the official cohort.
  • After: Endor runs and saves a release report without supplying findings to the moderation judge.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The runtime isolation evidence materially improves this PR, and source review found no discrete defect; incomplete final-effect proof and unresolved tenant capacity prevent a merge-ready assessment.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Community code-plugin releases lack the dependency reachability reports available to official plugins.
Reason: The maintainer-authored PR establishes direction, reuses existing report surfaces, and removes unused alternate behavior without changing the stored result contract.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep this maintainer-authored PR open: current main still limits Production Endor scans to official plugins, and no concrete introduced correctness bug was found.

Priority: P2
Reviewed head: 295aef01d50dad26963b7053cda7c5820d994b3a

Before merge

  • Add real behavior proof - Authority-chain proof required: the supplied pinned-image fixture exercises real npm/Yarn credential stripping, suppressed dependency scripts, unprivileged execution, and blocked private-network connections, including a negative control; real runEndorPluginScan output also covers timeout and scanner-failure cleanup. The earlier isolation rank-up is substantially addressed. A successful credentialed community scan persisted to the intended release, and excluded bundle/skill jobs producing no Endor effect through the production owner, remain supported only by function output or mocked integration tests. Supply redacted logs or terminal output for those cases, including transition from the current Production settings; redact credentials, IPs, and non-public endpoints. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Resolve security review attention item - Real resolver and network isolation checks support the retained controls, but the expanded credentialed boundary still needs complete final-effect verification.
  • Resolve merge risk - The Endor tenant owner must confirm project quota and licence capacity, or disable the existing Production master switch before merging, because community releases will immediately become eligible for persistent saved scans.

Findings

None.

Tests

  • Missing end-to-end proof: Show the candidate worker completing and saving one credentialed community release report, with excluded bundle/skill jobs causing no Endor I/O and the existing enabled/disabled settings respected; mocked processJob tests do not establish those final effects.
Agent review details

How this fits together

The security worker consumes claimed release jobs and verified artifacts, runs isolated dependency analysis, and submits bounded Endor summaries alongside the independent moderation verdict.

flowchart TD
  A[Claimed release job] --> B[Verified artifact workspace]
  B --> C[Code plugin eligibility]
  C --> D[Isolated Endor container]
  B --> E[ClawScan judge]
  D --> F[Release completion]
  E --> F
  F --> G[Audit report and moderation]
Loading

Technical review

Best possible solution:

Use the existing worker and saved-result contract for report-only community scans, with activation held until tenant capacity is confirmed.

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

This is an intentional rollout expansion; current-main workflow and eligibility source verify the existing official-only Production boundary.

Is this the best way to solve the issue?

Best-fix verdict: the existing worker is the right owner, and removing the unused judge branch is reasonable under the maintainer-authored direction; retaining only a wider cohort would be smaller but would preserve the parallel mode this PR intentionally retires.

AGENTS.md: found and applied where relevant.

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

Merge-risk options

Maintainer options:

  1. Hold activation (recommended)
    The tenant owner disables the existing Production Endor master switch before merge and restores it after capacity and runtime verification are complete.
  2. Confirm immediate activation capacity
    The tenant owner confirms that project quotas and licence terms support community releases before landing with Endor enabled.

Provenance checked

  • Eligibility and saved scans changes intended behavior with a stated reason (3f50674: Saved report-only results reused the existing worker with a controlled rollout selector; 922389d later selected verified official code plugins.)
  • Container lifecycle and symlink defense changes intended behavior with a stated reason (5e8aec5: Unconfirmed cleanup stopped claims and preserved the workspace; the PR explicitly accepts disposable-runner best-effort removal, while the retained artifact materializer rejects tarball links before Endor.)
  • Custom judge profile and local tooling changes intended behavior with a stated reason (5e8aec5: The original integration supported Endor judge evidence, a local tarball runner, and a branch-specific Test deployment; the PR removes these to retain the Production report-only path.)
  • Model policy keeps the original intent (21841f0: The removed generated profile used the reviewed Sol/high/Standard policy; the pinned built-in profile retains that policy for the remaining judge.)

Testing

Proof path: shipped entry point.

Security

Needs attention: Real resolver and network isolation checks support the retained controls, but the expanded credentialed boundary still needs complete final-effect verification.

Evidence

What I checked:

Review metrics

Metric Value Why it matters
Introduced change size +547/-1463 across 19 files The net reduction removes the alternate judge mode, selector, local batch runner, and lifecycle machinery while retaining the real-container isolation fixture.

Labels

Label changes:

  • add merge-risk: 🚨 other: Immediate activation increases persistent Endor project consumption under an unconfirmed tenant quota and licence.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.

Label justifications:

  • P2: This expands advisory dependency reports; it does not repair an urgent moderation or publishing outage.
  • merge-risk: 🚨 security-boundary: Credentialed dependency resolution expands to community artifacts, and container cleanup changes; real resolver isolation evidence is present, while final-effect eligibility proof remains incomplete.
  • merge-risk: 🚨 other: Immediate activation increases persistent Endor project consumption under an unconfirmed tenant quota and licence.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

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-03T15:18:20.833Z sha 19333b3 :: needs real behavior proof before merge. :: none

Reviewed November 3, 2026, 6:14 PM ET / 23:14 UTC (Revision 2).

@jesse-merhi
jesse-merhi marked this pull request as ready for review November 3, 2026 22:24
@jesse-merhi
jesse-merhi requested review from a team and Patrick-Erichsen as code owners November 3, 2026 22:24
Copilot AI balanced review requested due to automatic review settings November 3, 2026 22:24

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.

Keep the manual fixture harness that proves, in the real scanner image,
that npm and Yarn neither leak secrets nor run dependency scripts. Add an
unprivileged-user check and a private-network egress probe, accept the
3-argument scan.sh call, and fail instead of hanging if the probe
registry dies. Correct the spec on late-created containers: they are
never started.
@jesse-merhi jesse-merhi changed the title Run report-only Endor for all code plugins and remove unused Endor machinery Endor: scan all code plugins (report-only) and remove unused Endor code Nov 3, 2026
@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 3, 2026
…code-plugins

# Conflicts:
#	scripts/security/scan-local-plugins.ts
@jesse-merhi
jesse-merhi merged commit 46dbc1f into main Nov 6, 2026
37 of 38 checks passed
@jesse-merhi
jesse-merhi deleted the jesse/endor-simplify-code-plugins branch November 6, 2026 03:01

This branch had an error being deployed

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

Labels

merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants