Repository navigation
Conversation
Codex Review Summary: ❌ FailedThis 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. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
[Medium impact] The sparse-file fix appears safe to merge within the previously accepted scope. SummaryAdds read-only Debian package inspection through CLI and MCP, including control metadata, relationships, file inventory, and typed refusals with partial facts.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["CLI or MCP request"] --> B["Check caller input"]
B --> C["Read stable local file"]
C --> D["Read ar members"]
D --> E["Decode control and data archives"]
E --> F["Read tar entries and control fields"]
F -->|Supported input| G["Evidence and retained summary"]
F -->|Sparse or unreadable input| H["Typed refusal with partial facts"]
Reviews (49) · Last reviewed commit: "fix(deb): refuse GNU sparse tar entries" · Reviewed by Greptile |
…unts DebPackageFormatFailure now extends ParseFailureError, as the architecture guard requires of parser failure classes; its kind, partial and message are unchanged. The advertised-dialect baseline takes the counts the inspect_deb_package input schema adds ($schema in both profiles, and allOf, default, examples, the \/ escape, the unanchored path pattern and untyped nodes in the full profile).
|
44e6f9c addresses the two red CI lanes: |
dpkg-deb only reads the archive; installing with dpkg is what runs the maintainer scripts. Correct the spec so the safety rationale names the right tool.
The provider now maps DebPackageFormatFailure with the shared parseFailureAnalysisError instead of its own instanceof ladder, passing the partial ar/control/data observation as diagnostics. The helper takes that optional diagnostics argument. DebPackageCapacityFailure extends ParseFailureError<"limit"> with the resource and maximum as its limit, and the provider keeps its limit recovery.
Resolve parseFailureAnalysisError: keep main's field parameter and add the optional diagnostics argument after it; the deb provider passes "path".
|
eb62c98 merges current main. The one conflict was |
The CLI acceptance and MCP boundary tests now take the contract from DEB_PACKAGE_TOOL_CONTRACTS instead of the full catalog, as the testing guide asks of focused contract tests.
Coverage was complete with a missing or empty debian-binary, or a control.tar that held no control file. It now needs a known format version and the control file as well as the control and data members, and each gap adds a limitation.
dpkg lists every name of a hardlinked file in md5sums, while tar stores the later names as hardlink entries. The cross-check inventory now takes hardlink paths as well as regular files, so those names are no longer counted missing.
The sync @napi-rs/lzma decoder takes no output bound, so a member whose index could not be read was decoded with no limit and checked only after allocation. decodeXz now refuses such a member, as truncated when the footer is missing and malformed otherwise, before calling the decoder.
md5sums that is not UTF-8 counted as zero listed paths, and a package with no data.tar counted as an empty inventory. The cross-check is now computed only when both were read; otherwise it stays null and a limitation says which input was missing.
…rejects A Version with an empty upstream part or Debian revision (1:, 1:-1, 1.0-) and an Installed-Size past the safe integer range reached DebControl and failed the output schema, so the service lost the report. The parser now records a malformed field issue and leaves the value null.
Main now requires every top-level src unit in UNIT_LAYERS. src/deb is a provider like src/sqlite, and its two type imports of application ports are recorded in the upward-import baseline the same way. The xz spy binding now accepts the string or bytes input XzApi.compressSync takes.
Read ustar name, prefix and linkname fields, and GNU long names, as NUL-terminated UTF-8 without trimming or rewriting backslashes, and keep spaces in md5sums paths. A name that is not UTF-8 is shown with U+FFFD replacements and counted in a limitation, since it may not match md5sums.
Look up control, conffiles, md5sums and maintainer scripts by their normalized root path, so a nested subdir/control or subdir/postinst no longer stands in for the root file.
PAX record lengths count bytes, so walk the extended header bytes and decode each record on its own. A UTF-8 path no longer swallows part of the next record. A path or linkpath record that is not UTF-8 is counted in the same not-UTF-8 limitation as ustar names.
Accept hyphenated architecture qualifiers such as kfreebsd-amd64, and have parseDebianRelationshipField return the alternatives it cannot read. parseControl records each as a malformed issue on its field, so the package reports partial coverage instead of dropping a dependency.
A Debian package refusal now carries the bounded partial report as diagnostics.partial, so control facts, relationships, maintainer-script facts, ar member offsets and file rows read before the failure reach CLI and MCP callers, not just member names and a count.
…tadata Resolve conflicts with the NuGet, Maven/Gradle metadata and Android OTA tools added on main by keeping both registrations in each shared list. docs/index.md takes main's table with the Debian packages link added back after Python packages.
|
Merged current main into this branch to clear the conflicts with the NuGet, Maven/Gradle metadata and Android OTA tools. Every conflict was a shared registration list, and I kept both main's entries and the Debian ones in each: src/cli.ts, src/cli/cliCommandRegistrations.ts, src/composition/capabilityDeclarations.ts, src/composition/capabilityServices.ts, src/contracts/toolContracts.ts, src/contracts/toolFamilies.ts, src/domain/analysisView/analysisView.ts, src/domain/analysisView/analysisViewResult.ts, src/server/createServer.ts, scripts/lib/module-boundaries.mjs, scripts/lib/test-projects.mjs, the two tool contract test lists, and the README tables. docs/index.md takes main's table with the Debian packages link added back after Python packages. No Debian implementation changes in this update. The XZ decoder bound, global PAX size and Homepage userinfo points from the latest review are still open. |
The fa, ko, th, zh-TW and zh guides carried the target table twice. Restore each to upstream and add the single Debian packages row.
A valid control or data zstd member can request a decoder window above the fixed 128 MiB ceiling. Node raises ZSTD_error_frameParameter_windowTooLarge, which the parser reported as malformed. Map it to a DebPackageAllowanceFailure naming the new zstd_window_bytes allowance, matching ZipArtifactReader.
…tadata Resolve licenses/README.md by taking main's table (Ghidra 12.2 rows and widths) and keeping napi-rs-MIT.txt in the recovered npm notices row.
|
Merged current main into this branch again to clear the new conflict. The only conflicted file was licenses/README.md: it now takes main's table with the Ghidra 12.2 rows and keeps napi-rs-MIT.txt in the recovered npm notices row. Typecheck, lint (including module boundaries), the tool family contract test and the Debian tests pass locally on the merged head. |
The plugin archive is produced on Linux x64, where npm ci drops other platforms' optional packages. The packaging step only restored the PTY binaries, so Codex plugin installs on macOS and Windows had no @napi-rs/lzma binding and valid XZ packages failed as unsupported. Derive the platform packages from the locked runtime tree instead: every optional dependency of a runtime package that targets darwin/linux/win32 on x64/arm64 is restored at its locked path with a verified integrity, and the packed archive is checked for each one.
parsePax stored every record's key before PAX_KEYS filtered them, so one extended header of many short records with distinct keys grew an object property per record before any entry limit ran. Records whose key is not one this reader applies are now read and dropped, and parsePax is covered directly in DebPackageParser.test.ts.
Resolve conflicts with the docs regrouping, the UEFI test project and the lzma-purejs runtime dependency. The Debian guide moves under Packages and metadata, and the runtime notices keep both the napi-rs and lzma-purejs entries with the merged lockfile fingerprint.
|
Merged current main into this branch to clear the new conflicts. Main's regrouped docs win in docs/README.md, docs/index.md and the VitePress sidebar, with the Debian guide added under Packages and metadata. The UEFI test project keeps the deb entry. In the license inventory, the runtime notices now carry both the napi-rs XZ packages and lzma-purejs, using the merged lockfile fingerprint. CI is running on the merged head. |
Main removed tracked planning records (docs/specs). Drop this branch's docs/specs index entry and the deb-package-inspection spec, plan and tasks to follow that policy.
The trailing-whitespace alternative of the shared trim expression retried from every position of a long interior whitespace run, so a package Description could take quadratic time. Scan from each end instead and cover a long tab and space run in a test.
|
Merged current main in e70133a. The only conflict was |
parseControl used the first paragraph of the control file, but deb822Paragraphs built a map for every paragraph first. A control file of many small paragraphs could allocate millions of maps within the decompressed-size budget. deb822Paragraphs now takes a paragraph limit and yields string lines lazily, and parseControl stops after the first paragraph.
A tar header whose mode field is not octal was reported as mode 0000, which invents a permission the archive never stated. Report the mode as null and add a malformed issue for the member, so coverage is partial.
Upstream moved the README target table to docs/reference/supported-targets.md, so the Debian packages row now lives there and the README conflicts take main's text.
|
Merged current main in 5760406 to clear the conflict. Main moved the README target table to |
Main split the summary view result schemas out of analysisViewResult.ts into summarySchemas/. Take main's file and move the deb package summary schema into summarySchemas/debPackageSummarySchema.ts, keeping its parent operation, union entry and re-export.
|
Merged current main in 256766a to clear the conflict in |
GNU PAX sparse headers (GNU.sparse.*) rename the following entry to a synthetic GNUSparseFile path and store only mapped segments, so reading it as a regular file reported the wrong name and size and could miss md5sums cross-checks. Old GNU sparse (S) entries can also carry extension blocks their size field does not count. Refuse both as an unsupported format instead of reporting wrong file facts.
Summary
Add
inspect-deb-package/inspect_deb_package: a local, read-only inspection of a Debian.debas typed Evidence. The reader parses the SysV ar container (debian-binary,control.tar.*,data.tar.*), reports control metadata and relationships, inventories data members, and cross-checksmd5sumspaths. It does not install the package or run maintainer scripts.This change adds the runtime dependency
@napi-rs/lzma@1.5.3socontrol.tar.xzanddata.tar.xzcan be decoded in-process. Current Debian/Ubuntu packages ship those members as xz; gzip and zstd already had in-tree decoders, and xz needs a native decoder to inspect those archives under the same size budgets.No tracking issue exists for this change.
Problem and expected behavior
Operators need to inspect a
.debthey already hold without installing it. The existing desktop Debian helper shells out todpkg-debfor capture work and is a different authority; it is not a typed inspect tool.Expected outcome: given a local path, the CLI and MCP tool return Evidence whose
normalized_resultincludes ar members, parsed control fields, relationship alternatives (operators and arch qualifiers), conffiles/md5sums presence, maintainer-script interpreter and byte length, a bounded data inventory, and an md5sums path cross-check. Gzip, zstd, xz, and uncompressed tars succeed. Bad ar magic, truncated members, tar checksum failures, truncated/corrupt/oversized xz, and oversize counts refuse with typed errors and partial observations rather than silent zeros. If the xz native binding cannot load, the refusal is typedunsupported_targetrather than a process crash. Missing optional control fields arenull, not empty strings.Change and scope
New dedicated inspect tool on the existing contract path: domain schema and Debian version/relationship parsers, ar/tar reader, xz decoder via
@napi-rs/lzma, provider, application port/service, composition, CLIregisterContractCommand, MCP evidence handler, analysis-view summary, docs, and catalog wording in authored skill references.The
@napi-rs/lzmapin is exact (1.5.3). License inventory, runtime notices, and the documented MIT-notice gap for that package and its same-release prebuilt family are updated withnpm run licenses:generate/licenses:check.Intentionally not included: bzip2 and lzma (legacy
.lzma) decompression, debsig/dpkg-sig verification, hashing file contents for md5sums, returning maintainer-script text, installing packages, or executing scripts.Contribution scope: this is a local shipped-artifact read. It does not execute the target, inject, mutate bytes, or recover protections. No additional maintainer execution/injection decision is required for that reason.
Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.
Contract and boundary impact
src/deb/DebPackageParser.tsowns ar/tar/control/data facts.src/deb/xzDecoder.tsowns xz inflate, uncompressed-size pre-check, and native-binding load. Consumers (DebPackageProvider,DebPackageService, CLI, MCP,debPackageView) use those parsed fields; they do not re-parse raw ar/tar bytes or reinterpret xz errors. No superseded inspect path was removed. Desktopdpkg-debcapture remains a separate authority.inspect_deb_package, CLIinspect-deb-package, familyartifact, effectevidence. Input schema includespathplus the documented byte/member/entry limits. Catalog JSON is generated in CI; authored skill text names the command..debwithcontrol.tar/.gz/.zst/.xzand the same fordata.tar. bzip2 and lzma are typed unsupported targets. Requires Node zlib gzip and zstd (already in-tree) plus@napi-rs/lzmafor xz. A missing native addon isunsupported_target.createEvidence+completeProviderEvidence; subject digest is the selected file; locations include artifact path and byte range; limitations list the no-install, no-signature, no-script-text, and no-content-hash rules.partial/partial_observation.docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs andskills/; edit authored instructions in.agents/skills/reverse-engineer-anything/and never commit build outputs): authored skill references and docs/index catalog wording updated; generated catalogs not committed. New runtime dependency@napi-rs/lzma@1.5.3(MIT) plus its optional platform packages; third-party notices and the runtime fingerprint are updated.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
Parser, domain, service, filesystem, CLI, and MCP tests use in-code ar+tar fixtures, including xz control members (valid, truncated, oversized) and an unavailable native binding. Executed CLI on those fixtures plus two public
hellopackages (gzip success; xz success). Source-derived: Debian ar/tar/control field shapes. No Hopper/Ghidra/browser provider run.src/domain/deb/debPackage.test.ts,src/deb/DebPackageParser.test.ts,src/deb/xzDecoder.test.ts,src/application/deb/DebPackageService.test.ts,tests/acceptance/debPackageCli.test.ts,tests/boundary/mcp/debPackageMcp.test.ts,tests/boundary/filesystem/debPackage.test.ts, plus registrations in local-path admission, stable parser-failure CLI, local tool contracts, CLI integer arguments, and absolute local path MCP tests.rea inspect-deb-packagewas not a command. After, fixture inspect returns packagehello, epoch/upstream/revision, Depends alternatives with operators and arch restrictions, six maintainer scripts at 17 bytes/bin/sh, and a seven-entry data inventory. Truncated members and non-ar files exit 1 withinvalid_request/invalid_formatand a partial file snapshot. Publichello_2.10-3_amd64.deb(control.tar.xz/data.tar.xz) inspects with exit 0 and coverage complete.demo/deb-package-metadata(commands.log,out.mp4,preview.gif). Representative human and--jsonoutput for the gzip fixture; public gziphello_2.4-3_amd64.deb; truncated and non-ar refusals; successful xz inspect ofhello_2.10-3_amd64.deb.hellopackages that were actually run.Boundary regressions covered: malformed input (bad magic, truncated member, tar checksum, oversize limits), typed unsupported compression, truncated/corrupt/oversized xz, unavailable xz binding, permission/path admission via existing local-path tests, and identity preservation on parser failure (partial snapshot hash). Lifecycle regressions: not applicable (no owned child process or session cleanup).
For evidence-bearing changes:
Validation performed
npx vitest run src/deb/xzDecoder.test.ts src/deb/DebPackageParser.test.ts src/domain/deb/debPackage.test.ts src/application/deb/DebPackageService.test.ts tests/acceptance/debPackageCli.test.ts tests/boundary/mcp/debPackageMcp.test.ts tests/boundary/filesystem/debPackage.test.ts— 7 files, 40 passed.npm run test:focused --those files plustests/acceptance/localPathAdmissionCli.test.ts,tests/acceptance/stableArtifactParserFailureCli.test.ts,tests/acceptance/tools/localToolContracts.test.ts,tests/boundary/cli/cliIntegerArguments.test.ts,tests/boundary/mcp/absoluteLocalPathTools.test.ts— 12 files, 182 passed.npm run check:fast— typecheck and lint passed.npm run format:check— passed (8059 files).npm run metadata:check— passed.npm run docs:check— passed, includinglicenses:checkfingerprint0683afc489101481e2474d7f118bc734409cbcc22b8f62f4158190e82a8184c1.npm run test:changed -- --base upstream/main— 29917 passed, 3 failed, 21 skipped. Failures aresrc/artifacts/NodeSeaArtifactReader.test.ts(post-classification carrier mutation) andsrc/artifacts/pyinstaller/PyInstallerBoundaries.test.ts(cached carrier freshness). They fail in isolation on this tree and are not the Debian reader.npm run check:pr—test:run8 failed, 49798 passed, 295 skipped. Failures:nativeVerifierPreflightOwnership,advertisedDialect,packageCatalogVerification,NodeSeaArtifactReadermalformed-blob mutation,Uf2ArtifactReaderforged region,DenoStandaloneArtifactReadercarrier mutation,inesArtifactheader overwrite,mutationWorkflowempty stderr (PS1unbound). None are the Debian reader.node scripts/rea.mjs inspect-deb-packageon gzip/zstd/xz fixtures (exit 0), truncated and non-ar inputs (exit 1), publichello_2.4-3_amd64.debgzip (exit 0), publichello_2.10-3_amd64.debxz (exit 0). SHA-256 values are incommands.logondemo/deb-package-metadata.Compatibility, safety, and release
@napi-rs/lzma@1.5.3.hellopackages were read as local files.docs/deb-package.md, catalog wording, authored skill references, lockfile, and third-party notices for@napi-rs/lzma. CI remains the owner of generated catalogs andskills/build output.max_control_bytes/max_data_bytesbefore inflate.Author readiness
Human owner: @mvanhorn
Before merge
type(scope): outcome.Demo