You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fill node2shell-check#6's missing local evidence adapters. Add explicit npm lock v1/v2/v3 and CycloneDX/SPDX package metadata, bounded ELF32/64 header/program/interpreter inspection, and import-associated Sharp input/block/unblock lexical candidates. All locations are relative to an explicit evidence root, and all adapter rows remain unknown/not_tested; they do not establish deployed library selection, provenance, PIE/libc, effective mitigation or input trust.
Preserve the existing report contract, input-alias/output publication safeguards and standalone distribution. Extend the deterministic builder with src/adapters.py and rebuild/checksum the executable. Advisory ranges, rule snapshot and native affected-range uncertainty are unchanged. Documentation specifies exact formats, parser bounds, limitations and primary format sources.
Validation: 69 local synthetic Python 3.14 tests pass (three platform skips), including ELF class/endian/layout, malformed headers/segments/duplicates, npm link/instance and SBOM observations, source inactivity/candidates, no execution, relative paths, output protection/parity and standalone execution. Build/checksum check, real CLI help, documented synthetic JSON/HTML examples, relative links and git diff --check pass. GitHub Copilot review and exact-head hosted CI are required before merge.
This PR extends the offline Sharp/librsvg evidence checker with explicit local metadata and source adapters. Observations remain separate unknown records and do not establish runtime selection, mitigation or exploitability.
Changes:
Add bounded npm lock, CycloneDX/SPDX, ELF and Sharp source inspection.
Integrate adapter inputs with existing reporting and input-protection safeguards.
Update the standalone build, checksum, synthetic tests, examples and documentation.
File
Description
tools/build.py
Include adapters in the standalone build.
test_adapters.py
Add synthetic adapter and report-protection tests.
src/checker.py
Add adapter options and result integration.
src/adapters.py
Implement bounded metadata and source inspection.
sharp_rsvg_rce_check.py
Regenerate the standalone checker with adapters.
SHA256SUMS
Update the executable checksum.
README.md
Document adapter usage, limits and uncertainty.
examples/source.example.js
Add a synthetic Sharp source fixture.
examples/package-lock.example.json
Add a synthetic npm lock fixture.
docs/REFERENCE.md
Specify adapter formats and bounds.
docs/METHODOLOGY.md
Clarify adapter evidence limitations.
docs/IMPLEMENTATION.md
Record adapter implementation and verification requirements.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The new parsers require final human review, with unresolved evidence-loss issues and exact-head hosted CI still unverified.
No open issues 🎉
2 previously missed issues
In code that hasn't changed since last review
Detect npm v1 aliases and preserve Sharp observations
src/adapters.py:128
An npm v1 alias such as dependencies: {"image": {"version": "npm:sharp@0.35.4"}} produces only a no-observation coverage row because neither name comparison matches. Recognize the explicit alias target and retain a separate Sharp observation while keeping its qualified version uncertain. Add a v1 alias regression and rebuild sharp_rsvg_rce_check.py and SHA256SUMS.
Normalize JavaScript line terminators before lexing
src/adapters.py:257
With CR-, U+2028- or U+2029-separated JavaScript, a leading // comment consumes the subsequent Sharp import and call because the lexer recognizes only LF, losing candidate evidence. Normalize JavaScript line terminators before lexing, counting CRLF once, and add regression cases. Rebuild sharp_rsvg_rce_check.py and SHA256SUMS so standalone users receive the same fix.
Addressed both previously missed observations in c10dd1b: npm v1 alias targets retain separate uncertain Sharp observations, and the lexer normalizes CRLF/CR/U+2028/U+2029 before scanning/comments/line counting. Added alias and line-terminator fixtures and rebuilt the standalone checker/checksum; all 70 local tests pass.
Skip PT_NULL entries before ELF segment bounds checks
src/adapters.py:52
The range check rejects valid ELF files when a PT_NULL entry's unused offset or size exceeds the file length, causing the assessment to exit with code 2. Skip PT_NULL entries, whose remaining fields are undefined, while retaining bounds checks for actual segments. Add a regression and regenerate sharp_rsvg_rce_check.py and SHA256SUMS.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The new parsers require final human review, with a confirmed lexer defect unresolved and exact-head hosted CI not independently verified.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Recognize => before fallback to avoid regex false positives
src/adapters.py:254
The => regex case is unreachable because the lexer emits = and > separately. As a result, const pattern = () => /const image = require('sharp'); image(input)/; produces a Sharp call candidate from text entirely inside a regex literal. Recognize => before the single-character fallback, add a regression, and rebuild sharp_rsvg_rce_check.py and its checksum.
Final verification at cf875c7: GitHub Copilot rereview has no retained blocking findings; all three inline threads are resolved. Addressed malformed SBOM types, CycloneDX subject components, npm-v1 aliases, JavaScript line terminators/arrow-return regex opacity, regular-file identity/symlink protections and PT_NULL handling. All 72 local synthetic tests pass (three platform skips), standalone deterministic build/checksum and diff checks pass, and all six Python/OS configurations passed hosted CI on the exact head. Adapter evidence remains unknown/not_tested and primary advisory thresholds/date are unchanged. No real target/native code was run.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fill node2shell-check#6's missing local evidence adapters. Add explicit npm lock v1/v2/v3 and CycloneDX/SPDX package metadata, bounded ELF32/64 header/program/interpreter inspection, and import-associated Sharp input/block/unblock lexical candidates. All locations are relative to an explicit evidence root, and all adapter rows remain unknown/not_tested; they do not establish deployed library selection, provenance, PIE/libc, effective mitigation or input trust.
Preserve the existing report contract, input-alias/output publication safeguards and standalone distribution. Extend the deterministic builder with src/adapters.py and rebuild/checksum the executable. Advisory ranges, rule snapshot and native affected-range uncertainty are unchanged. Documentation specifies exact formats, parser bounds, limitations and primary format sources.
Validation: 69 local synthetic Python 3.14 tests pass (three platform skips), including ELF class/endian/layout, malformed headers/segments/duplicates, npm link/instance and SBOM observations, source inactivity/candidates, no execution, relative paths, output protection/parity and standalone execution. Build/checksum check, real CLI help, documented synthetic JSON/HTML examples, relative links and git diff --check pass. GitHub Copilot review and exact-head hosted CI are required before merge.
Refs CompleteTech-Security/node2shell-check#6