Repository navigation
fix: harden plugin import-boundary guards and remove dead scanner - #117386
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 1, 2026, 9:14 AM ET / 13:14 UTC. ClawSweeper reviewWhat this changesThe branch consolidates plugin import-boundary guard scanning around shared TypeScript-based analysis, recognizes additional module-reference syntax, excludes declared generated bundles from authored-source checks, and deletes an unused architecture-smell scanner. Merge readinessThis PR is still necessary: current main retains the older split guard implementation, while the PR centralizes boundary inventory analysis and covers syntax forms the current visitor does not inspect. No discrete correctness defect was found in the final patch, but this protected Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s script guards scan bundled plugin and core-plugin source files, resolve their module references, and compare the resulting violations against checked-in inventories during CI. These guards protect the boundary between plugin-owned code, the public plugin SDK, and internal core implementation paths. flowchart LR
A[Plugin and core source files] --> B[Source inventory]
B --> C[Module reference analysis]
C --> D[Resolve repository paths]
D --> E[Plugin boundary policy]
E --> F[Baseline comparison]
F --> G[CI diagnostics or clean result]
Decision needed
Why: The patch changes the enforcement path for a plugin trust boundary and carries the repository's protected Before merge
Agent review detailsSecurityNone. PR surfaceTests +361, Other -334. Total +27 across 14 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one shared TypeScript-backed module-reference path for all plugin-boundary guards, retain the targeted hostile-source regressions, and merge only after exact-head CI confirms the inventories and guard contracts remain stable. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main’s shared visitor omits several module-reference forms that the boundary policy is meant to observe, and the PR supplies focused hostile-source cases for those forms. This read-only environment could not run the focused tests because the checkout’s usable TypeScript compiler dependency is unavailable. Is this the best way to solve the issue? Yes, with pending merge proof: consolidating the policy behind the existing shared guard/checker owner is preferable to retaining separate source walkers and scanners. The remaining requirement is exact-head validation of the security-sensitive enforcement path, not a different product direction. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 20ac22f647a4. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles) |
|
Merged via squash.
|
…up-ownership-20260801 * origin/main: fix(gateway): trim audit.list exact-match filter ids (openclaw#110847) fix: harden plugin import-boundary guards and remove dead scanner (openclaw#117386) fix(ci): keep PTY tests observable and wait for completed turns (openclaw#117405) fix(plugins): resolve marketplace aliases without recursive cycles (openclaw#117440) fix: break command recovery import cycle (openclaw#116947) fix: clear offscreen command recovery fix: fence command recovery ownership fix: scope failed command recovery fix(plugins): fail closed on ambiguous uninstall targets (openclaw#117406)
* origin/main: fix(gateway): trim audit.list exact-match filter ids (openclaw#110847) fix: harden plugin import-boundary guards and remove dead scanner (openclaw#117386)
…enclaw#117386) * fix: harden plugin import-boundary enforcement * fix: exclude generated bundles from plugin source guards * fix: make plugin boundary scanner linear and complete
…up-ownership-20260801 * origin/main: fix(gateway): trim audit.list exact-match filter ids (openclaw#110847) fix: harden plugin import-boundary guards and remove dead scanner (openclaw#117386) fix(ci): keep PTY tests observable and wait for completed turns (openclaw#117405) fix(plugins): resolve marketplace aliases without recursive cycles (openclaw#117440) fix: break command recovery import cycle (openclaw#116947) fix: clear offscreen command recovery fix: fence command recovery ownership fix: scope failed command recovery fix(plugins): fail closed on ambiguous uninstall targets (openclaw#117406)
* origin/main: fix(gateway): trim audit.list exact-match filter ids (openclaw#110847) fix: harden plugin import-boundary guards and remove dead scanner (openclaw#117386)
Root cause and architectural owner
Plugin, channel, and SDK import-boundary guards owned separate source walkers and handwritten regex/string-mask scanners. Those diverging owners silently missed valid commented imports, namespace re-exports, dynamic imports with attributes, CommonJS/import-equals, import types, URL references, scoped SDK aliases, and escaped bundled-plugin path spellings.
Consolidate source inclusion and module-reference policy at the existing shared guard owners (
scripts/lib/guard-inventory-utils.mjs,ts-guard-utils.mjs, andextension-import-boundary-checker.mjs). Route the existing plugin/channel/SDK guards through that canonical owner; preserve authored-source inventories, exclusions, baselines, diagnostics, JSON payloads, and exit codes.Security, generated-asset ownership, and performance
require, import-equals/import-types, URL references, and both shipped SDK alias spellings.listGeneratedExtensionAssetSourcesowner, which requires both a real package asset-build hook and an explicitly declared manifest output. Generated browser bundles are checked byplugins:assets:check; their original authored source stays guarded.srccorpus falls from 1,902 lexing candidates to 38 (37 raw + one escaped); only one AST is needed.CodeQL denial-of-service and scanner-completeness repair
Dead-detector removal proof
Remove the orphan
scripts/check-architecture-smells.{mjs,d.mts}, retaining and repurposing its existing mapped test filename for hostile canonical-scanner coverage. Introduction commit600f57c9791e8b8cf1e764ccf265387f65107b25touched only the detector and its self-test. Exhaustive current-tree andgit log -p -Ssearches plus taggedv2026.3.22,v2026.7.1, andv2026.7.2-beta.6histories show no package command, workflow, docs, operator/runtime invocation, or shipped npm-files contract. No baseline, exemption inventory, routing map, or test-selection mapping changed.Exact evidence
aa2a5c96f69a1be639c602649d4aa2e4de8da0a8.tbx_01kyyn4knngswepvkd90qyhq34: exactpnpm build:ci-artifacts→pnpm plugins:assets:checkcreates 10,214,552-byte and 4,939,681-byte declared browser bundles → all three plugin guard modes return clean inventories → the exact hostedvitest.full-core-support-boundarylane passes 113/113 tests across 12 files.pnpm check:changedall pass with the oversized generated bundles still present.gpt-5.6-solautoreview atxhigh: original cleanup clean (0.98); final generated-output/security lifecycle follow-up clean (0.97); final scanner-security follow-up clean (0.98).No migration, schema, config surface, baseline weakening, size-limit increase, or public SDK contract change.