Skip to content

fix(core): treat source, pipes, wrappers, TS runners and node . as executing scripts - #90

Merged
tonibergholm-codento merged 5 commits into
mainfrom
fix/86-executors
Nov 20, 2026
Merged

tonibergholm-codento merged 5 commits into
mainfrom
fix/86-executors

Conversation

@tonibergholm-codento

Copy link
Copy Markdown
Contributor

Install hooks that ran a package file through a shell builtin, a pipe, a path-qualified wrapper, a TypeScript runner or Node's directory entry point rated low even when that file held a payload (#86). The install-scripts rule now treats all of these as executing the file:

  • . ./setup and source setup;
  • cat setup | sh, cat setup |& sh, cat x | sudo sh (operands of stages upstream of an interpreter stage);
  • /usr/bin/env node setup, and a package-local ./bin/env node evil (the local file is scanned and keeps its wrapper role);
  • tsx setup, ts-node setup (with .ts/.mts/.cts resolution);
  • node . and node <dir> (via package.json main, then index.js).

The design follows #89: over-follow for detection, keep the work linear (the directory lookup is cached per directory), stay deterministic. node build.js | tee report.md does not scan the report, because tee sits downstream of the interpreter. AUDIT_REVISION goes to 4.

Proof: 31 new tests in packages/core/test/security-executors.test.ts, each failing before its fix (one is a timing bound). npm test passes (1466 tests, 0 failures, 4 Linux-only skips). Reviewed with sol-loop: 4 rounds with gpt-6.2-sol. Sol verdict: approved.

Closes #86.

Created with Claude Opus 5.5 in Claude Code (T3 Code). A Sonnet 5.5 subagent wrote most of the code.

A lifecycle hook that runs a package file through one of these forms was
rated low instead of critical:

- `.` and `source` are interpreters: their first operand is the script.
- When any stage of a pipeline is an interpreter, the operands of the
  other stages (`cat setup | sh`) are treated as executed files.
- A path-qualified wrapper counts by its basename (`/usr/bin/env node`).
- `tsx` and `ts-node` are interpreters; `.mts` and `.cts` are code
  extensions, and an extension-less operand also tries `.ts`.
- `node .` and `node <dir>` resolve the directory's `package.json` `main`,
  then `index.js`.

Bump AUDIT_REVISION to 4: rule semantics changed, so audits persisted
before this fix must be recomputed.

Closes #86
- Cache the resolved entry file (or the miss) per directory for
  `node <dir>`, so many references to a directory with a huge `main`
  no longer rebuild and hash the candidate paths each time.
- A relative path-qualified command word that names a package file
  (`./bin/env`, `bin/node`) is that file: it is scanned as a command and
  is not mistaken for the wrapper or interpreter it is named after.
  Absolute paths and unresolved relative paths still use the basename.
- In a pipeline, only stages upstream of an interpreter stage have their
  operands followed, so `node build.js | tee report.md` does not scan the
  report. `sudo` is a wrapper, so `cat x | sudo sh` counts, `|&` is a
  pipe, and a newline right after `|` continues the pipeline.
- A directory name with a dot (`node tools.v2`) resolves its entry file.

Refs #86
…ll-scripts

- A relative path-qualified command word that names a package file
  (`./bin/env`) is now both scanned as a file and still treated as the
  wrapper or interpreter it is named after, so `./bin/env node evil`
  scans `evil` as well as `bin/env`. The file is found by exact lookup,
  not the suffix trie.
- A directory entry for a dotted name (`node tools.v2`) no longer hides a
  nested file the suffix lookup finds after a `cd`: both are followed.
- A newline continues a pipeline only after a real pipe operator: an
  escaped `\|` is not one, and `|&` is.

Refs #86
…uation

- A relative path-qualified command word (`./node` after `cd bin`) is
  looked up with the path resolver, so the suffix lookup finds
  `bin/node`. The basename still plays the wrapper or interpreter role.
- Punctuation is trimmed before the wrapper basename checks, so
  `(env node setup)` still reaches `setup`.

Refs #86
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 37e95e37-97e8-4968-abc9-4ca6a37d5008
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T12:18:10.758698Z fb51a8f New commits
🔒 Security Review ✅ Completed 2026-11-20T12:23:17.837575Z fb51a8f New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Sentinel dependency audit — WARN · ✓ ok

145 allow · 5 warn · 0 block · 0 error
provenance: 46 verified · 0 invalid · 104 absent · 0 unknown

package verdict score finding how to fix
esbuild@​0.28.1 warn 62/100 `install.js` combines launch + write + read primitives — partial materialization pattern. Review the finding details; approve with a recorded rationale only if you understand and accept the risk.
fast-uri@​3.1.9 warn 75/100 Network egress: connects to a hardcoded IP address. Confirm the egress is expected for this package's purpose; if not, remove it or pin to a version without it.
isexe@​2.0.0 warn 77/100 `test/basic.js` combines read + launch + write primitives — partial materialization pattern. Review the finding details; approve with a recorded rationale only if you understand and accept the risk.
tsx@​4.22.4 warn 76/100 `dist/index-D9F1FXzN.cjs` combines read + write primitives — partial materialization pattern. Review the finding details; approve with a recorded rationale only if you understand and accept the risk.
undici-types@​7.18.2 warn 64/100 Network egress: imports a raw networking module. Confirm the egress is expected for this package's purpose; if not, remove it or pin to a version without it.

▶ Run sentinel explain <package> <version> for a suggested safe version and a ready waiver.

Sentinel · 150 packages audited · 2026-11-20T12:15:41.524Z · SBOM uploaded as a build artifact

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9e0a3c5c4d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

- A root `setup.js`, `setup.ts` or directory entry no longer hides a
  nested `scripts/setup` found by the suffix lookup after a `cd`: both
  are followed.
- A bare wrapper or interpreter name (`sudo`, `env`, `tsx`, `node`, ...)
  may itself be a package file, so `package/<name>` is scanned when it
  exists, while the word keeps its wrapper or interpreter role. The suffix
  lookup stays limited to path-qualified words.

Refs #86
@tonibergholm-codento
tonibergholm-codento merged commit f588bac into main Nov 20, 2026
7 checks passed
@tonibergholm-codento
tonibergholm-codento deleted the fix/86-executors branch November 20, 2026 13:46
tonibergholm-codento added a commit that referenced this pull request Nov 20, 2026
Bump all seven workspaces, the exact internal pins, ENGINE_VERSION and the
CLI/MCP versions to 0.1.0-alpha.3, and add the release notes. The release
carries the security audit hardening (#84) and the install-script
detection-gap fixes (#89, #90, #91, #92).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Detection gap: install-scripts misses source, pipes, pathed wrappers, TS runners and node .

1 participant