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
{{ message }}
Repository navigation
Implement bounded offline OCI, Docker-save and SBOM inventory - #1
Add optional standalone offline inventory for bounded OCI/Docker-save archives and CycloneDX/SPDX metadata. Verify SHA-256 OCI descriptors and sizes; apply layer whiteouts/replacements in memory; never extract, follow links, execute images/packages or contact registries. Preserve independent image failures and supported siblings. Bound bytes, expansion, paths, members, capture and processing work. Selected metadata links/devices are incomplete; Docker config digests explicitly do not bind layer contents. Emit actual conservative Node2Shell/Sharp/Flowise input profiles or canonical provenance.
Validation: 19 local synthetic tests pass, with hostile archive/whiteout/link/gzip-header/publication cases and actual consumer CLI probes. GitHub Copilot hosted and CLI findings were fixed; the final independent remediation review found no actionable defects on 875ba15. Six exact-head hosted jobs pass; help, diff and checksum validation pass. Supports node2shell-check #12; all assessed exploitability remains not_tested.
Implements the optional offline inventory tool tracked by node2shell-check #12, providing container and SBOM metadata to standalone checkers without becoming a runtime dependency.
Changes:
Adds bounded OCI, Docker-save and SBOM parsing with digest verification, layer processing and provenance.
Adds canonical JSON and Node2Shell, Sharp and Flowise exports with protected output publication.
Adds synthetic tests, cross-platform CI, usage documentation and an example SBOM.
File
Description
test_inventory.py
Adds synthetic parsing, safety, export and publication tests.
SHA256SUMS
Records the Python entry-point checksum.
README.md
Documents usage, supported formats, limits and uncertainty.
oci_runtime_inventory.py
Implements the standalone parser, inventory exports and CLI.
examples/inventory.sbom.json
Provides a synthetic CycloneDX example.
.github/workflows/tests.yml
Runs tests and CLI help across three operating systems and two Python versions.
Validate selected-file ancestors after every layer
oci_runtime_inventory.py:426
A layer containing a symlink app and app/package.json, followed by a layer replacing app with a directory, retains the inaccessible package and reports complete coverage. The final-only ancestor check misses the invalid intermediate state. Validate selected-file ancestors after each layer and reject the image before later layers can hide this condition.
The documented 1 MiB TAR trailing-padding limit is enforced for the outer archive but not for layers. After the layer terminator, this loop accepts zero padding up to the remaining global expanded-byte budget, so a layer with several MiB of padding is marked complete instead of exceeding the advertised limit. Track post-terminator bytes here and reject padding beyond 1 MiB for both plain and gzip layers.
Validate schemaVersion for OCI indexes
oci_runtime_inventory.py:304
Root and nested OCI indexes never validate schemaVersion, unlike image manifests below. An index.json with a missing or unsupported schema version is still traversed and can produce complete: true and exit 0 when its descriptors resolve. Validate each index as schema version 2 before processing its descriptors so malformed or unsupported indexes are not reported as fully supported.
Recognize held Node.js packages as installed
oci_runtime_inventory.py:391
Matching only install ok installed omits installed Node.js packages with Status: hold ok installed. A held installation therefore exports an empty coverage placeholder instead of its observed version. Check the installation-state field independently of the desired selection, and add a held-package fixture.
Exclude namespaced CycloneDX components from unscoped matches
oci_runtime_inventory.py:486
CycloneDX uses group for a package namespace, so a component with group: "@vendor" and name: "sharp" represents @vendor/sharp, not the unscoped sharp package. Matching only name emits the wrong package identity into both canonical and checker inventories; the same issue affects the other target names. Validate the CycloneDX group and exclude nonempty namespaces when matching these unscoped targets, while continuing to traverse nested components.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Whiteout ancestor validation and Sharp export filtering need fixes, and file-publication guarantees need automated coverage.
No open issues 🎉
3 previously missed issues
In code that hasn't changed since last review
Reject whiteout-prefixed ancestor components
oci_runtime_inventory.py:228
A layer containing app/.wh.removed and app/.wh.removed/package.json can emit a package observation and be marked complete because the whiteout marker disappears before ancestor validation. OCI reserves .wh.* names, so reject whiteout-prefixed ancestor components while preserving valid same-layer additions under app/removed/. Refresh SHA256SUMS after updating the entry point.
Reject C1 controls in Sharp version evidence
oci_runtime_inventory.py:527
C1 controls (U+0080–U+009F) pass this filter, but Sharp's inventory schema rejects that entire range. A synthetic SBOM with version 0.35.5\u0085 makes --consumer sharp exit 0 and publish a payload that violates the checker's input contract. Reject C1 controls alongside the existing controls, emitting empty version evidence without changing the canonical observation, and refresh SHA256SUMS after updating the entry point.
Add tests for file publication success and interruption
oci_runtime_inventory.py:572
Please add synthetic tests for successful and interrupted file publication. Every --output invocation in test_inventory.py:271–278 is rejected by validate_output, so neither new-file publication via os.link nor forced replacement via os.replace is exercised by the CI matrix; the interruption test only covers stdout. Test both successful paths and inject an interruption at file publication, checking destination preservation before commit and that publication is not retried.
If an OCI index contains a valid image followed by one declaring an unsupported layer format such as zstd, image_plans() raises before any image is processed, leaving images: []. This loses usable sibling-image observations and omits the failed image's incomplete-coverage record. Isolate planning failures per image so supported siblings are scanned and failed images are recorded as incomplete, while retaining the global limits.
Final validation: 875ba15 has SUCCESS hosted checks on all six configured jobs. 19 local tests pass (CopyEscape has one platform skip). GitHub Copilot CLI reviewed the final remediation diff and relevant surrounding code with no actionable defect; earlier hosted/CLI findings have code/tests or explicit documented dispositions. No unresolved inline threads remain. Review did not execute tests; local and hosted validation are separate evidence.
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.
Add optional standalone offline inventory for bounded OCI/Docker-save archives and CycloneDX/SPDX metadata. Verify SHA-256 OCI descriptors and sizes; apply layer whiteouts/replacements in memory; never extract, follow links, execute images/packages or contact registries. Preserve independent image failures and supported siblings. Bound bytes, expansion, paths, members, capture and processing work. Selected metadata links/devices are incomplete; Docker config digests explicitly do not bind layer contents. Emit actual conservative Node2Shell/Sharp/Flowise input profiles or canonical provenance.
Validation: 19 local synthetic tests pass, with hostile archive/whiteout/link/gzip-header/publication cases and actual consumer CLI probes. GitHub Copilot hosted and CLI findings were fixed; the final independent remediation review found no actionable defects on 875ba15. Six exact-head hosted jobs pass; help, diff and checksum validation pass. Supports node2shell-check #12; all assessed exploitability remains not_tested.