Repository navigation
Inspect bounded NodeVM configuration and run-argument source candidates - #12
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1618874f10
ℹ️ 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".
| runs = {} | ||
| for index in range(len(values) - 4): | ||
| if values[index + 1:index + 4] == [".", "run", "("]: | ||
| shape = "literal_string" if values[index + 4] == "@string" else "dynamic_or_unsupported" |
There was a problem hiding this comment.
Classify the complete first run argument, not just its first token
For a directly assigned NodeVM, sandbox.run('prefix' + request.body.code) is reported as literal_string because only the first token is checked, even though the argument is a dynamic expression. Conversely, actual string literals such as sandbox.run('vm2') are reported as dynamic_or_unsupported because the tokenizer gives those strings special tokens. These incorrect shape labels propagate into JSON, CSV and HTML evidence and can misdirect manual input review despite the separate trust disclaimer. Check the complete first-argument token range and recognize all quoted-string token variants before assigning literal_string.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
🟡 Changes recommended
Run-argument classification and receiver association can produce incorrect source evidence.
3 open issues
What changed in this PR
Adds optional, bounded JS/TS source inspection to the offline vm2 checker, addressing the source-review scope in node2shell-check#11. Source candidates remain separate from version assessments and do not establish runtime configuration, input trust or exploitability.
Changes:
- Adds explicit source selection, NodeVM configuration candidates and lexical run-argument observations.
- Extends report schema to 1.1, documents limitations and protects selected source files from output overwrites.
- Adds synthetic source tests, an example fixture and macOS CI coverage.
| File | Description |
|---|---|
vm2_nesting_check.py |
Adds bounded source scanning, CLI inputs and report fields. |
test_source.py |
Adds synthetic scanner, reporting and input-protection tests. |
SHA256SUMS |
Updates the checker checksum. |
README.md |
Documents source inspection, limits and evidence semantics. |
examples/source.example.js |
Provides a synthetic NodeVM source fixture. |
docs/REFERENCE.md |
Documents source options and schema; corrects relative links. |
docs/IMPLEMENTATION.md |
Records source-extension scope and verification requirements. |
AGENTS.md |
Clarifies the limited meaning of source candidates. |
.github/workflows/tests.yml |
Adds macOS to the test matrix. |
Review effort: Balanced
| raise ValueError("Unbalanced JavaScript delimiters") | ||
| runs = {} | ||
| for index in range(len(values) - 4): | ||
| if values[index + 1:index + 4] == [".", "run", "("]: |
| runs = {} | ||
| for index in range(len(values) - 4): | ||
| if values[index + 1:index + 4] == [".", "run", "("]: | ||
| shape = "literal_string" if values[index + 4] == "@string" else "dynamic_or_unsupported" |
| source_run_argument="not_observed", source_coverage="limited_lexical") | ||
| # Only direct variable assignment and direct calls on that spelling are | ||
| # associated. A lexical association is not a proven object or taint flow. | ||
| receiver = values[index - 2] if index >= 2 and values[index - 1] == "=" else None |

The existing checker accepts operator observations but cannot inspect the JS/TS configuration requested by node2shell-check#11. Add explicit --source/--source-root inputs and bounded lexical vm2 import/alias, NodeVM construction, nesting/require shape and run-argument candidates with relative file/line evidence.
Source observations are separate unknown rows: no version inheritance, runtime precondition, trust/taint or exploitability assertion. Dynamic/spread/computed/duplicate options remain unknown; unsupported syntax, shadowing and templates have explicit limited coverage. Existing source inputs and aliases are protected against forced output. JSON/CSV schema 1.1 and HTML evidence agree; the executable remains standalone. Add macOS to the baseline matrix.
Validation: 29 local synthetic tests pass on Python 3.14, including aliases, nesting off/default/unknown, advisory-specific require forms, constants/dynamic run arguments, unrelated constructors/calls, comments/strings/regex, token and input limits, output parity/protection and standalone-copy execution. CLI help, documented synthetic JSON/HTML commands, checksum and local links, and git diff --check pass. Existing publication/interrupt regressions pass. Advisory thresholds and rule date are unchanged. Exact-head hosted CI is required before merge.
Refs CompleteTech-Security/node2shell-check#11