Skip to content

fix(security): detect child_process calls through aliases and computed members - #116304

Merged
sallyom merged 5 commits into
openclaw:mainfrom
SunnyShu0925:fix/scanner-child-process-bindings-116255
Aug 3, 2026
Merged

sallyom merged 5 commits into
openclaw:mainfrom
SunnyShu0925:fix/scanner-child-process-bindings-116255

Conversation

@SunnyShu0925

@SunnyShu0925 SunnyShu0925 commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The advisory source scanner's dangerous-exec rule missed child_process execution calls routed through renamed bindings or computed members, so a Skill Workshop proposal (or other scanned source) using one of these forms scanned as clean instead of emitting a critical finding.

  • Problem: The rule pattern only matched bare command names (exec(, cp.spawn() and used a source-wide child_process context gate plus a hard-coded receiver-name allowlist in isBenignMemberExecMatch. It could not associate a renamed binding (launch, run) with its child_process origin, and it suppressed computed exec on any receiver not named cp/childProcess/child_process.
  • Solution: Add a provenance-aware collectChildProcessBindings pass that derives renamed method bindings and whole-namespace bindings ONLY from actual child_process imports/requires; extend the dangerous-exec pattern with a computed-member branch; and make isBenignMemberExecMatch consult namespace-alias provenance instead of a hard-coded receiver allowlist.
  • What changed: src/skills/security/scanner.ts (binding collection, computed-member pattern, provenance-aware benign filter, alias-call attribution in the scan loop); src/skills/security/scanner.test.ts (positive + negative regression cases, including the P1 follow-up below).
  • What did NOT change: The scanner stays regex-based with no AST/parser; the LineRule/SourceRule types and exported scanSource signature are unchanged; existing literal detections (exec(...), cp.spawn(...), cp.exec(...)) and the RegExp.exec benign exclusion are preserved.

Follow-up: scope every computed execution method to a proven receiver (P1)

Review feedback (ClawSweeper, P1) flagged that the original computed-member matcher only provenance-checked exec: an unrelated worker["spawn"]() or bus["execSync"]() was classified as critical whenever child_process appeared anywhere in the file, which could incorrectly fail legitimate Skill Workshop proposals and distort deep-audit output.

This push extends receiver provenance to every watched computed execution method (exec, execSync, spawn, spawnSync, execFile, execFileSync). A computed call is attributed to child_process only when its receiver is a proven namespace alias (or a literal cp/childProcess/child_process); otherwise it stays benign. The long-standing RegExp.exec exclusion is preserved for the direct dot-member exec case. New negative regression cases guard the unrelated spawn/execSync paths.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

Motivation

Operators relying on openclaw security audit --deep code-safety findings, and Skill Workshop proposal scanning, can miss a real shell-execution primitive when a source file binds child_process through an alias (import { spawn as launch }), a destructured CommonJS alias (const { exec: run } = require("child_process")), or a computed member (cp["spawn"]()). Issue #116255 reports three deterministic false negatives on main; a fourth form — a namespace alias used with computed exec (const proc = require("child_process"); proc["exec"](...)) — surfaced during verification as a closely related gap the existing rule still misses. This PR closes all four forms while preserving the scanner's deliberately narrow heuristic model and the existing RegExp.exec exclusion. The P1 follow-up additionally ensures the computed-member matcher does not over-capture unrelated spawn/execSync (and other) computed calls.

Evidence

  • Behavior addressed: All four child_process invocation forms (ESM import alias, CJS destructured alias, computed member, namespace-alias computed exec) now produce one critical dangerous-exec finding; unrelated aliases, unrelated computed spawn/execSync calls, and RegExp.exec-style computed calls still do not.
  • Real environment tested: Linux (pnpm development checkout), Node 22.x, branch fix/scanner-child-process-bindings-116255 at 60e9c982c96, based on origin/main b84e14f2225.
  • Exact steps or command run after this patch:
# 1. Unit tests for the scanner (existing + new regression cases)
node scripts/run-vitest.mjs src/skills/security/scanner.test.ts --run

# 2. Real scanSource() behavior proof across input variants
npx tsx ./evidence-m-exact-head.mjs  # exact-head proof (current head 60e9c982c96)
  • Evidence after fix:
=== EXACT-HEAD scanSource() behavior proof (head 60e9c982c96) ===
[P] CJS namespace alias direct exec                      findings=1 expect=1 -> PASS
[P] ESM namespace import computed spawn                  findings=1 expect=1 -> PASS
[P] ESM namespace import direct exec                     findings=1 expect=1 -> PASS
[P] two aliased calls on one line (per-occurrence)       findings=2 expect=2 -> PASS
[P] literal + aliased call same line                     findings=2 expect=2 -> PASS
[P] renamed method alias                                 findings=1 expect=1 -> PASS
[N] alias from another module                            findings=0 expect=0 -> PASS
[N] RegExp.exec computed call                            findings=0 expect=0 -> PASS
[N] unrelated computed spawn/execSync receivers          findings=0 expect=0 -> PASS
RESULT: 9/9 passed
$ node scripts/run-vitest.mjs src/skills/security/scanner.test.ts --run
 RUN  v4.1.10
 Test Files 1 passed (1)
      Tests 40 passed (40)
   Duration 1.8s
[test] passed 1 Vitest shard

$ npx tsx ./real-behavior-proof.mjs
Positive — proven namespace alias computed spawn
  source: "import cp from \"node:child_process\";\ncp[\"spawn\"](\"node\", [\"server.js\"]);"
  dangerous-exec findings:
    line 2: Shell command execution detected (child_process) | evidence: cp["spawn"]("node", ["server.js"]);

Positive — proven namespace alias computed execSync (NEW method coverage)
  source: "import cp from \"node:child_process\";\ncp[\"execSync\"](\"node server.js\");"
  dangerous-exec findings:
    line 2: Shell command execution detected (child_process) | evidence: cp["execSync"]("node server.js");

Positive — ESM import alias
  source: "import { spawn as launch } from \"node:child_process\";\nlaunch(\"node\", [\"server.js\"]);"
  dangerous-exec findings:
    line 2: Shell command execution detected (child_process) | evidence: launch("node", ["server.js"]);

Negative — unrelated computed spawn when child_process present (P1 fix)
  source: "import { spawn } from \"node:child_process\";\nconst worker = getWorkerPool();\nworker[\"spawn\"](task);"
  dangerous-exec findings: [] (none)

Negative — unrelated computed execSync when child_process present (P1 fix)
  source: "import { spawn } from \"node:child_process\";\nconst bus = getEventBus();\nbus[\"execSync\"](\"echo hi\");"
  dangerous-exec findings: [] (none)

Negative — unrelated computed spawn on literal-named non-alias receiver (P1 fix)
  source: "import cp from \"node:child_process\";\nconst pool = makePool();\npool[\"spawn\"](job);"
  dangerous-exec findings: [] (none)

Negative — computed exec on a RegExp (RegExp.exec preserved)
  source: "import { exec } from \"child_process\";\nconst re = /pattern/;\nre[\"exec\"](value);"
  dangerous-exec findings: [] (none)

Negative — alias not from child_process (provenance scoping)
  source: "import type { ExecOptions } from \"child_process\";\nimport { spawn as launch } from \"./other-module\";\nlaunch(\"node\", [\"server.js\"]);"
  dangerous-exec findings: [] (none)

Input-form behavior matrix (multi-input → output correspondence):

Input form                                                => dangerous-exec finding
exec("node server.js")                                    => line finding (unchanged)
cp.spawn("node", [...])                                   => line finding (unchanged)
cp.exec("node server.js")                                 => line finding (unchanged)
import { spawn as launch } from "node:child_process"      => line finding (NEW)
  launch("node", [...])
const { exec: run } = require("child_process")            => line finding (NEW)
  run("node server.js")
import cp from "node:child_process"; cp["spawn"](...)      => line finding (NEW)
const proc = require("child_process"); proc["exec"](...)   => line finding (NEW)
import cp from "node:child_process"; cp["execSync"](...)   => line finding (NEW method coverage)
import { spawn as launch } from "./other-module"           => NO finding (alias not child_process)
  launch(...)                                               + child_process type-import present
worker["spawn"](task)  (unrelated receiver)               => NO finding (P1 fix — provenance for all methods)
bus["execSync"]("...")  (unrelated receiver)              => NO finding (P1 fix — provenance for all methods)
re["exec"](value)  (RegExp receiver)                      => NO finding (RegExp.exec preserved)
import type { ExecOptions } from "child_process"           => NO finding (bare import, no call)
  • Observed result after fix:
    1. All three issue reproductions now emit exactly one critical dangerous-exec finding on the call line.
    2. The namespace-alias computed exec form (proc["exec"]()), a remaining gap surfaced during verification, now also emits a finding.
    3. Computed execSync (and other watched methods) on a proven namespace alias now emit a finding — method coverage is no longer exec-only.
    4. Unrelated aliases bound from a non-child_process module do NOT fire even when the source-wide child_process gate passes — proving the fix is provenance-scoped, not source-wide token correlation.
    5. Unrelated computed spawn/execSync calls on non-child_process receivers do NOT fire even when child_process is present elsewhere — the P1 over-capture is closed.
    6. Computed exec on a non-child_process receiver (e.g. a RegExp) stays suppressed — the RegExp.exec exclusion is preserved.
    7. All pre-existing scanner tests pass unchanged; new regression cases pass (40 total).
  • What was not tested: A full openclaw security audit --deep end-to-end run on a real plugin tree (the scanner path itself — scanSource() — is exercised directly, which is the exact code path the audit command invokes). Multi-line re-export chains (export { spawn as launch } from "child_process") were not covered; the binding collector handles direct imports/requires only, which matches the issue's "narrow fix" scope.

Root Cause (if applicable)

The dangerous-exec rule was never binding-aware: its pattern matched only bare command names, its requiresContext gate only checked that the string child_process appeared somewhere in the full source, and isBenignMemberExecMatch used a hard-coded receiver allowlist (cp|childProcess|child_process) to exclude RegExp.exec. PR #116222 (merged) later widened per-occurrence reporting but did not touch binding attribution, so aliased and computed forms remained invisible. The original version of this PR then introduced computed-member matching but only provenance-checked exec, leaving other watched methods (spawn, execSync, …) to over-capture any computed call when child_process was merely present — the P1 follow-up in this push closes that by requiring a proven receiver for every watched computed method. Provenance: introduced by the original dangerous-exec rule; made visible by #116222's per-occurrence reporting widening the detection gap.

Regression Test Plan (if applicable)

New cases added to src/skills/security/scanner.test.ts:

  • Positive (in scanRuleCases): ESM import alias, CJS destructured alias, computed member, namespace-alias computed exec, namespace-alias computed execSync (new method coverage).
  • Negative (new it blocks): alias not from child_process (provenance scoping); computed exec on a non-child_process object (RegExp.exec preserved); unrelated computed spawn/execSync calls when child_process is present (P1 fix); unrelated computed spawn on a literal-named non-alias receiver (P1 fix).

User-visible / Behavior Changes

Scanned sources that previously scanned as clean will now correctly emit a critical dangerous-exec finding when they invoke child_process through an import/destructured alias or a computed member on a proven child_process namespace alias. Sources that use unrelated computed spawn/execSync (etc.) calls are NOT flagged. Sources that do not use these forms are unaffected.

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No — the change only tightens an advisory source-scanning heuristic; it does not alter any runtime execution surface.
  • Data access scope changed? No

Human Verification (required)

  • Verified scenarios: All positive forms produce a critical finding via real scanSource(); the negative forms (non-child_process alias, RegExp.exec-style computed call, unrelated computed spawn/execSync on non-child_process receivers) produce none; pre-existing unrelated test failures reproduce identically on plain origin/main, confirming they are pre-existing and unrelated to this change.
  • Edge cases checked: RegExp.exec exclusion preserved; alias-call attribution suppresses member calls (obj.launch( is not flagged); computed receiver lookup correctly resolves proc[ slice; provenance applied to every watched computed method, not only exec.
  • What you did NOT verify: Full openclaw security audit --deep on a real plugin directory tree; multi-line export ... from "child_process" re-export chains.

Compatibility / Migration

  • Backward compatible? Yes — no exported type or function signature changed; the scanner stays regex-based with no AST.
  • Config/env changes? No
  • Migration needed? No

Best-fix Verdict

  • Best fix: Yes. A narrow provenance-aware binding pass is the right fit: it preserves the scanner's low-complexity heuristic model, scopes attribution to actual child_process imports/requires (avoiding source-wide token-correlation false positives), closes all four false-negative forms, and — per the P1 follow-up — requires a proven receiver for every watched computed execution method so unrelated spawn/execSync computed calls do not over-capture.
  • Refactor needed: No. Introducing a full AST/parser was deliberately avoided to match the existing heuristic model and the issue's "narrow fix" guidance.
  • Alternative considered: A source-wide token rule (any launch( + child_process anywhere) — rejected because it would flag unrelated launch() functions whenever child_process appears elsewhere, the exact false-positive class the issue asks to avoid.

AI Assistance

  • AI-assisted: Yes
  • Co-Authored-By: Maas [email protected]
  • Human confirmed understanding of code changes: Yes
  • AI prompts / session excerpts: Analyzed issue Scanner misses child_process calls through import aliases and computed members #116255; designed a provenance-aware binding collector; iterated the computed-exec receiver lookup against the real scanSource() path; addressed ClawSweeper P1 by extending receiver provenance to all watched computed execution methods and adding negative regression coverage for unrelated computed spawn/execSync.

Risks and Mitigations

  • Highest risk area: False positives if the binding collector over-captures aliases. Mitigation: collectChildProcessBindings only collects from import/require statements whose source string is literally child_process or node:child_process, so an alias bound from another module is never attributed. A negative regression case (import { spawn as launch } from "./other-module") guards this.
  • Computed-member false positives (all methods): The computed branch recognizes ["exec"|"execSync"|"spawn"|... ]( on any receiver, but isBenignMemberExecMatch suppresses it unless the receiver is a proven namespace alias or a literal child_process name — for EVERY watched method, not only exec. This preserves the RegExp.exec exclusion and prevents unrelated worker["spawn"]()/bus["execSync"]() from firing when child_process is merely present. Negative cases (re["exec"](value), worker["spawn"](task), bus["execSync"]("echo hi"), pool["spawn"](job)) guard this.
  • Compatibility: No exported API or runtime execution surface changed; existing literal detections and benign exclusions pass unchanged (pre-existing tests green). Not a breaking change.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels Jul 30, 2026
@clawsweeper

clawsweeper Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 1:36 PM ET / 17:36 UTC.

ClawSweeper review

What this changes

Extends the skill source scanner so dangerous-exec detects child_process calls made through renamed imports, namespace aliases, and computed members without attributing unrelated receivers.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

This PR remains necessary: current main still uses the literal-call-only dangerous-exec rule, while the branch adds provenance-scoped detection for aliased and computed child_process calls. The prior per-occurrence blocker is addressed at the final head, and the PR body supplies exact-head terminal proof; keep it open for the in-progress exact-head CI and normal security-area merge review.

Priority: P2
Reviewed head: 60e9c982c961ed125005f41cdfdef04211b770c3

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, review-responsive scanner repair with direct exact-head behavior proof; broader CI is still completing.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body includes exact-head terminal output from the real exported scanSource() entry point across positive and negative inputs, and the dedicated real-behavior-proof check succeeded.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body includes exact-head terminal output from the real exported scanSource() entry point across positive and negative inputs, and the dedicated real-behavior-proof check succeeded.
Evidence reviewed 6 items Current-main gap: Current main still matches only bare exec/spawn-style calls and gates on a source-wide child_process token, so it cannot attribute renamed local bindings or bracket-member calls.
Proposed owner-boundary repair: The PR-head helper derives method and namespace bindings from direct child_process imports and requires a proven namespace receiver for computed calls, avoiding the earlier source-wide correlation behavior.
Regression coverage: The PR adds positive cases for ESM/CJS aliases and namespace forms plus negatives for unrelated computed receivers and RegExp-style calls; it also verifies two alias calls on one line.
Findings None None.
Security None None.

How this fits together

OpenClaw scans skill and plugin source before presenting Skill Workshop proposals and during deep security audits. Source text enters the shared scanner, which emits critical findings that can fail a proposal or surface code-safety risks to operators.

flowchart LR
  A[Plugin or skill source] --> B[Security source scanner]
  B --> C[Child process binding provenance]
  C --> D[Dangerous execution rule]
  D --> E[Critical scan findings]
  E --> F[Workshop proposal result]
  E --> G[Deep security audit]
Loading

Before merge

  • Resolve merge risk (P1) - This changes a fail-closed advisory scanner used by proposal and deep-audit flows; although the branch adds targeted false-positive coverage, the remaining exact-head CI matrix should finish before merge.
  • Complete next step (P2) - No repair lane is needed: the open PR already owns the bounded bug fix, and the remaining action is final-head CI plus normal security-area review.
Agent review details

Security

None.

PR surface

Source +208, Tests +141. Total +349 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 216 8 +208
Tests 1 141 0 +141
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 357 8 +349

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #116255
Summary: This PR is the active candidate fix for the canonical scanner false-negative report; the earlier merged per-occurrence PR is related but addresses a distinct omission mode.

Members:

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

Merge-risk options

Maintainer options:

  1. Wait for final-head scanner validation (recommended)
    Merge after the running exact-head CI confirms that the security scanner remains compatible with the wider codebase.
  2. Accept the bounded heuristic risk
    Maintainers may merge on the supplied direct scanner proof if the remaining CI delay is non-actionable, accepting the regex scanner's intentionally narrow import/require scope.

Technical review

Best possible solution:

Merge the provenance-scoped scanner repair once the final-head CI is green, retaining the focused positive and negative regression cases as the contract for this regex-based scanner.

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

Yes — current main's literal-call pattern and source-wide context gate leave the reported alias and computed-member forms unmatched; the PR body also provides exact-head terminal results for the repaired cases.

Is this the best way to solve the issue?

Yes — collecting only direct child_process import/require provenance at the scanner boundary is a narrower, more maintainable repair than broad source-token matching or adding an AST dependency to this heuristic scanner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 603321a31569.

Labels

Label justifications:

  • P2: This repairs a deterministic code-safety finding gap that affects audit and proposal results without demonstrating a runtime trust-boundary bypass.
  • merge-risk: 🚨 security-boundary: The patch changes how a security scanner classifies executable-process primitives, so false positives or false negatives can affect security review outcomes.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes exact-head terminal output from the real exported scanSource() entry point across positive and negative inputs, and the dedicated real-behavior-proof check succeeded.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes exact-head terminal output from the real exported scanSource() entry point across positive and negative inputs, and the dedicated real-behavior-proof check succeeded.

Evidence

What I checked:

  • Current-main gap: Current main still matches only bare exec/spawn-style calls and gates on a source-wide child_process token, so it cannot attribute renamed local bindings or bracket-member calls. (src/skills/security/scanner.ts:171, 74f3ec1223ee)
  • Proposed owner-boundary repair: The PR-head helper derives method and namespace bindings from direct child_process imports and requires a proven namespace receiver for computed calls, avoiding the earlier source-wide correlation behavior. (src/skills/security/scanner.ts:314, 60e9c982c961)
  • Regression coverage: The PR adds positive cases for ESM/CJS aliases and namespace forms plus negatives for unrelated computed receivers and RegExp-style calls; it also verifies two alias calls on one line. (src/skills/security/scanner.test.ts:287, 60e9c982c961)
  • Real consumers: The shared scanner feeds both Skill Workshop proposal scanning and the deep security-audit collector, so this is a scanner correctness repair rather than an isolated test-only change. (src/skills/workshop/proposal-scan.ts:11, 74f3ec1223ee)
  • Feature provenance: The recent scanner work that established per-occurrence reporting is commit 2899323fe3e940a9c738a797b190a3616c136848, authored by Vincent Koc; this branch builds on that same scanner surface rather than duplicating a separate scanner. (src/skills/security/scanner.ts:171, 2899323fe3e9)
  • Exact-head proof and CI state: The supplied PR body records a terminal proof against scanSource() at head 60e9c982c961ed125005f41cdfdef04211b770c3, including positive and negative cases; GitHub context shows the dedicated real-behavior proof check succeeded while the broader exact-head CI matrix is still running. (60e9c982c961)

Likely related people:

  • vincentkoc: Authored the merged scanner change that introduced current per-occurrence reporting and output bounds on this same rule surface. (role: recent area contributor; confidence: high; commits: 2899323fe3e9; files: src/skills/security/scanner.ts, src/skills/security/scanner.test.ts)
  • Shakker: Authored the earlier Skill Workshop security-scanning work whose proposal path consumes this scanner. (role: feature introducer; confidence: medium; commits: 131e66292474; files: src/skills/workshop/proposal-scan.ts, src/skills/security/scanner.ts)

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 (6 earlier review cycles)
  • reviewed 2026-07-30T08:18:39.627Z sha 82de7d07f1654eabfb35e3d10b1a5f6171d26a5b :: needs maintainer review before merge. :: none
  • reviewed 2026-07-30T08:32:08.013Z sha 1ca58edb86e5fdbe0b6987769dfd38506ca8d24c :: needs maintainer review before merge. :: none
  • reviewed 2026-07-30T08:56:43.536Z sha 14923115b96b166f6339d859a4128c892908c819 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-02T08:52:52.858Z sha 14923115b96b166f6339d859a4128c892908c819 :: needs changes before merge. :: [P1] Scope every computed execution method to a proven receiver
  • reviewed 2026-08-02T14:14:42.366Z sha 486b7b4719bbc5aaac4beaacfab1969990db448c :: found issues before merge. :: [P1] Recognize direct calls through collected namespace aliases | [P2] Collect ESM namespace-import aliases
  • reviewed 2026-08-02T16:49:00.059Z sha ee38574 :: needs real behavior proof before merge. :: [P1] Report every aliased execution call on a line

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jul 30, 2026
@clawsweeper clawsweeper Bot added 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 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 Aug 2, 2026
@SunnyShu0925

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 2, 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 repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

SunnyShu0925 and others added 4 commits August 3, 2026 00:40
…mputed members

The advisory source scanner's dangerous-exec rule missed three
child_process invocation forms that each should produce a critical
finding, plus a fourth namespace-alias computed-exec form:

- ESM import alias:    import { spawn as launch } from "node:child_process"; launch(...)
- CJS destructure alias: const { exec: run } = require("child_process"); run(...)
- computed member:     import cp from "node:child_process"; cp["spawn"](...)
- namespace alias computed exec: const proc = require("child_process"); proc["exec"](...)

The rule pattern only matched bare command names and used a source-wide
child_process context gate with a literal receiver-name allowlist in
isBenignMemberExecMatch, so aliased bindings and computed calls on proven
namespace aliases escaped detection.

Add a provenance-aware collectChildProcessBindings pass that derives
renamed method bindings and whole-namespace bindings ONLY from actual
child_process imports/requires (so unrelated aliases such as a locally
imported launch() do not false-positive). Extend the dangerous-exec
pattern with a computed-member branch and make isBenignMemberExecMatch
consult namespace-alias provenance instead of a hard-coded receiver
allowlist, so computed exec on a proven child_process namespace alias
fires while the RegExp.exec exclusion is preserved.

Fixes openclaw#116255

Co-Authored-By: Maas <[email protected]>
Fixes CI oxfmt --check failure on PR openclaw#116304 (oxfmt wrapped a long if
condition across multiple lines). No logic changes.
…ceiver

The dangerous-exec scanner's computed-member matcher accepted any
obj["spawn"]()/obj["execSync"]() call whenever child_process appeared
anywhere in the file, while receiver provenance was checked only for
exec. That turned unrelated APIs into critical findings, which could
incorrectly fail Skill Workshop proposals and distort deep-audit output.

Require a proven child_process namespace receiver for EVERY watched
computed execution method (exec/execSync/spawn/spawnSync/execFile/
execFileSync), preserving the long-standing RegExp.exec exclusion only
for the direct dot-member exec case. Add regression coverage for
unrelated computed spawn/execSync calls and a proven computed execSync
positive.

Addresses ClawSweeper P1 on PR openclaw#116304.
…cted namespace aliases

Address ClawSweeper P1/P2: consult provenance namespaceAliases for direct
dot-member exec calls (e.g. proc.exec for const proc = require(...)) and
collect ESM namespace imports (import * as proc from "node:child_process").

Co-Authored-By: Codex <[email protected]>
@SunnyShu0925
SunnyShu0925 force-pushed the fix/scanner-child-process-bindings-116255 branch from 486b7b4 to ee38574 Compare August 2, 2026 16:44
@SunnyShu0925

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 2, 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 repository_dispatch).
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 added status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 2, 2026
ClawSweeper P1: the alias attribution path emitted only the first proven
child_process alias call per source line, violating the scanner's
per-occurrence reporting. Match all alias call positions and emit a finding
for each (skipping positions the literal pattern already reported), with a
regression test for two calls on one line.

Co-Authored-By: Codex <[email protected]>
@SunnyShu0925

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 2, 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 repository_dispatch).
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 added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 2, 2026
@RomneyDa RomneyDa self-assigned this Aug 3, 2026
@sallyom sallyom self-assigned this Aug 3, 2026
@sallyom

sallyom commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer review: merge as-is.

This PR addresses the exact #116255 reproductions with appropriately scoped positive and negative coverage. Broader scanner provenance handling was considered during review, but that would materially expand this focused regex-based repair. No blocking findings remain.

Reviewed HEAD: 60e9c982c961ed125005f41cdfdef04211b770c3

Required CI and local autoreview are clean.

@sallyom
sallyom merged commit a1a73cf into openclaw:main Aug 3, 2026
127 of 138 checks passed
@sallyom

sallyom commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 3, 2026
* origin/main:
  fix(onboard): keep referenced provider secrets out of plaintext (#118702)
  docs: show canonical agent roster configuration (#118722)
  fix(channels): generate catalog from package manifests (#118097)
  fix(zalouser): distinguish probe timeout from auth failure (#111336)
  improve(ui): cut E2E shard runtime by reusing the bundle (#118697)
  fix(cli): publish completion caches atomically (#118715)
  fix(whatsapp): honor disabled self-chat without widening group access (#118711)
  fix(voice-call): terminate carrier calls after realtime startup failures (#118699)
  fix(slack): isolate GovSlack media trust and delivery (#118695)
  fix(browser): wrap page-controlled action results (#118691)
  fix(security): sanitize JSON-escaped forged content boundaries (#118698)
  test(qa): prove real yielded-child completion and channel delivery (#118707)
  fix(doctor): honor explicit plugin-only migration authority (#118700)
  fix(security): detect child_process calls through aliases and computed members (#116304)
  test(gateway): avoid async facade mock race (#118708)
  fix(gateway): preserve final speech during transcription shutdown (#118693)
  fix(gateway): resume durable outbound delivery retries (#118694)
  fix(plugins): reject external public-artifact hardlinks (#118689)
vincentkoc added a commit that referenced this pull request Aug 3, 2026
* origin/main: (78 commits)
  fix(parallels): recover Windows poll transport failures (#118479)
  fix(channels): deny unauthorized Discord and Telegram binding access (#118704)
  fix(test): bound shared git inventory lookup (#111171)
  fix(onboard): keep referenced provider secrets out of plaintext (#118702)
  docs: show canonical agent roster configuration (#118722)
  fix(channels): generate catalog from package manifests (#118097)
  fix(zalouser): distinguish probe timeout from auth failure (#111336)
  improve(ui): cut E2E shard runtime by reusing the bundle (#118697)
  fix(cli): publish completion caches atomically (#118715)
  fix(whatsapp): honor disabled self-chat without widening group access (#118711)
  fix(voice-call): terminate carrier calls after realtime startup failures (#118699)
  fix(slack): isolate GovSlack media trust and delivery (#118695)
  fix(browser): wrap page-controlled action results (#118691)
  fix(security): sanitize JSON-escaped forged content boundaries (#118698)
  test(qa): prove real yielded-child completion and channel delivery (#118707)
  fix(doctor): honor explicit plugin-only migration authority (#118700)
  fix(security): detect child_process calls through aliases and computed members (#116304)
  test(gateway): avoid async facade mock race (#118708)
  fix(gateway): preserve final speech during transcription shutdown (#118693)
  fix(gateway): resume durable outbound delivery retries (#118694)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 4, 2026
…d members (openclaw#116304)

* [AI] fix(security): detect child_process calls through aliases and computed members

The advisory source scanner's dangerous-exec rule missed three
child_process invocation forms that each should produce a critical
finding, plus a fourth namespace-alias computed-exec form:

- ESM import alias:    import { spawn as launch } from "node:child_process"; launch(...)
- CJS destructure alias: const { exec: run } = require("child_process"); run(...)
- computed member:     import cp from "node:child_process"; cp["spawn"](...)
- namespace alias computed exec: const proc = require("child_process"); proc["exec"](...)

The rule pattern only matched bare command names and used a source-wide
child_process context gate with a literal receiver-name allowlist in
isBenignMemberExecMatch, so aliased bindings and computed calls on proven
namespace aliases escaped detection.

Add a provenance-aware collectChildProcessBindings pass that derives
renamed method bindings and whole-namespace bindings ONLY from actual
child_process imports/requires (so unrelated aliases such as a locally
imported launch() do not false-positive). Extend the dangerous-exec
pattern with a computed-member branch and make isBenignMemberExecMatch
consult namespace-alias provenance instead of a hard-coded receiver
allowlist, so computed exec on a proven child_process namespace alias
fires while the RegExp.exec exclusion is preserved.

Fixes openclaw#116255

Co-Authored-By: Maas <[email protected]>

* style(security): apply oxfmt to scanner.ts

Fixes CI oxfmt --check failure on PR openclaw#116304 (oxfmt wrapped a long if
condition across multiple lines). No logic changes.

* fix(security): scope computed exec methods to proven child_process receiver

The dangerous-exec scanner's computed-member matcher accepted any
obj["spawn"]()/obj["execSync"]() call whenever child_process appeared
anywhere in the file, while receiver provenance was checked only for
exec. That turned unrelated APIs into critical findings, which could
incorrectly fail Skill Workshop proposals and distort deep-audit output.

Require a proven child_process namespace receiver for EVERY watched
computed execution method (exec/execSync/spawn/spawnSync/execFile/
execFileSync), preserving the long-standing RegExp.exec exclusion only
for the direct dot-member exec case. Add regression coverage for
unrelated computed spawn/execSync calls and a proven computed execSync
positive.

Addresses ClawSweeper P1 on PR openclaw#116304.

* [AI] fix(security): recognize direct and computed calls through collected namespace aliases

Address ClawSweeper P1/P2: consult provenance namespaceAliases for direct
dot-member exec calls (e.g. proc.exec for const proc = require(...)) and
collect ESM namespace imports (import * as proc from "node:child_process").

Co-Authored-By: Codex <[email protected]>

* [AI] fix(security): report every proven alias execution call on a line

ClawSweeper P1: the alias attribution path emitted only the first proven
child_process alias call per source line, violating the scanner's
per-occurrence reporting. Match all alias call positions and emit a finding
for each (skipping positions the literal pattern already reported), with a
regression test for two calls on one line.

Co-Authored-By: Codex <[email protected]>

---------

Co-authored-by: Maas <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 4, 2026
* origin/main:
  fix(onboard): keep referenced provider secrets out of plaintext (openclaw#118702)
  docs: show canonical agent roster configuration (openclaw#118722)
  fix(channels): generate catalog from package manifests (openclaw#118097)
  fix(zalouser): distinguish probe timeout from auth failure (openclaw#111336)
  improve(ui): cut E2E shard runtime by reusing the bundle (openclaw#118697)
  fix(cli): publish completion caches atomically (openclaw#118715)
  fix(whatsapp): honor disabled self-chat without widening group access (openclaw#118711)
  fix(voice-call): terminate carrier calls after realtime startup failures (openclaw#118699)
  fix(slack): isolate GovSlack media trust and delivery (openclaw#118695)
  fix(browser): wrap page-controlled action results (openclaw#118691)
  fix(security): sanitize JSON-escaped forged content boundaries (openclaw#118698)
  test(qa): prove real yielded-child completion and channel delivery (openclaw#118707)
  fix(doctor): honor explicit plugin-only migration authority (openclaw#118700)
  fix(security): detect child_process calls through aliases and computed members (openclaw#116304)
  test(gateway): avoid async facade mock race (openclaw#118708)
  fix(gateway): preserve final speech during transcription shutdown (openclaw#118693)
  fix(gateway): resume durable outbound delivery retries (openclaw#118694)
  fix(plugins): reject external public-artifact hardlinks (openclaw#118689)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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.

Scanner misses child_process calls through import aliases and computed members

3 participants