feat(artifacts): inspect Debian package control metadata and contents (#10689)

* feat(artifacts): inspect Debian package control metadata and contents

* fix(deb): throw ParseFailureError and record the new tool's schema counts

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).

* docs(deb): say dpkg runs maintainer scripts, not dpkg-deb

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.

* refactor(deb): project format failures through parseFailureAnalysisError

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.

* test(deb): resolve inspect_deb_package from its contract family

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.

* fix(deb): require debian-binary and a control file for complete coverage

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.

* fix(deb): count hardlinks in the md5sums path cross-check

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.

* fix(deb): decode xz only when its index declares a size within the limit

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.

* fix(deb): leave the md5sums cross-check unknown when an input is unread

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.

* fix(deb): refuse Version and Installed-Size values the output schema 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.

* build(deb): declare src/deb as a provider module layer

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.

* fix(deb): keep tar names and link targets as stored

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.

* fix(deb): read control files from the control.tar root only

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.

* fix(deb): read PAX records by byte length

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.

* fix(deb): keep unreadable relationship alternatives as issues

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.

* fix(deb): deliver the whole partial report on a refusal

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.

* fix(deb): decode only the maintainer script interpreter line

interpreterLine now finds the first newline in the script bytes and
decodes only the #! line, so non-UTF-8 bytes later in the script, or a
cut through a multi-byte character at byte 256, no longer hide a valid
interpreter.

* fix(deb): bound unreadable relationship diagnostics per field

parseDebianRelationshipField now counts unreadable alternatives and keeps
only the first, and parseControl records one issue per field with that
count and the first term cut to 120 characters, so a field of many `|`
separators no longer grows the report with its input.

* test(deb): check parser guidance through its owning formatters

Export undecodableTarNamesLimitation and unreadableRelationshipsDetail
from the parser and assert delivered limitations and issue details
through them, so wording edits change one place.

* fix(deb): bound PAX header work before each tar entry

Keep only the path and linkpath PAX keys the reader uses, set in place
rather than copying an accumulated object per header, and refuse more
than eight GNU long name/link or PAX headers before one entry as
malformed, so a run of short PAX headers cannot stall the server.

* fix(deb): apply PAX owner records to the following entry

PAX uid, gid, uname and gname now override the fixed ustar fields,
which can hold shortened or fallback values. A uid or gid that is not a
safe decimal integer falls back to the fixed field.

* fix(deb): keep GNU ar string tables as counted members

A // string-table member is now kept in the ar inventory and counted
against max_ar_members like any other member. As an unknown role it is
listed in extra_member_names, so coverage reports partial.

* fix(deb): honor PAX size records and escaped md5sums names

- A PAX size record overrides the next entry's ustar size field. Reading
  and skipping by the header field reported an empty file and then parsed
  its data as a header, refusing a valid archive.
- GNU md5sum writes a leading backslash and escapes names that contain a
  backslash, newline or carriage return. Those lines were dropped, so the
  cross-check counted listed files as missing; they are now read, and lines
  that are not digest lines are counted in a limitation.

* fix(deb): bound relationship alternatives and read PAX headers faithfully

- Count relationship alternatives across the control file before building
  any, refusing more than a fixed 65,536; a field of '|' separators within
  the control budget could build millions of report objects.
- Refuse a PAX extended header whose record length is unreadable or runs
  past the member, instead of using the fields read so far.
- Keep global (g) PAX values for every later entry and per-file (x) values
  for the next entry only; global values were cleared after the first file.

* refactor(deb): drop an unused import

* chore(mcp): drop the dialect baseline main retired in #10693

* fix(analysis-view): call completeWithinViewCoverage with main's single count

Main dropped its redundant second argument; both arguments were the same
count here.

* test(mcp): record this PR's advertised-schema summary

Add the advertised-schema summary for inspect_deb_package, generated
with npm run verify:advertised-schemas -- --update-summary.

* fix(deb): bound repeated global PAX text and accept xz stream padding

A global PAX path, linkpath, uname or gname is copied into every later
row, so each reuse is now charged to the member byte budget
(max_data_bytes or max_control_bytes) and refused before the row is
added. An empty global PAX value now deletes the earlier global
override, so later entries read their header owner again.

xzUncompressedSize and the footer check skip trailing zero Stream
Padding in 4-byte groups before locating the footer, so valid padded
xz members are no longer reported as truncated.

* fix(deb): trim trailing tar path slashes with a backward scan

The unanchored /\/+$/u retried from every slash, so a PAX path or
md5sums name made of a long slash run and a final non-slash took
quadratic time. logicalTarPath now trims trailing slashes with a
linear charCodeAt scan from the end.

* fix(deb): parse global PAX owner ids once per global record

Global uid and gid values were run through paxId for every later
entry, and the repeated-text budget skips numeric keys, so a long
global owner value was rescanned once per row. Parse them when the
global record is read and reuse the numbers.

* refactor(deb): report coverage with the shared coverage status schema

* refactor(deb): classify provider failures through classifyProviderFailure

* fix(deb): bound resolved ar member names before copying them

GNU ar /N references can repeat one string-table entry without charging
its text to any budget, and every resolved name is copied into the report
and its Evidence. Refuse a BSD or GNU long name above 4096 bytes before it
is read or sliced, so repeated references cannot expand a small table into
large report text.

* test(deb): register the debPackage capability conformance case

debPackage is declared in CAPABILITY_DECLARATIONS but had no entry in
PROVIDER_CAPABILITY_CONFORMANCE, so the conformance suite failed for it.
Name the existing Debian package CLI acceptance test as its case.

* fix(deb): flag repeated control and data members as extra

Only the first debian-binary, control.tar*, and data.tar* member is
read. A later member with the same role was neither decoded nor listed,
so a package with an empty first data.tar and a populated second one
reported complete coverage. Repeated members now land in
extra_member_names with a limitation, which keeps coverage partial.

* refactor(deb): use the shared excerpt and error message owners

The architecture guards from main count a hand-written ellipsis cut in
the relationship issue detail and two inline error-to-message copies.
Use ellipsisExcerpt and errorMessage instead.

* refactor(deb): move DebPackagePort to src/ports/deb

The provider imported its port from the application layer, which needed
an upward allowance in the module-layer baseline. Put the port beside the
other provider ports and drop the allowance.

* fix(deb): record only caller-selected budgets in Evidence

Omitted inspect_deb_package budgets no longer appear in Evidence
parameters as if the caller set them; only supplied fields are kept.

* fix(deb): report fixed reader allowances as limits

The ar member name, tar extension header, and relationship alternatives
allowances stop inspection without showing the input is invalid. Report
them as `limit` parse failures (DebPackageAllowanceFailure) with the
partial report attached, and project them as resource_constraint with a
fixed-allowance recovery instead of invalid_request.

* fix(deb): refuse GNU ar long name references outside the string table

A `/<offset>` reference past the end of the `//` string table, or one
that lands on an empty entry, resolved to an empty member name. The
report then failed debPackageSchema and callers got AnalysisOutputError
with no file identity or partial facts. Check the offset and the
resolved name, and refuse as a malformed DebPackageFormatFailure that
carries the partial report.

* fix(deb): align ar members by stored size and require padding

Advance past each ar member using the stored header size, so a BSD #1/N
extended name with odd length keeps the next header aligned. Refuse an
odd-sized member whose padding byte is missing at end of file instead of
reporting complete coverage for a truncated container.

* fix(deb): trim NUL-terminated header fields in linear time

Trim fixed-width ar and tar header fields at the first NUL with indexOf
instead of a NUL-to-end regex, which retried from every NUL when a
continuation line followed a NUL run. Control-field decimal parsing no
longer applies header NUL trimming.

* fix(deb): skip the tar path prefix on GNU headers

GNU tar headers use the 345-499 region for atime, ctime and sparse
data, not a POSIX path prefix. Only join the prefix when the header
carries the POSIX "ustar\0" magic.

* docs(readme): drop duplicated target tables in five translations

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.

* fix(deb): report oversized Zstandard windows as a fixed allowance

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.

* fix(package): bundle XZ decoder binaries for every plugin host

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.

* fix(deb): keep only applied PAX keys while reading records

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.

* Address review feedback

* Trim deb822 lines with linear scans

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.

* fix(deb): read only the first control paragraph

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.

* fix(deb): report unreadable tar modes as null

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.

* fix(deb): refuse GNU sparse tar entries

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.

* refactor: use shared artifact inspection for Debian packages

* fix(deb): report per-call budget refusals as parameter limits

* Address review feedback

* Address review feedback

* fix(deb): bound xz decoding, inherit global PAX size, and redact Homepage URLs

* fix(deb): bound xz index preflight memory and preserve typed cancellation with partial facts

* fix(deb): bound nested relationship lists, align tar stored-body rule, and scope async parse

* fix(deb): walk actual XZ block boundaries, scan control lines without arrays, and guard XZ close gate

* refactor(deb): avoid throwaway filter arrays in DebPackageParser

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
Co-authored-by: Matt Van Horn <mvanhorn@MacBook-Pro-10.local>
This commit is contained in:
Matt Van Horn
2026-11-26 15:10:02 -08:00
committed by GitHub
parent 14b4d1f7ad
commit 0f5ab1e042
78 changed files with 8736 additions and 141 deletions
@@ -260,6 +260,8 @@ explicit path or endpoint and do not need it.
containers into a separate file with an external codec, then inspect the
result ([kernel modules](https://github.com/morluto/rea/blob/main/docs/kernel-modules.md),
[kernel build config](https://github.com/morluto/rea/blob/main/docs/guides/native/kernel-build-config.md)).
- Debian `.deb`: `inspect_deb_package` for control metadata and archive
inventory. See [Debian packages](references/native-and-artifacts.md#debian-packages).
- CPython `.pyc`: `inspect_python_pyc`; Erlang `.beam`:
`inspect_erlang_beam`; NuGet `.nupkg`: `inspect_nuget_nupkg`; VS Code
`.vsix`: `inspect_vsix_package`
@@ -404,6 +404,20 @@ Preserve artifact SHA-256, the 16-byte header fields, nested code names, and
bytecode SHA-256. Bytecode is not decompiled. A decoded header does not prove
the matching `.py` is present. See [CPython pyc inspection](https://github.com/morluto/rea/blob/main/docs/python-pyc.md).
## Debian packages
Use `inspect_deb_package` for an explicit local `.deb` when the question
concerns ar members, control identity, relationship alternatives, maintainer
script presence, or the data.tar inventory. No `dpkg`, package installation,
or target execution is required. The CLI equivalent is
`inspect-deb-package PATH`. Preserve artifact SHA-256, the debian-binary
version, parsed relationship operators and architecture qualifiers, script
interpreter lines and byte lengths, and md5sums path presence. Script text is
not returned and is never executed. gzip, zstd, xz, and uncompressed members are
decoded; bzip2 and lzma members are unsupported. Package signatures are
not verified. Missing optional fields stay null. See
[Debian package inspection](https://github.com/morluto/rea/blob/main/docs/deb-package.md).
## Erlang BEAM files
Use `inspect_erlang_beam` for an explicit local `FOR1`/`BEAM` file when the
@@ -260,6 +260,8 @@ explicit path or endpoint and do not need it.
containers into a separate file with an external codec, then inspect the
result ([kernel modules](https://github.com/morluto/rea/blob/main/docs/kernel-modules.md),
[kernel build config](https://github.com/morluto/rea/blob/main/docs/guides/native/kernel-build-config.md)).
- Debian `.deb`: `inspect_deb_package` for control metadata and archive
inventory. See [Debian packages](references/native-and-artifacts.md#debian-packages).
- CPython `.pyc`: `inspect_python_pyc`; Erlang `.beam`:
`inspect_erlang_beam`; NuGet `.nupkg`: `inspect_nuget_nupkg`; VS Code
`.vsix`: `inspect_vsix_package`
@@ -404,6 +404,20 @@ Preserve artifact SHA-256, the 16-byte header fields, nested code names, and
bytecode SHA-256. Bytecode is not decompiled. A decoded header does not prove
the matching `.py` is present. See [CPython pyc inspection](https://github.com/morluto/rea/blob/main/docs/python-pyc.md).
## Debian packages
Use `inspect_deb_package` for an explicit local `.deb` when the question
concerns ar members, control identity, relationship alternatives, maintainer
script presence, or the data.tar inventory. No `dpkg`, package installation,
or target execution is required. The CLI equivalent is
`inspect-deb-package PATH`. Preserve artifact SHA-256, the debian-binary
version, parsed relationship operators and architecture qualifiers, script
interpreter lines and byte lengths, and md5sums path presence. Script text is
not returned and is never executed. gzip, zstd, xz, and uncompressed members are
decoded; bzip2 and lzma members are unsupported. Package signatures are
not verified. Missing optional fields stay null. See
[Debian package inspection](https://github.com/morluto/rea/blob/main/docs/deb-package.md).
## Erlang BEAM files
Use `inspect_erlang_beam` for an explicit local `FOR1`/`BEAM` file when the
+4 -2
View File
@@ -29,8 +29,10 @@ as used by EDK II's LZMAF86 handler.
Two locked runtime releases, [`clean-git-ref@2.0.1`](https://github.com/TheSavior/clean-git-ref/tree/bf3c8afc8032bcdc6a53634c18b601dc6df478fb) (declared Apache-2.0) and
[`minimisted@2.0.1`](https://github.com/kt3k/minimisted/tree/95fdfb8d6efb9546c1117854fe3a58105f6332ce) (declared MIT), omit a full license/copyright document in their
published archives and inspected upstream release sources. Their runtime notice
entries preserve the declared license and author metadata and include a clearly
published archives and inspected upstream release sources. [`@napi-rs/lzma@1.5.3`](https://github.com/Brooooooklyn/lzma/tree/d0a45a40f08dec10ac75d84c364d9cfcfa887d06)
and its same-release optional platform packages also omit a license/copyright
document in the published archives and tagged source. Their runtime notice
entries preserve the declared license metadata and include a clearly
labeled standard license text. These are documented upstream notice gaps, not
recovered copyright notices or a claim that attribution has been fully verified.
+5
View File
@@ -533,6 +533,11 @@ export const documentationSections = [
source: "python-packaged-applications.md",
route: "/python-packaged-applications",
},
{
text: "Debian package inspection",
source: "deb-package.md",
route: "/deb-package",
},
{
text: "CPython pyc inspection",
source: "python-pyc.md",
+1
View File
@@ -134,6 +134,7 @@ The [REA website](https://rea.tools/) has worked examples and product pages.
- [Release exposure](release-exposure.md)
- [Model file declarations](model-artifacts.md)
- [Python packaged applications](python-packaged-applications.md)
- [Debian package inspection](deb-package.md)
- [CPython pyc inspection](python-pyc.md)
- [Erlang BEAM files](erlang-beam.md)
- [Godot PCK archives](godot-pck.md)
+86
View File
@@ -0,0 +1,86 @@
# Debian package inspection
`inspect_deb_package` / `inspect-deb-package` reads one selected local `.deb`
without installing it, running maintainer scripts, or contacting a mirror. It
reports the SysV ar container, parsed control identity and relationships, which
maintainer scripts are present, and a bounded data.tar file inventory.
```bash
rea inspect-deb-package /absolute/path/to/hello_2.03-1_all.deb --json
```
The CLI resolves relative paths against the caller's working directory. MCP
requires an absolute filesystem path and preserves that exact selection:
```json
{
"name": "inspect_deb_package",
"arguments": { "path": "/artifacts/hello_2.03-1_all.deb" }
}
```
## Observations
`ar` records the global `!<arch>\n` magic, each member's stored name, role,
size and file offset, and the `debian-binary` format version. Extra members
that are neither `debian-binary`, `control.tar*`, nor `data.tar*` stay in
`extra_member_names`; they are not guessed as control or data. Only the first
`debian-binary`, `control.tar*`, and `data.tar*` member is read; a later member
with the same role is also listed in `extra_member_names`, is not decoded, and
keeps coverage partial.
`control` holds Package, Version (epoch, upstream, revision), Architecture,
Maintainer, Installed-Size, Section, Priority, Homepage, the Description
synopsis, Source, Multi-Arch, and Essential. Relationship fields
Depends, Pre-Depends, Recommends, Suggests, Conflicts, Breaks, Replaces,
Provides, and Enhances are parsed into groups of alternatives with version
operators and architecture qualifiers. Missing optional fields stay `null`,
not empty lists or empty strings.
`conffiles` and `md5sums` report presence and line counts. Maintainer scripts
(`preinst`, `postinst`, `prerm`, `postrm`, `config`, `triggers`) report only
the interpreter line and byte length. Script text is not returned and is never
executed.
`data_entries` inventories data.tar paths with type, mode, size, owner, and
symlink or hardlink target. `md5sums_cross_check` compares listed md5sums
paths to file entries in that inventory; it does not hash file contents.
gzip, Zstandard, xz, and uncompressed control/data members are decoded
in-process. xz uses `@napi-rs/lzma` under the same `max_control_bytes` and
`max_data_bytes` budgets as gzip and zstd. bzip2 and lzma members are
unsupported. Package signatures (debsig/dpkg-sig) are not verified.
Complete Evidence remains the default. `inspect_analysis_view` can project a
`summary` of identity and counts from retained Evidence without reopening the
`.deb`.
## Failed inspection
A file that is not a Debian ar archive, a member whose declared size runs past
EOF, or a tar header whose checksum fails reports `unsupported_target` with
a `failure_kind` of `malformed` or `truncated`. Members and control facts
already parsed stay on the refusal as partial diagnostics.
A bzip2 or lzma control or data member is `unsupported_target`. An xz member
whose native decoder cannot load on this platform is the same refusal. Truncated
or corrupt xz reports `unsupported_target`. Earlier ar members and a successfully
parsed control archive remain available on that refusal.
Caller-selected budgets (`max_file_bytes`, `max_ar_members`,
`max_control_entries`, `max_data_entries`, `max_control_bytes`,
`max_data_bytes`) fail as `resource_constraint` when exceeded and name the
option that may move.
Fixed reader allowances (4096 bytes for one resolved ar member name, 8 PAX
or GNU extension headers before one tar entry, 65,536 relationship
alternatives across the control file) also fail as `resource_constraint`, not
as invalid input, with the partial report attached. No request option raises
them.
## Relationship to other tools
- `inspect_artifact` recognizes a `.deb` and routes it to
`inspect_deb_package` without decoding Debian control or data.tar contents.
- Desktop capture of an installed package through `dpkg-deb` is a different
authority: this reader never launches `dpkg` and never installs the archive.
+12
View File
@@ -732,6 +732,18 @@ The workflow reports the pinned CPython version for the magic, PEP 552 hash or
mtime/size fields, nested function names, and bytecode SHA-256. Bytecode is
not decompiled. See [CPython pyc inspection](../python-pyc.md).
Inspect a local Debian `.deb` without installing it or running maintainer
scripts:
```bash
rea inspect-deb-package /absolute/path/to/hello_2.03-1_all.deb --json
```
The workflow reports the ar members, control identity and parsed
relationships, which maintainer scripts are present, and a bounded data.tar
inventory. gzip, zstd, xz, and uncompressed members are decoded; bzip2 and
lzma are unsupported. See [Debian package inspection](../deb-package.md).
Inspect an Erlang BEAM file without executing bytecode:
```bash
+1
View File
@@ -28,6 +28,7 @@ The table lists what REA returns for each target and which tools or host it requ
| Apple IPS crashes | .ips metadata, threads, images, registers and documented crash classes | Built-in static JSON inspection; [Apple IPS](../apple-ips.md) |
| Linux kernel modules | .modinfo keys, __versions CRCs, this_module presence, and signature trailer | Built-in static ELF inspection; [kernel modules](../kernel-modules.md) |
| Erlang BEAM | IFF chunks, atoms, exports, imports, lambdas and the Code header | Built-in static BEAM inspection; [Erlang BEAM](../erlang-beam.md) |
| Debian packages | ar members, control identity and relationships, maintainer-script presence, data inventory | Built-in static `.deb` inspection; [Debian packages](../deb-package.md) |
| NuGet packages | Package identity, dependency groups, license, repository and ZIP contents | Built-in static .nupkg inspection; [NuGet packages](../guides/managed/nuget-nupkg.md) |
| VS Code extensions | Identity from both manifests, activation, contributes, native/wasm members and ZIP inventory | Built-in static .vsix inspection; [VS Code extensions](../guides/managed/vsix-package.md) |
| OCI image layouts | Layout version, index entries, image config, layers and blob digest verification | Built-in static directory inspection; [OCI image layouts](../guides/artifacts/oci-image-layout.md) |
+4 -3
View File
@@ -13,7 +13,7 @@ upstream texts; they do not change [REA's MIT license](../LICENSE).
| `nativeaot-parser-MIT.txt` | Original Washi notice for derived NativeAOT parser code; source revision is recorded in the parser and the root notices. |
| `dotnet-runtime-MIT.txt` | Original .NET Foundation MIT text from the NativeAOT reference revision `a3b2d40328be0be3f8dd43f0e5cc925b8827b044`. |
| `ghidra-12.2-{LICENSE,NOTICE,DISCLAIMER}.txt` | Unchanged top-level documents from `Ghidra_12.2_build`. The public zip omits NOTICE and DISCLAIMER; those two copies come from the tag. Ghidra is not bundled; these reference copies do not replace its component and GPL support-program notices. The US-government-specific disclaimer applies to Ghidra, not to REA. |
| `cfworker-MIT.txt`, `xterm-MIT.txt` | Original notices missing from their published runtime npm archives, recovered from the releases' upstream Git revisions. They are included in the corresponding runtime entries. |
| `cfworker-MIT.txt`, `xterm-MIT.txt`, `napi-rs-MIT.txt` | Original notices missing from their published runtime npm archives, recovered from upstream Git revisions. They are included in the corresponding runtime entries. |
| `Apache-2.0.txt`, `MIT-template.txt` | Standard license texts for explicitly documented upstream notice gaps. The MIT placeholders are not an attribution to an inferred author or year. |
| `frida-17.23.2-COPYING.txt`, `LGPL-2.0.txt` | Unchanged licensing supplements for the optional Frida dependency: tagged Frida wxWindows notice and GNU Library GPL v2 text. The npm archive and tagged Node binding omit a standalone license/copyright document; these texts do not recover binding or prebuild-component attribution. |
| `MinGW-w64-runtime.txt` | Upstream's combined runtime copyright and license notices, snapshot from v12.0.0, for the statically linked Windows addon. This is a notice snapshot, not a pin of the compiler used in release CI. |
@@ -42,8 +42,9 @@ runtime archive identities and notices are unchanged by this removal.
For releases that omit original documents, the collection uses pinned upstream
texts, embedded source/README license sections, or the same release's parent
notice for the `@lydell/node-pty` prebuilt family. `clean-git-ref@2.0.1` and `minimisted@2.0.1` provide
only license and author metadata: their missing original copyright documents
notice for the `@lydell/node-pty` prebuilt family. `clean-git-ref@2.0.1`,
`minimisted@2.0.1`, and `@napi-rs/lzma@1.5.3` (including its same-release
prebuilt family) omit original copyright documents. These gaps
remain explicitly identified in the runtime texts. Do not describe those
entries as complete recovered attribution.
+43
View File
@@ -0,0 +1,43 @@
MIT License
Copyright (c) 2020-present LongYinan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT License
Copyright (c) 2018 GitHub
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+113 -3
View File
@@ -2,7 +2,7 @@ REA npm dependency inventory
Prepared from the root package-lock.json; refresh this inventory when locked dependencies change.
License identifiers are upstream lockfile declarations, not a legal assessment.
Runtime includes transitive and optional platform packages; development includes build, test and website tooling.
Locked package entries: 933; runtime: 167.
Locked package entries: 955; runtime: 191.
Full runtime copyright/license/NOTICE texts: npm-runtime-notices.txt.
@algolia/abtesting@1.25.0 | development | MIT
@@ -720,11 +720,121 @@ minimatch@11.0.9 | development | BlueOak-1.0.0
Package: https://www.npmjs.com/package/@msgpack/msgpack/v/3.1.3
Archive: https://registry.npmjs.org/@msgpack/msgpack/-/msgpack-3.1.3.tgz
Integrity: sha512-47XIizs9XZXvuJgoaJUIE2lFoID8ugvc0jzSHP+Ptfk8nTbnR8g788wv48N03Kx0UkAv559HWRQ3yzOgzlRNUA==
@napi-rs/lzma@1.5.3 | runtime | MIT
Lockfile path: node_modules/@napi-rs/lzma
Package: https://www.npmjs.com/package/@napi-rs/lzma/v/1.5.3
Archive: https://registry.npmjs.org/@napi-rs/lzma/-/lzma-1.5.3.tgz
Integrity: sha512-QSIzELPyd2A7mcaDiJEWjwzApoAOWq9PVl9xYq+CxzIwstufv48s8aBgOUr0sgbjGmb15aYU88YKNaFaCaOuhQ==
@napi-rs/lzma-android-arm-eabi@1.5.3 | runtime, optional | MIT
Lockfile path: node_modules/@napi-rs/lzma-android-arm-eabi
Package: https://www.npmjs.com/package/@napi-rs/lzma-android-arm-eabi/v/1.5.3
Archive: https://registry.npmjs.org/@napi-rs/lzma-android-arm-eabi/-/lzma-android-arm-eabi-1.5.3.tgz
Integrity: sha512-Jo8Ej9sTXZO+vHVllHPYxcHVoW4dQe30eLx7wk3H786vv2zy/qIIi5KoO6WhK/VsSBhAb13xbIa/vc4maUgp8Q==
@napi-rs/lzma-android-arm64@1.5.3 | runtime, optional | MIT
Lockfile path: node_modules/@napi-rs/lzma-android-arm64
Package: https://www.npmjs.com/package/@napi-rs/lzma-android-arm64/v/1.5.3
Archive: https://registry.npmjs.org/@napi-rs/lzma-android-arm64/-/lzma-android-arm64-1.5.3.tgz
Integrity: sha512-BUEMluJxOJ/9WkZH/IFyyi3viNQGEByodAHDbmJ/k7mVhabGIxjYBea3MmnyTZoIoqZs/ftAKH7jhVCIj+k6mw==
@napi-rs/lzma-darwin-arm64@1.5.3 | runtime, optional | MIT
Lockfile path: node_modules/@napi-rs/lzma-darwin-arm64
Package: https://www.npmjs.com/package/@napi-rs/lzma-darwin-arm64/v/1.5.3
Archive: https://registry.npmjs.org/@napi-rs/lzma-darwin-arm64/-/lzma-darwin-arm64-1.5.3.tgz
Integrity: sha512-ea46AUzmoGqWnrDP8JNea14TCiVMmxWtaD/d5YjRgh1KbL3YfZ9O2BZzfF7DAF+yrVuAQqS52rHveysjnzYlJA==
@napi-rs/lzma-darwin-x64@1.5.3 | runtime, optional | MIT
Lockfile path: node_modules/@napi-rs/lzma-darwin-x64
Package: https://www.npmjs.com/package/@napi-rs/lzma-darwin-x64/v/1.5.3
Archive: https://registry.npmjs.org/@napi-rs/lzma-darwin-x64/-/lzma-darwin-x64-1.5.3.tgz
Integrity: sha512-/vz8UpAe/9fV7JiTrT+lAV9Xk9bK4F28u8JRDNIYdGaT7lXP0r/e7YjDvBuJZ9bJtStW4nn/08q5Q7yfFmsF1Q==
@napi-rs/lzma-freebsd-x64@1.5.3 | runtime, optional | MIT
Lockfile path: node_modules/@napi-rs/lzma-freebsd-x64
Package: https://www.npmjs.com/package/@napi-rs/lzma-freebsd-x64/v/1.5.3
Archive: https://registry.npmjs.org/@napi-rs/lzma-freebsd-x64/-/lzma-freebsd-x64-1.5.3.tgz
Integrity: sha512-gAxemzm8Zk1OaMXihd0L8zeAb/P+71NqhrYnrPVweW3cTXg7XACC+zXQsvENAvHhkroeHCfaMmFupRwfHi+u7A==
@napi-rs/lzma-linux-arm-gnueabihf@1.5.3 | runtime, optional | MIT
Lockfile path: node_modules/@napi-rs/lzma-linux-arm-gnueabihf
Package: https://www.npmjs.com/package/@napi-rs/lzma-linux-arm-gnueabihf/v/1.5.3
Archive: https://registry.npmjs.org/@napi-rs/lzma-linux-arm-gnueabihf/-/lzma-linux-arm-gnueabihf-1.5.3.tgz
Integrity: sha512-T7ZvCSEAKGoYSw7vIwdKgk1ZaYl8V1JLTgWSlGhnYBau23R9qZP79ONiF7FTosXnvR8G9RLe9peVuVGS5GI7ig==
@napi-rs/lzma-linux-arm64-gnu@1.5.3 | runtime, optional | MIT
Lockfile path: node_modules/@napi-rs/lzma-linux-arm64-gnu
Package: https://www.npmjs.com/package/@napi-rs/lzma-linux-arm64-gnu/v/1.5.3
Archive: https://registry.npmjs.org/@napi-rs/lzma-linux-arm64-gnu/-/lzma-linux-arm64-gnu-1.5.3.tgz
Integrity: sha512-fEfgGb/y8jo2X57cTtMQ62XSD57rxDbpSbT38TSq0gSMKg6A/zq3oOxZLRfoCuZkL3cDtuZMi4fAuo6xIkP5eQ==
@napi-rs/lzma-linux-arm64-musl@1.5.3 | runtime, optional | MIT
Lockfile path: node_modules/@napi-rs/lzma-linux-arm64-musl
Package: https://www.npmjs.com/package/@napi-rs/lzma-linux-arm64-musl/v/1.5.3
Archive: https://registry.npmjs.org/@napi-rs/lzma-linux-arm64-musl/-/lzma-linux-arm64-musl-1.5.3.tgz
Integrity: sha512-Phe10HwfNrtM7U2XsVLhJGePWOgx0BVW2/EWUBq1hoPkmKuUTjbrFj8y4XSTGS5eHMWABUtehnkbX+MPnN5sKg==
@napi-rs/lzma-linux-ppc64-gnu@1.5.3 | runtime, optional | MIT
Lockfile path: node_modules/@napi-rs/lzma-linux-ppc64-gnu
Package: https://www.npmjs.com/package/@napi-rs/lzma-linux-ppc64-gnu/v/1.5.3
Archive: https://registry.npmjs.org/@napi-rs/lzma-linux-ppc64-gnu/-/lzma-linux-ppc64-gnu-1.5.3.tgz
Integrity: sha512-rhuUE76jYbXZaR5oXAWqvfXzxoZKaCFM1nTH3yrdmz2Jtog5mnFcmyJ9WjDFmUgzQo062p1WfXWm3FA8SJOwaA==
@napi-rs/lzma-linux-riscv64-gnu@1.5.3 | runtime, optional | MIT
Lockfile path: node_modules/@napi-rs/lzma-linux-riscv64-gnu
Package: https://www.npmjs.com/package/@napi-rs/lzma-linux-riscv64-gnu/v/1.5.3
Archive: https://registry.npmjs.org/@napi-rs/lzma-linux-riscv64-gnu/-/lzma-linux-riscv64-gnu-1.5.3.tgz
Integrity: sha512-ogeKmHMV80J1uGYu5Lg4XVacyQxv9wapsEMEKH6beFtouIpo5wZMod5/zGLNHA+sg0/9HIAQbm/bVFJ5flkiQQ==
@napi-rs/lzma-linux-s390x-gnu@1.5.3 | runtime, optional | MIT
Lockfile path: node_modules/@napi-rs/lzma-linux-s390x-gnu
Package: https://www.npmjs.com/package/@napi-rs/lzma-linux-s390x-gnu/v/1.5.3
Archive: https://registry.npmjs.org/@napi-rs/lzma-linux-s390x-gnu/-/lzma-linux-s390x-gnu-1.5.3.tgz
Integrity: sha512-FvFzkI1zzVUqpX21UQdLZ0efTPxDolaCH1bqIp6k7hMTtx0RNwHJgcrsbGXQisAJ8uLWKRKncwNVL8MzcBVxUg==
@napi-rs/lzma-linux-x64-gnu@1.5.1 | development, optional | MIT
Lockfile path: node_modules/@napi-rs/lzma-linux-x64-gnu
Package: https://www.npmjs.com/package/@napi-rs/lzma-linux-x64-gnu/v/1.5.1
Archive: https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz
Integrity: sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==
@napi-rs/lzma-linux-x64-musl@1.5.3 | runtime, optional | MIT
Lockfile path: node_modules/@napi-rs/lzma-linux-x64-musl
Package: https://www.npmjs.com/package/@napi-rs/lzma-linux-x64-musl/v/1.5.3
Archive: https://registry.npmjs.org/@napi-rs/lzma-linux-x64-musl/-/lzma-linux-x64-musl-1.5.3.tgz
Integrity: sha512-ZBMasmon/mQmwIKNCWDJagq/zq45vvDQzhSijJSBSIgyef8IRvoD9O4H2lq62Lrq3toHxhlMD2D85jwUVr4QQw==
@napi-rs/lzma-wasm32-wasi@1.5.3 | runtime, optional | MIT
Lockfile path: node_modules/@napi-rs/lzma-wasm32-wasi
Package: https://www.npmjs.com/package/@napi-rs/lzma-wasm32-wasi/v/1.5.3
Archive: https://registry.npmjs.org/@napi-rs/lzma-wasm32-wasi/-/lzma-wasm32-wasi-1.5.3.tgz
Integrity: sha512-gJ2YpVByn8xNbSCbOwQhCN9Jc2ZQY0ERx/K3XFDldbyiFXCphbEnciptp3bwqcp+WUJvIvpZxcKP1+6tcUEj1g==
@emnapi/core@2.0.0-beta.3 | runtime, optional | MIT
Lockfile path: node_modules/@napi-rs/lzma-wasm32-wasi/node_modules/@emnapi/core
Package: https://www.npmjs.com/package/@emnapi/core/v/2.0.0-beta.3
Archive: https://registry.npmjs.org/@emnapi/core/-/core-2.0.0-beta.3.tgz
Integrity: sha512-KA+gOBtbifRATmUa/Gpf5C2B2EJ0r4brHUT3XSgACeHREcuiObXH56xd+B3fFsEFbUT04VBEe6MuZiCtMp0tQg==
@emnapi/runtime@2.0.0-beta.3 | runtime, optional | MIT
Lockfile path: node_modules/@napi-rs/lzma-wasm32-wasi/node_modules/@emnapi/runtime
Package: https://www.npmjs.com/package/@emnapi/runtime/v/2.0.0-beta.3
Archive: https://registry.npmjs.org/@emnapi/runtime/-/runtime-2.0.0-beta.3.tgz
Integrity: sha512-ayb/PyyLzpwRyFVxeC0uoEHu59QlB1iWGcGsOpXQcaB/Dc+uGfBmNmpCHp3HmTT0t8lSsMmg3j7+tdJW/TlHjQ==
@emnapi/wasi-threads@2.2.0 | runtime, optional | MIT
Lockfile path: node_modules/@napi-rs/lzma-wasm32-wasi/node_modules/@emnapi/wasi-threads
Package: https://www.npmjs.com/package/@emnapi/wasi-threads/v/2.2.0
Archive: https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-2.2.0.tgz
Integrity: sha512-JP7OYH38Q7+pyTAe14raZHLQIK7BDKbdwji+Xi3pcd/6QkJYQH3SX4wu6EplGrGJWRepoNzedfm0G3B9Z4e9Rw==
@napi-rs/wasm-runtime@1.2.7 | runtime, optional | MIT
Lockfile path: node_modules/@napi-rs/lzma-wasm32-wasi/node_modules/@napi-rs/wasm-runtime
Package: https://www.npmjs.com/package/@napi-rs/wasm-runtime/v/1.2.7
Archive: https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.7.tgz
Integrity: sha512-zJccwplOAbgfZju95IUHazLnx9RAPtPN2YGJXI6UbrgeaR9QfPjGrQL6ERkSAtnVCA4Q+83ApGyaX5zdpCaKkQ==
@napi-rs/lzma-win32-arm64-msvc@1.5.3 | runtime, optional | MIT
Lockfile path: node_modules/@napi-rs/lzma-win32-arm64-msvc
Package: https://www.npmjs.com/package/@napi-rs/lzma-win32-arm64-msvc/v/1.5.3
Archive: https://registry.npmjs.org/@napi-rs/lzma-win32-arm64-msvc/-/lzma-win32-arm64-msvc-1.5.3.tgz
Integrity: sha512-oB9iJluslRc3bZ3upZ7ZD2tJfICX3tjTsqS8jUUWK+d7PpJei/oZ3YklBLNyczmLZ+JXHYZlBbotIeVCaoNGPw==
@napi-rs/lzma-win32-ia32-msvc@1.5.3 | runtime, optional | MIT
Lockfile path: node_modules/@napi-rs/lzma-win32-ia32-msvc
Package: https://www.npmjs.com/package/@napi-rs/lzma-win32-ia32-msvc/v/1.5.3
Archive: https://registry.npmjs.org/@napi-rs/lzma-win32-ia32-msvc/-/lzma-win32-ia32-msvc-1.5.3.tgz
Integrity: sha512-b5HxoRno1C9kS9I9pH9E7uYO9oMEQZ2RuOzAs8+PafoHzcHA5KMzSibNfA//seedILG1w22IS7YfrW4s0+4FvA==
@napi-rs/lzma-win32-x64-msvc@1.5.3 | runtime, optional | MIT
Lockfile path: node_modules/@napi-rs/lzma-win32-x64-msvc
Package: https://www.npmjs.com/package/@napi-rs/lzma-win32-x64-msvc/v/1.5.3
Archive: https://registry.npmjs.org/@napi-rs/lzma-win32-x64-msvc/-/lzma-win32-x64-msvc-1.5.3.tgz
Integrity: sha512-cPH8uIK0aaD9KZ0FTPBBPTIvncNHQ2Si3DNTP2rjPWyDRVV+syT2dWvlmkiklKgnRipXtx4eJ+tYQZhG30/+9w==
@napi-rs/lzma-linux-x64-gnu@1.5.3 | runtime, optional | MIT
Lockfile path: node_modules/@napi-rs/lzma/node_modules/@napi-rs/lzma-linux-x64-gnu
Package: https://www.npmjs.com/package/@napi-rs/lzma-linux-x64-gnu/v/1.5.3
Archive: https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.3.tgz
Integrity: sha512-cqF0sRTngwVgnH0y7OV/5zWKWZomMYY71t3gzjtmJou4oPoWQHjxmO1Jo5E3GqUg2bPk+Fp3DcRw1xLAeKs1cg==
@napi-rs/wasm-runtime@1.2.6 | development, optional | MIT
Lockfile path: node_modules/@napi-rs/wasm-runtime
Package: https://www.npmjs.com/package/@napi-rs/wasm-runtime/v/1.2.6
@@ -1595,7 +1705,7 @@ minimatch@11.0.9 | development | BlueOak-1.0.0
Package: https://www.npmjs.com/package/@turbo/windows-arm64/v/2.11.13
Archive: https://registry.npmjs.org/@turbo/windows-arm64/-/windows-arm64-2.11.13.tgz
Integrity: sha512-YdRHWstBUHWt/eChOEM4f9LT0dPiWK5SNgtV77bLCr3JNke9M5E7metqelNYj+tXe36dH0BZrk2CMnFlWqHKng==
@tybys/wasm-util@0.10.4 | development, optional | MIT
@tybys/wasm-util@0.10.4 | runtime, optional | MIT
Lockfile path: node_modules/@tybys/wasm-util
Package: https://www.npmjs.com/package/@tybys/wasm-util/v/0.10.4
Archive: https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.4.tgz
@@ -4110,7 +4220,7 @@ trim-newlines@3.0.1 | development | MIT
Package: https://www.npmjs.com/package/trim-newlines/v/3.0.1
Archive: https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz
Integrity: sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==
tslib@2.8.1 | development | 0BSD
tslib@2.8.1 | runtime | 0BSD
Lockfile path: node_modules/tslib
Package: https://www.npmjs.com/package/tslib/v/2.8.1
Archive: https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz
+805 -1
View File
@@ -1,7 +1,7 @@
REA third-party npm runtime copyright, license and NOTICE texts
Collected from integrity-verified locked npm archives. Release-specific supplements and upstream notice gaps are identified in their entries.
External engines are separately obtained; see THIRD_PARTY_NOTICES.md.
Runtime dependency fingerprint (SHA-256): cb5422c851ea64bfc8960e7a434f75201bc98d601ed99a56ba1d9aa853fc90b2
Runtime dependency fingerprint (SHA-256): c799e69ef22941770b4c29d98ea9272cf8d98ee81656137dab4491818e6a6098
===== @babel/helper-string-parser@8.1.2 =====
Declared license: MIT
@@ -10533,3 +10533,807 @@ The package manifest declares BSD. The license text below is preserved from the
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
===== @emnapi/core@2.0.0-beta.3 =====
Declared license: MIT
Archive: https://registry.npmjs.org/@emnapi/core/-/core-2.0.0-beta.3.tgz
Integrity: sha512-KA+gOBtbifRATmUa/Gpf5C2B2EJ0r4brHUT3XSgACeHREcuiObXH56xd+B3fFsEFbUT04VBEe6MuZiCtMp0tQg==
Scope: npm runtime dependency, including optional platform packages.
--- package/LICENSE ---
MIT License
Copyright (c) 2021-present Toyobayashi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
===== @emnapi/runtime@2.0.0-beta.3 =====
Declared license: MIT
Archive: https://registry.npmjs.org/@emnapi/runtime/-/runtime-2.0.0-beta.3.tgz
Integrity: sha512-ayb/PyyLzpwRyFVxeC0uoEHu59QlB1iWGcGsOpXQcaB/Dc+uGfBmNmpCHp3HmTT0t8lSsMmg3j7+tdJW/TlHjQ==
Scope: npm runtime dependency, including optional platform packages.
--- package/LICENSE ---
MIT License
Copyright (c) 2021-present Toyobayashi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
===== @emnapi/wasi-threads@2.2.0 =====
Declared license: MIT
Archive: https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-2.2.0.tgz
Integrity: sha512-JP7OYH38Q7+pyTAe14raZHLQIK7BDKbdwji+Xi3pcd/6QkJYQH3SX4wu6EplGrGJWRepoNzedfm0G3B9Z4e9Rw==
Scope: npm runtime dependency, including optional platform packages.
--- package/LICENSE ---
MIT License
Copyright (c) 2021-present Toyobayashi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
===== @napi-rs/lzma@1.5.3 =====
Declared license: MIT
Archive: https://registry.npmjs.org/@napi-rs/lzma/-/lzma-1.5.3.tgz
Integrity: sha512-QSIzELPyd2A7mcaDiJEWjwzApoAOWq9PVl9xYq+CxzIwstufv48s8aBgOUr0sgbjGmb15aYU88YKNaFaCaOuhQ==
Scope: npm runtime dependency, including optional platform packages.
--- Published package metadata and standard license text (upstream omits a full license/copyright document) ---
The published package and tagged v1.5.3 source omit a full license/copyright document. The package declares MIT. No copyright holder or year is inferred.
Tagged source inspected: https://github.com/Brooooooklyn/lzma/tree/d0a45a40f08dec10ac75d84c364d9cfcfa887d06
Declared license: MIT
Standard license text from licenses/MIT-template.txt; this is not a recovered upstream copyright notice.
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
===== @napi-rs/lzma-android-arm-eabi@1.5.3 =====
Declared license: MIT
Archive: https://registry.npmjs.org/@napi-rs/lzma-android-arm-eabi/-/lzma-android-arm-eabi-1.5.3.tgz
Integrity: sha512-Jo8Ej9sTXZO+vHVllHPYxcHVoW4dQe30eLx7wk3H786vv2zy/qIIi5KoO6WhK/VsSBhAb13xbIa/vc4maUgp8Q==
Scope: npm runtime dependency, including optional platform packages.
--- @napi-rs/lzma@1.5.3: published package metadata and standard license text (same-release prebuilt family) ---
The published package and tagged v1.5.3 source omit a full license/copyright document. The package declares MIT. No copyright holder or year is inferred.
Tagged source inspected: https://github.com/Brooooooklyn/lzma/tree/d0a45a40f08dec10ac75d84c364d9cfcfa887d06
Declared license: MIT
Standard license text from licenses/MIT-template.txt; this is not a recovered upstream copyright notice.
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
===== @napi-rs/lzma-android-arm64@1.5.3 =====
Declared license: MIT
Archive: https://registry.npmjs.org/@napi-rs/lzma-android-arm64/-/lzma-android-arm64-1.5.3.tgz
Integrity: sha512-BUEMluJxOJ/9WkZH/IFyyi3viNQGEByodAHDbmJ/k7mVhabGIxjYBea3MmnyTZoIoqZs/ftAKH7jhVCIj+k6mw==
Scope: npm runtime dependency, including optional platform packages.
--- @napi-rs/lzma@1.5.3: published package metadata and standard license text (same-release prebuilt family) ---
The published package and tagged v1.5.3 source omit a full license/copyright document. The package declares MIT. No copyright holder or year is inferred.
Tagged source inspected: https://github.com/Brooooooklyn/lzma/tree/d0a45a40f08dec10ac75d84c364d9cfcfa887d06
Declared license: MIT
Standard license text from licenses/MIT-template.txt; this is not a recovered upstream copyright notice.
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
===== @napi-rs/lzma-darwin-arm64@1.5.3 =====
Declared license: MIT
Archive: https://registry.npmjs.org/@napi-rs/lzma-darwin-arm64/-/lzma-darwin-arm64-1.5.3.tgz
Integrity: sha512-ea46AUzmoGqWnrDP8JNea14TCiVMmxWtaD/d5YjRgh1KbL3YfZ9O2BZzfF7DAF+yrVuAQqS52rHveysjnzYlJA==
Scope: npm runtime dependency, including optional platform packages.
--- @napi-rs/lzma@1.5.3: published package metadata and standard license text (same-release prebuilt family) ---
The published package and tagged v1.5.3 source omit a full license/copyright document. The package declares MIT. No copyright holder or year is inferred.
Tagged source inspected: https://github.com/Brooooooklyn/lzma/tree/d0a45a40f08dec10ac75d84c364d9cfcfa887d06
Declared license: MIT
Standard license text from licenses/MIT-template.txt; this is not a recovered upstream copyright notice.
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
===== @napi-rs/lzma-darwin-x64@1.5.3 =====
Declared license: MIT
Archive: https://registry.npmjs.org/@napi-rs/lzma-darwin-x64/-/lzma-darwin-x64-1.5.3.tgz
Integrity: sha512-/vz8UpAe/9fV7JiTrT+lAV9Xk9bK4F28u8JRDNIYdGaT7lXP0r/e7YjDvBuJZ9bJtStW4nn/08q5Q7yfFmsF1Q==
Scope: npm runtime dependency, including optional platform packages.
--- @napi-rs/lzma@1.5.3: published package metadata and standard license text (same-release prebuilt family) ---
The published package and tagged v1.5.3 source omit a full license/copyright document. The package declares MIT. No copyright holder or year is inferred.
Tagged source inspected: https://github.com/Brooooooklyn/lzma/tree/d0a45a40f08dec10ac75d84c364d9cfcfa887d06
Declared license: MIT
Standard license text from licenses/MIT-template.txt; this is not a recovered upstream copyright notice.
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
===== @napi-rs/lzma-freebsd-x64@1.5.3 =====
Declared license: MIT
Archive: https://registry.npmjs.org/@napi-rs/lzma-freebsd-x64/-/lzma-freebsd-x64-1.5.3.tgz
Integrity: sha512-gAxemzm8Zk1OaMXihd0L8zeAb/P+71NqhrYnrPVweW3cTXg7XACC+zXQsvENAvHhkroeHCfaMmFupRwfHi+u7A==
Scope: npm runtime dependency, including optional platform packages.
--- @napi-rs/lzma@1.5.3: published package metadata and standard license text (same-release prebuilt family) ---
The published package and tagged v1.5.3 source omit a full license/copyright document. The package declares MIT. No copyright holder or year is inferred.
Tagged source inspected: https://github.com/Brooooooklyn/lzma/tree/d0a45a40f08dec10ac75d84c364d9cfcfa887d06
Declared license: MIT
Standard license text from licenses/MIT-template.txt; this is not a recovered upstream copyright notice.
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
===== @napi-rs/lzma-linux-arm-gnueabihf@1.5.3 =====
Declared license: MIT
Archive: https://registry.npmjs.org/@napi-rs/lzma-linux-arm-gnueabihf/-/lzma-linux-arm-gnueabihf-1.5.3.tgz
Integrity: sha512-T7ZvCSEAKGoYSw7vIwdKgk1ZaYl8V1JLTgWSlGhnYBau23R9qZP79ONiF7FTosXnvR8G9RLe9peVuVGS5GI7ig==
Scope: npm runtime dependency, including optional platform packages.
--- @napi-rs/lzma@1.5.3: published package metadata and standard license text (same-release prebuilt family) ---
The published package and tagged v1.5.3 source omit a full license/copyright document. The package declares MIT. No copyright holder or year is inferred.
Tagged source inspected: https://github.com/Brooooooklyn/lzma/tree/d0a45a40f08dec10ac75d84c364d9cfcfa887d06
Declared license: MIT
Standard license text from licenses/MIT-template.txt; this is not a recovered upstream copyright notice.
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
===== @napi-rs/lzma-linux-arm64-gnu@1.5.3 =====
Declared license: MIT
Archive: https://registry.npmjs.org/@napi-rs/lzma-linux-arm64-gnu/-/lzma-linux-arm64-gnu-1.5.3.tgz
Integrity: sha512-fEfgGb/y8jo2X57cTtMQ62XSD57rxDbpSbT38TSq0gSMKg6A/zq3oOxZLRfoCuZkL3cDtuZMi4fAuo6xIkP5eQ==
Scope: npm runtime dependency, including optional platform packages.
--- @napi-rs/lzma@1.5.3: published package metadata and standard license text (same-release prebuilt family) ---
The published package and tagged v1.5.3 source omit a full license/copyright document. The package declares MIT. No copyright holder or year is inferred.
Tagged source inspected: https://github.com/Brooooooklyn/lzma/tree/d0a45a40f08dec10ac75d84c364d9cfcfa887d06
Declared license: MIT
Standard license text from licenses/MIT-template.txt; this is not a recovered upstream copyright notice.
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
===== @napi-rs/lzma-linux-arm64-musl@1.5.3 =====
Declared license: MIT
Archive: https://registry.npmjs.org/@napi-rs/lzma-linux-arm64-musl/-/lzma-linux-arm64-musl-1.5.3.tgz
Integrity: sha512-Phe10HwfNrtM7U2XsVLhJGePWOgx0BVW2/EWUBq1hoPkmKuUTjbrFj8y4XSTGS5eHMWABUtehnkbX+MPnN5sKg==
Scope: npm runtime dependency, including optional platform packages.
--- @napi-rs/lzma@1.5.3: published package metadata and standard license text (same-release prebuilt family) ---
The published package and tagged v1.5.3 source omit a full license/copyright document. The package declares MIT. No copyright holder or year is inferred.
Tagged source inspected: https://github.com/Brooooooklyn/lzma/tree/d0a45a40f08dec10ac75d84c364d9cfcfa887d06
Declared license: MIT
Standard license text from licenses/MIT-template.txt; this is not a recovered upstream copyright notice.
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
===== @napi-rs/lzma-linux-ppc64-gnu@1.5.3 =====
Declared license: MIT
Archive: https://registry.npmjs.org/@napi-rs/lzma-linux-ppc64-gnu/-/lzma-linux-ppc64-gnu-1.5.3.tgz
Integrity: sha512-rhuUE76jYbXZaR5oXAWqvfXzxoZKaCFM1nTH3yrdmz2Jtog5mnFcmyJ9WjDFmUgzQo062p1WfXWm3FA8SJOwaA==
Scope: npm runtime dependency, including optional platform packages.
--- @napi-rs/lzma@1.5.3: published package metadata and standard license text (same-release prebuilt family) ---
The published package and tagged v1.5.3 source omit a full license/copyright document. The package declares MIT. No copyright holder or year is inferred.
Tagged source inspected: https://github.com/Brooooooklyn/lzma/tree/d0a45a40f08dec10ac75d84c364d9cfcfa887d06
Declared license: MIT
Standard license text from licenses/MIT-template.txt; this is not a recovered upstream copyright notice.
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
===== @napi-rs/lzma-linux-riscv64-gnu@1.5.3 =====
Declared license: MIT
Archive: https://registry.npmjs.org/@napi-rs/lzma-linux-riscv64-gnu/-/lzma-linux-riscv64-gnu-1.5.3.tgz
Integrity: sha512-ogeKmHMV80J1uGYu5Lg4XVacyQxv9wapsEMEKH6beFtouIpo5wZMod5/zGLNHA+sg0/9HIAQbm/bVFJ5flkiQQ==
Scope: npm runtime dependency, including optional platform packages.
--- @napi-rs/lzma@1.5.3: published package metadata and standard license text (same-release prebuilt family) ---
The published package and tagged v1.5.3 source omit a full license/copyright document. The package declares MIT. No copyright holder or year is inferred.
Tagged source inspected: https://github.com/Brooooooklyn/lzma/tree/d0a45a40f08dec10ac75d84c364d9cfcfa887d06
Declared license: MIT
Standard license text from licenses/MIT-template.txt; this is not a recovered upstream copyright notice.
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
===== @napi-rs/lzma-linux-s390x-gnu@1.5.3 =====
Declared license: MIT
Archive: https://registry.npmjs.org/@napi-rs/lzma-linux-s390x-gnu/-/lzma-linux-s390x-gnu-1.5.3.tgz
Integrity: sha512-FvFzkI1zzVUqpX21UQdLZ0efTPxDolaCH1bqIp6k7hMTtx0RNwHJgcrsbGXQisAJ8uLWKRKncwNVL8MzcBVxUg==
Scope: npm runtime dependency, including optional platform packages.
--- @napi-rs/lzma@1.5.3: published package metadata and standard license text (same-release prebuilt family) ---
The published package and tagged v1.5.3 source omit a full license/copyright document. The package declares MIT. No copyright holder or year is inferred.
Tagged source inspected: https://github.com/Brooooooklyn/lzma/tree/d0a45a40f08dec10ac75d84c364d9cfcfa887d06
Declared license: MIT
Standard license text from licenses/MIT-template.txt; this is not a recovered upstream copyright notice.
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
===== @napi-rs/lzma-linux-x64-gnu@1.5.3 =====
Declared license: MIT
Archive: https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.3.tgz
Integrity: sha512-cqF0sRTngwVgnH0y7OV/5zWKWZomMYY71t3gzjtmJou4oPoWQHjxmO1Jo5E3GqUg2bPk+Fp3DcRw1xLAeKs1cg==
Scope: npm runtime dependency, including optional platform packages.
--- @napi-rs/lzma@1.5.3: published package metadata and standard license text (same-release prebuilt family) ---
The published package and tagged v1.5.3 source omit a full license/copyright document. The package declares MIT. No copyright holder or year is inferred.
Tagged source inspected: https://github.com/Brooooooklyn/lzma/tree/d0a45a40f08dec10ac75d84c364d9cfcfa887d06
Declared license: MIT
Standard license text from licenses/MIT-template.txt; this is not a recovered upstream copyright notice.
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
===== @napi-rs/lzma-linux-x64-musl@1.5.3 =====
Declared license: MIT
Archive: https://registry.npmjs.org/@napi-rs/lzma-linux-x64-musl/-/lzma-linux-x64-musl-1.5.3.tgz
Integrity: sha512-ZBMasmon/mQmwIKNCWDJagq/zq45vvDQzhSijJSBSIgyef8IRvoD9O4H2lq62Lrq3toHxhlMD2D85jwUVr4QQw==
Scope: npm runtime dependency, including optional platform packages.
--- @napi-rs/lzma@1.5.3: published package metadata and standard license text (same-release prebuilt family) ---
The published package and tagged v1.5.3 source omit a full license/copyright document. The package declares MIT. No copyright holder or year is inferred.
Tagged source inspected: https://github.com/Brooooooklyn/lzma/tree/d0a45a40f08dec10ac75d84c364d9cfcfa887d06
Declared license: MIT
Standard license text from licenses/MIT-template.txt; this is not a recovered upstream copyright notice.
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
===== @napi-rs/lzma-wasm32-wasi@1.5.3 =====
Declared license: MIT
Archive: https://registry.npmjs.org/@napi-rs/lzma-wasm32-wasi/-/lzma-wasm32-wasi-1.5.3.tgz
Integrity: sha512-gJ2YpVByn8xNbSCbOwQhCN9Jc2ZQY0ERx/K3XFDldbyiFXCphbEnciptp3bwqcp+WUJvIvpZxcKP1+6tcUEj1g==
Scope: npm runtime dependency, including optional platform packages.
--- @napi-rs/lzma@1.5.3: published package metadata and standard license text (same-release prebuilt family) ---
The published package and tagged v1.5.3 source omit a full license/copyright document. The package declares MIT. No copyright holder or year is inferred.
Tagged source inspected: https://github.com/Brooooooklyn/lzma/tree/d0a45a40f08dec10ac75d84c364d9cfcfa887d06
Declared license: MIT
Standard license text from licenses/MIT-template.txt; this is not a recovered upstream copyright notice.
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
===== @napi-rs/lzma-win32-arm64-msvc@1.5.3 =====
Declared license: MIT
Archive: https://registry.npmjs.org/@napi-rs/lzma-win32-arm64-msvc/-/lzma-win32-arm64-msvc-1.5.3.tgz
Integrity: sha512-oB9iJluslRc3bZ3upZ7ZD2tJfICX3tjTsqS8jUUWK+d7PpJei/oZ3YklBLNyczmLZ+JXHYZlBbotIeVCaoNGPw==
Scope: npm runtime dependency, including optional platform packages.
--- @napi-rs/lzma@1.5.3: published package metadata and standard license text (same-release prebuilt family) ---
The published package and tagged v1.5.3 source omit a full license/copyright document. The package declares MIT. No copyright holder or year is inferred.
Tagged source inspected: https://github.com/Brooooooklyn/lzma/tree/d0a45a40f08dec10ac75d84c364d9cfcfa887d06
Declared license: MIT
Standard license text from licenses/MIT-template.txt; this is not a recovered upstream copyright notice.
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
===== @napi-rs/lzma-win32-ia32-msvc@1.5.3 =====
Declared license: MIT
Archive: https://registry.npmjs.org/@napi-rs/lzma-win32-ia32-msvc/-/lzma-win32-ia32-msvc-1.5.3.tgz
Integrity: sha512-b5HxoRno1C9kS9I9pH9E7uYO9oMEQZ2RuOzAs8+PafoHzcHA5KMzSibNfA//seedILG1w22IS7YfrW4s0+4FvA==
Scope: npm runtime dependency, including optional platform packages.
--- @napi-rs/lzma@1.5.3: published package metadata and standard license text (same-release prebuilt family) ---
The published package and tagged v1.5.3 source omit a full license/copyright document. The package declares MIT. No copyright holder or year is inferred.
Tagged source inspected: https://github.com/Brooooooklyn/lzma/tree/d0a45a40f08dec10ac75d84c364d9cfcfa887d06
Declared license: MIT
Standard license text from licenses/MIT-template.txt; this is not a recovered upstream copyright notice.
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
===== @napi-rs/lzma-win32-x64-msvc@1.5.3 =====
Declared license: MIT
Archive: https://registry.npmjs.org/@napi-rs/lzma-win32-x64-msvc/-/lzma-win32-x64-msvc-1.5.3.tgz
Integrity: sha512-cPH8uIK0aaD9KZ0FTPBBPTIvncNHQ2Si3DNTP2rjPWyDRVV+syT2dWvlmkiklKgnRipXtx4eJ+tYQZhG30/+9w==
Scope: npm runtime dependency, including optional platform packages.
--- @napi-rs/lzma@1.5.3: published package metadata and standard license text (same-release prebuilt family) ---
The published package and tagged v1.5.3 source omit a full license/copyright document. The package declares MIT. No copyright holder or year is inferred.
Tagged source inspected: https://github.com/Brooooooklyn/lzma/tree/d0a45a40f08dec10ac75d84c364d9cfcfa887d06
Declared license: MIT
Standard license text from licenses/MIT-template.txt; this is not a recovered upstream copyright notice.
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
===== @napi-rs/wasm-runtime@1.2.7 =====
Declared license: MIT
Archive: https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.7.tgz
Integrity: sha512-zJccwplOAbgfZju95IUHazLnx9RAPtPN2YGJXI6UbrgeaR9QfPjGrQL6ERkSAtnVCA4Q+83ApGyaX5zdpCaKkQ==
Scope: npm runtime dependency, including optional platform packages.
--- licenses/napi-rs-MIT.txt (license from the npm release's upstream gitHead; see upstream-sources.json) ---
MIT License
Copyright (c) 2020-present LongYinan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT License
Copyright (c) 2018 GitHub
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
===== @tybys/wasm-util@0.10.4 =====
Declared license: MIT
Archive: https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.4.tgz
Integrity: sha512-W3c4gRigFS0T/Ma4qIYF3GDAc5AQdHb1yL5znJT1Zv1YaD9Kitx656wBjvr19qbiosmZT8lWDM5BEMynUqX65A==
Scope: npm runtime dependency, including optional platform packages.
--- package/LICENSE ---
MIT License
Copyright (c) 2022-present Toyobayashi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
===== tslib@2.8.1 =====
Declared license: 0BSD
Archive: https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz
Integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==
Scope: npm runtime dependency, including optional platform packages.
--- package/LICENSE.txt ---
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
--- package/CopyrightNotice.txt ---
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
+5
View File
@@ -83,5 +83,10 @@
"file": "licenses/microsoft-uf2-MIT.txt",
"source": "https://raw.githubusercontent.com/microsoft/uf2/cf3bd7f9c274b949528f8cd6a19eef2502a687d2/LICENSE.txt",
"sha256": "c581accf1e5449482b70ac5fcdfb171599317ccff559cf0794d771671486f800"
},
{
"file": "licenses/napi-rs-MIT.txt",
"source": "https://raw.githubusercontent.com/napi-rs/napi-rs/a9362f80ff9bc65f011e7a487c27ab5a104ea194/LICENSE",
"sha256": "3f1ce66533302df3a32edbfdfc0b78f0dd34659e4c1f5817162e5ea3c2297215"
}
]
+381 -2
View File
@@ -18,6 +18,7 @@
"@modelcontextprotocol/client": "2.4.0",
"@modelcontextprotocol/server": "2.4.0",
"@msgpack/msgpack": "3.1.3",
"@napi-rs/lzma": "1.5.3",
"@toon-format/toon": "4.4.0",
"@xmldom/xmldom": "0.9.12",
"@xterm/addon-serialize": "0.14.0",
@@ -2338,6 +2339,229 @@
"node": ">= 18"
}
},
"node_modules/@napi-rs/lzma": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@napi-rs/lzma/-/lzma-1.5.3.tgz",
"integrity": "sha512-QSIzELPyd2A7mcaDiJEWjwzApoAOWq9PVl9xYq+CxzIwstufv48s8aBgOUr0sgbjGmb15aYU88YKNaFaCaOuhQ==",
"license": "MIT",
"engines": {
"node": "^22.20 || ^24.12 || >=25"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/Brooooooklyn"
},
"optionalDependencies": {
"@napi-rs/lzma-android-arm-eabi": "1.5.3",
"@napi-rs/lzma-android-arm64": "1.5.3",
"@napi-rs/lzma-darwin-arm64": "1.5.3",
"@napi-rs/lzma-darwin-x64": "1.5.3",
"@napi-rs/lzma-freebsd-x64": "1.5.3",
"@napi-rs/lzma-linux-arm-gnueabihf": "1.5.3",
"@napi-rs/lzma-linux-arm64-gnu": "1.5.3",
"@napi-rs/lzma-linux-arm64-musl": "1.5.3",
"@napi-rs/lzma-linux-ppc64-gnu": "1.5.3",
"@napi-rs/lzma-linux-riscv64-gnu": "1.5.3",
"@napi-rs/lzma-linux-s390x-gnu": "1.5.3",
"@napi-rs/lzma-linux-x64-gnu": "1.5.3",
"@napi-rs/lzma-linux-x64-musl": "1.5.3",
"@napi-rs/lzma-wasm32-wasi": "1.5.3",
"@napi-rs/lzma-win32-arm64-msvc": "1.5.3",
"@napi-rs/lzma-win32-ia32-msvc": "1.5.3",
"@napi-rs/lzma-win32-x64-msvc": "1.5.3"
}
},
"node_modules/@napi-rs/lzma-android-arm-eabi": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@napi-rs/lzma-android-arm-eabi/-/lzma-android-arm-eabi-1.5.3.tgz",
"integrity": "sha512-Jo8Ej9sTXZO+vHVllHPYxcHVoW4dQe30eLx7wk3H786vv2zy/qIIi5KoO6WhK/VsSBhAb13xbIa/vc4maUgp8Q==",
"cpu": [
"arm"
],
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": "^22.20 || ^24.12 || >=25"
}
},
"node_modules/@napi-rs/lzma-android-arm64": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@napi-rs/lzma-android-arm64/-/lzma-android-arm64-1.5.3.tgz",
"integrity": "sha512-BUEMluJxOJ/9WkZH/IFyyi3viNQGEByodAHDbmJ/k7mVhabGIxjYBea3MmnyTZoIoqZs/ftAKH7jhVCIj+k6mw==",
"cpu": [
"arm64"
],
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": "^22.20 || ^24.12 || >=25"
}
},
"node_modules/@napi-rs/lzma-darwin-arm64": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@napi-rs/lzma-darwin-arm64/-/lzma-darwin-arm64-1.5.3.tgz",
"integrity": "sha512-ea46AUzmoGqWnrDP8JNea14TCiVMmxWtaD/d5YjRgh1KbL3YfZ9O2BZzfF7DAF+yrVuAQqS52rHveysjnzYlJA==",
"cpu": [
"arm64"
],
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^22.20 || ^24.12 || >=25"
}
},
"node_modules/@napi-rs/lzma-darwin-x64": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@napi-rs/lzma-darwin-x64/-/lzma-darwin-x64-1.5.3.tgz",
"integrity": "sha512-/vz8UpAe/9fV7JiTrT+lAV9Xk9bK4F28u8JRDNIYdGaT7lXP0r/e7YjDvBuJZ9bJtStW4nn/08q5Q7yfFmsF1Q==",
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^22.20 || ^24.12 || >=25"
}
},
"node_modules/@napi-rs/lzma-freebsd-x64": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@napi-rs/lzma-freebsd-x64/-/lzma-freebsd-x64-1.5.3.tgz",
"integrity": "sha512-gAxemzm8Zk1OaMXihd0L8zeAb/P+71NqhrYnrPVweW3cTXg7XACC+zXQsvENAvHhkroeHCfaMmFupRwfHi+u7A==",
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": "^22.20 || ^24.12 || >=25"
}
},
"node_modules/@napi-rs/lzma-linux-arm-gnueabihf": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-arm-gnueabihf/-/lzma-linux-arm-gnueabihf-1.5.3.tgz",
"integrity": "sha512-T7ZvCSEAKGoYSw7vIwdKgk1ZaYl8V1JLTgWSlGhnYBau23R9qZP79ONiF7FTosXnvR8G9RLe9peVuVGS5GI7ig==",
"cpu": [
"arm"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^22.20 || ^24.12 || >=25"
}
},
"node_modules/@napi-rs/lzma-linux-arm64-gnu": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-arm64-gnu/-/lzma-linux-arm64-gnu-1.5.3.tgz",
"integrity": "sha512-fEfgGb/y8jo2X57cTtMQ62XSD57rxDbpSbT38TSq0gSMKg6A/zq3oOxZLRfoCuZkL3cDtuZMi4fAuo6xIkP5eQ==",
"cpu": [
"arm64"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^22.20 || ^24.12 || >=25"
}
},
"node_modules/@napi-rs/lzma-linux-arm64-musl": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-arm64-musl/-/lzma-linux-arm64-musl-1.5.3.tgz",
"integrity": "sha512-Phe10HwfNrtM7U2XsVLhJGePWOgx0BVW2/EWUBq1hoPkmKuUTjbrFj8y4XSTGS5eHMWABUtehnkbX+MPnN5sKg==",
"cpu": [
"arm64"
],
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^22.20 || ^24.12 || >=25"
}
},
"node_modules/@napi-rs/lzma-linux-ppc64-gnu": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-ppc64-gnu/-/lzma-linux-ppc64-gnu-1.5.3.tgz",
"integrity": "sha512-rhuUE76jYbXZaR5oXAWqvfXzxoZKaCFM1nTH3yrdmz2Jtog5mnFcmyJ9WjDFmUgzQo062p1WfXWm3FA8SJOwaA==",
"cpu": [
"ppc64"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^22.20 || ^24.12 || >=25"
}
},
"node_modules/@napi-rs/lzma-linux-riscv64-gnu": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-riscv64-gnu/-/lzma-linux-riscv64-gnu-1.5.3.tgz",
"integrity": "sha512-ogeKmHMV80J1uGYu5Lg4XVacyQxv9wapsEMEKH6beFtouIpo5wZMod5/zGLNHA+sg0/9HIAQbm/bVFJ5flkiQQ==",
"cpu": [
"riscv64"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^22.20 || ^24.12 || >=25"
}
},
"node_modules/@napi-rs/lzma-linux-s390x-gnu": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-s390x-gnu/-/lzma-linux-s390x-gnu-1.5.3.tgz",
"integrity": "sha512-FvFzkI1zzVUqpX21UQdLZ0efTPxDolaCH1bqIp6k7hMTtx0RNwHJgcrsbGXQisAJ8uLWKRKncwNVL8MzcBVxUg==",
"cpu": [
"s390x"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^22.20 || ^24.12 || >=25"
}
},
"node_modules/@napi-rs/lzma-linux-x64-gnu": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz",
@@ -2355,6 +2579,162 @@
"node": "^22.20 || ^24.12 || >=25"
}
},
"node_modules/@napi-rs/lzma-linux-x64-musl": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-musl/-/lzma-linux-x64-musl-1.5.3.tgz",
"integrity": "sha512-ZBMasmon/mQmwIKNCWDJagq/zq45vvDQzhSijJSBSIgyef8IRvoD9O4H2lq62Lrq3toHxhlMD2D85jwUVr4QQw==",
"cpu": [
"x64"
],
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^22.20 || ^24.12 || >=25"
}
},
"node_modules/@napi-rs/lzma-wasm32-wasi": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@napi-rs/lzma-wasm32-wasi/-/lzma-wasm32-wasi-1.5.3.tgz",
"integrity": "sha512-gJ2YpVByn8xNbSCbOwQhCN9Jc2ZQY0ERx/K3XFDldbyiFXCphbEnciptp3bwqcp+WUJvIvpZxcKP1+6tcUEj1g==",
"cpu": [
"wasm32"
],
"license": "MIT",
"optional": true,
"dependencies": {
"@emnapi/core": "2.0.0-beta.3",
"@emnapi/runtime": "2.0.0-beta.3",
"@napi-rs/wasm-runtime": "~1.2.7"
},
"engines": {
"node": "^22.20 || ^24.12 || >=25"
}
},
"node_modules/@napi-rs/lzma-wasm32-wasi/node_modules/@emnapi/core": {
"version": "2.0.0-beta.3",
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-2.0.0-beta.3.tgz",
"integrity": "sha512-KA+gOBtbifRATmUa/Gpf5C2B2EJ0r4brHUT3XSgACeHREcuiObXH56xd+B3fFsEFbUT04VBEe6MuZiCtMp0tQg==",
"license": "MIT",
"optional": true,
"dependencies": {
"@emnapi/wasi-threads": "2.2.0",
"tslib": "^2.4.0"
}
},
"node_modules/@napi-rs/lzma-wasm32-wasi/node_modules/@emnapi/runtime": {
"version": "2.0.0-beta.3",
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-2.0.0-beta.3.tgz",
"integrity": "sha512-ayb/PyyLzpwRyFVxeC0uoEHu59QlB1iWGcGsOpXQcaB/Dc+uGfBmNmpCHp3HmTT0t8lSsMmg3j7+tdJW/TlHjQ==",
"license": "MIT",
"optional": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@napi-rs/lzma-wasm32-wasi/node_modules/@emnapi/wasi-threads": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-2.2.0.tgz",
"integrity": "sha512-JP7OYH38Q7+pyTAe14raZHLQIK7BDKbdwji+Xi3pcd/6QkJYQH3SX4wu6EplGrGJWRepoNzedfm0G3B9Z4e9Rw==",
"license": "MIT",
"optional": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@napi-rs/lzma-wasm32-wasi/node_modules/@napi-rs/wasm-runtime": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.7.tgz",
"integrity": "sha512-zJccwplOAbgfZju95IUHazLnx9RAPtPN2YGJXI6UbrgeaR9QfPjGrQL6ERkSAtnVCA4Q+83ApGyaX5zdpCaKkQ==",
"license": "MIT",
"optional": true,
"dependencies": {
"@tybys/wasm-util": "^0.10.3"
},
"engines": {
"node": "^20.19.0 || ^22.13.0 || >=23.5.0"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/Brooooooklyn"
},
"peerDependencies": {
"@emnapi/core": "^1.7.1 || 2.0.0-beta.2 || 2.0.0-beta.3",
"@emnapi/runtime": "^1.7.1 || 2.0.0-beta.2 || 2.0.0-beta.3"
}
},
"node_modules/@napi-rs/lzma-win32-arm64-msvc": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@napi-rs/lzma-win32-arm64-msvc/-/lzma-win32-arm64-msvc-1.5.3.tgz",
"integrity": "sha512-oB9iJluslRc3bZ3upZ7ZD2tJfICX3tjTsqS8jUUWK+d7PpJei/oZ3YklBLNyczmLZ+JXHYZlBbotIeVCaoNGPw==",
"cpu": [
"arm64"
],
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": "^22.20 || ^24.12 || >=25"
}
},
"node_modules/@napi-rs/lzma-win32-ia32-msvc": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@napi-rs/lzma-win32-ia32-msvc/-/lzma-win32-ia32-msvc-1.5.3.tgz",
"integrity": "sha512-b5HxoRno1C9kS9I9pH9E7uYO9oMEQZ2RuOzAs8+PafoHzcHA5KMzSibNfA//seedILG1w22IS7YfrW4s0+4FvA==",
"cpu": [
"ia32"
],
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": "^22.20 || ^24.12 || >=25"
}
},
"node_modules/@napi-rs/lzma-win32-x64-msvc": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@napi-rs/lzma-win32-x64-msvc/-/lzma-win32-x64-msvc-1.5.3.tgz",
"integrity": "sha512-cPH8uIK0aaD9KZ0FTPBBPTIvncNHQ2Si3DNTP2rjPWyDRVV+syT2dWvlmkiklKgnRipXtx4eJ+tYQZhG30/+9w==",
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": "^22.20 || ^24.12 || >=25"
}
},
"node_modules/@napi-rs/lzma/node_modules/@napi-rs/lzma-linux-x64-gnu": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.3.tgz",
"integrity": "sha512-cqF0sRTngwVgnH0y7OV/5zWKWZomMYY71t3gzjtmJou4oPoWQHjxmO1Jo5E3GqUg2bPk+Fp3DcRw1xLAeKs1cg==",
"cpu": [
"x64"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^22.20 || ^24.12 || >=25"
}
},
"node_modules/@napi-rs/wasm-runtime": {
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.6.tgz",
@@ -5135,7 +5515,6 @@
"version": "0.10.4",
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.4.tgz",
"integrity": "sha512-W3c4gRigFS0T/Ma4qIYF3GDAc5AQdHb1yL5znJT1Zv1YaD9Kitx656wBjvr19qbiosmZT8lWDM5BEMynUqX65A==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
@@ -11788,7 +12167,7 @@
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
"dev": true,
"devOptional": true,
"license": "0BSD"
},
"node_modules/tsrs": {
+1
View File
@@ -385,6 +385,7 @@
"@modelcontextprotocol/client": "2.4.0",
"@modelcontextprotocol/server": "2.4.0",
"@msgpack/msgpack": "3.1.3",
"@napi-rs/lzma": "1.5.3",
"@toon-format/toon": "4.4.0",
"@xmldom/xmldom": "0.9.12",
"@xterm/addon-serialize": "0.14.0",
+1
View File
@@ -14,6 +14,7 @@ const MIGRATED_PROVIDER_ROOTS = new Set([
"model",
"gpu",
"python",
"deb",
"nuget",
"vsix",
"oci",
+2
View File
@@ -56,6 +56,7 @@ export const UNIT_LAYERS = Object.freeze(
"browser",
"captures",
"cutter",
"deb",
"desktop",
"dotnet",
"electron",
@@ -267,6 +268,7 @@ export const ENTRY_FILES = Object.freeze(
"CutterBridgeService.ts",
"CutterProviderIdentity.ts",
],
deb: ["DebPackageProvider.ts", "DebPackageProviderIdentity.ts"],
desktop: [
"AgentEnvComputer.ts",
"AgentEnvProviderIdentity.ts",
+11
View File
@@ -36,3 +36,14 @@ export function pluginPackageMetadata<Manifest extends PackageManifest>(
};
shrinkwrap: PackageLock;
};
export interface PluginPlatformPackage {
name: string;
path: string;
version: string;
integrity: string;
}
export function pluginPlatformPackages(
shrinkwrap: PackageLock,
): PluginPlatformPackage[];
+58 -3
View File
@@ -31,9 +31,9 @@ export function pluginPackageMetadata(manifest, lock) {
}
// Codex's npm source fetches the archive without installing dependencies.
// Keep optional Frida outside the bundle so ordinary npm installs can still
// run its host-specific installer. PTY binaries are transitive optionals of
// a runtime dependency and are included for every supported platform by the
// archive producer.
// run its host-specific installer. Native platform binaries are transitive
// optionals of runtime dependencies; the archive producer adds every
// supported platform's copy (see pluginPlatformPackages).
packageJson.bundleDependencies = Object.keys(manifest.dependencies ?? {});
const root = { ...lock.packages[""] };
delete root.devDependencies;
@@ -46,3 +46,58 @@ export function pluginPackageMetadata(manifest, lock) {
shrinkwrap.packages[""] = root;
return { packageJson, shrinkwrap };
}
// Hosts a plugin archive must run on. npm ci on the producing host filters
// other platforms' optional binaries, so these are restored explicitly.
const PLUGIN_PLATFORMS = new Set(["darwin", "linux", "win32"]);
const PLUGIN_ARCHITECTURES = new Set(["arm64", "x64"]);
const supportsPluginHost = (entry) =>
(entry.os ?? []).some((os) => PLUGIN_PLATFORMS.has(os)) &&
(entry.cpu ?? []).some((cpu) => PLUGIN_ARCHITECTURES.has(cpu));
/** Resolve a dependency from a lock path the way Node walks node_modules. */
const resolveLockedDependency = (packages, parentPath, name) => {
let base = parentPath;
for (;;) {
const candidate = `${base === "" ? "" : `${base}/`}node_modules/${name}`;
if (packages[candidate] !== undefined) return candidate;
if (base === "") return undefined;
const index = base.lastIndexOf("/node_modules/");
base = index === -1 ? "" : base.slice(0, index);
}
};
/**
* List the platform-specific optional packages of the runtime tree that a
* supported plugin host needs, at the lock path npm would install them.
*/
export function pluginPlatformPackages(shrinkwrap) {
const packages = shrinkwrap.packages;
const required = new Map();
for (const [parentPath, parent] of Object.entries(packages)) {
if (parentPath === "" || parent.dev === true) continue;
for (const name of Object.keys(parent.optionalDependencies ?? {})) {
const path = resolveLockedDependency(packages, parentPath, name);
const locked = path === undefined ? undefined : packages[path];
if (locked === undefined) {
// An unlocked optional that names a platform family member cannot be
// judged, so refuse rather than ship an archive missing a host binary.
throw new Error(`Plugin platform dependency is not locked: ${name}`);
}
if (locked.os === undefined && locked.cpu === undefined) continue;
if (!supportsPluginHost(locked)) continue;
if (locked.version === undefined || locked.integrity === undefined)
throw new Error(`Plugin platform dependency is not locked: ${name}`);
required.set(path, {
name,
path,
version: locked.version,
integrity: locked.integrity,
});
}
}
return [...required.values()].sort((left, right) =>
left.path.localeCompare(right.path),
);
}
+1 -1
View File
@@ -19,7 +19,7 @@ export const SOURCE_TEST_PROJECTS = [
group: "source",
include: [
"src/*.test.ts",
"src/{android,apkSignature,apktool,jeb,adb,artifacts,browser,compression,config,cutter,desktop,dotnet,electron,erlang,evm,firmware,flutter,frida,pcap,ghidra,go,gpu,hopper,hopperPaths,ida,inspector,java,javascript,kuna,main,native,nuget,oci,process,providers,python,reference,resources,rust,server,sqlite,uefi,v8,vsix,wasm,windows}/**/*.test.ts",
"src/{android,apkSignature,apktool,jeb,adb,artifacts,browser,compression,config,cutter,deb,desktop,dotnet,electron,erlang,evm,firmware,flutter,frida,pcap,ghidra,go,gpu,hopper,hopperPaths,ida,inspector,java,javascript,kuna,main,native,nuget,oci,process,providers,python,reference,resources,rust,server,sqlite,uefi,v8,vsix,wasm,windows}/**/*.test.ts",
],
},
{
+50 -66
View File
@@ -7,7 +7,10 @@ import { DEFAULT_CATALOG_IDENTITY } from "../dist/contracts/catalog/catalogIdent
import { parseTarListing } from "./lib/verify-package-listing.mjs";
import { runSettledConcurrent } from "./lib/verify-package-core.mjs";
import { verifyPackedBridge } from "./verify-packed-bridge.mjs";
import { pluginPackageMetadata } from "./lib/plugin-package.mjs";
import {
pluginPackageMetadata,
pluginPlatformPackages,
} from "./lib/plugin-package.mjs";
const { parseSkillManifestMetadata } = await importVerifierSource(
new URL("../src/domain/skillManifest.ts", import.meta.url).href,
@@ -66,62 +69,51 @@ export async function verifyPackagePack({ root, workspace, commands }) {
["--omit=dev", "--no-audit", "--no-fund"],
{ cwd: stagingDirectory },
);
if (packageJson.dependencies?.["@lydell/node-pty"] !== undefined) {
// npm ci filters foreign-platform optional packages. Include the exact locked
// PTY archives as well, without re-resolving the installed dependency tree.
const ptyManifest = JSON.parse(
await readFile(
join(stagingDirectory, "node_modules/@lydell/node-pty/package.json"),
"utf8",
),
);
const platformDirectory = join(workspace, "plugin-platform-packages");
await mkdir(platformDirectory);
for (const dependency of Object.keys(ptyManifest.optionalDependencies)) {
const destination = join(stagingDirectory, "node_modules", dependency);
if (
await access(destination).then(
() => true,
(cause) => {
if (cause.code !== "ENOENT") throw cause;
return false;
},
)
// npm ci filters foreign-platform optional packages. Include the exact locked
// native archives every supported host needs (PTY, XZ decoder, ...), without
// re-resolving the installed dependency tree.
const platformPackages = pluginPlatformPackages(shrinkwrap);
const platformDirectory = join(workspace, "plugin-platform-packages");
await mkdir(platformDirectory);
for (const locked of platformPackages) {
const destination = join(stagingDirectory, locked.path);
if (
await access(destination).then(
() => true,
(cause) => {
if (cause.code !== "ENOENT") throw cause;
return false;
},
)
continue;
const locked = shrinkwrap.packages[`node_modules/${dependency}`];
if (locked?.version === undefined || locked.integrity === undefined)
throw new Error(
`Plugin platform dependency is not locked: ${dependency}`,
);
const [archive] = JSON.parse(
(
await commands.execNpm(
[
"pack",
"--ignore-scripts",
"--json",
"--pack-destination",
platformDirectory,
`${dependency}@${locked.version}`,
],
{ cwd: platformDirectory },
)
).stdout,
)
continue;
const [archive] = JSON.parse(
(
await commands.execNpm(
[
"pack",
"--ignore-scripts",
"--json",
"--pack-destination",
platformDirectory,
`${locked.name}@${locked.version}`,
],
{ cwd: platformDirectory },
)
).stdout,
);
if (archive.integrity !== locked.integrity)
throw new Error(
`Plugin platform archive differs from the lock: ${locked.name}`,
);
if (archive.integrity !== locked.integrity)
throw new Error(
`Plugin platform archive differs from the lock: ${dependency}`,
);
await mkdir(destination, { recursive: true });
await commands.exec("tar", [
"-xzf",
join(platformDirectory, archive.filename),
"-C",
destination,
"--strip-components=1",
]);
}
await mkdir(destination, { recursive: true });
await commands.exec("tar", [
"-xzf",
join(platformDirectory, archive.filename),
"-C",
destination,
"--strip-components=1",
]);
}
const tarball = join(
packDirectory,
@@ -142,7 +134,6 @@ export async function verifyPackagePack({ root, workspace, commands }) {
const metadataCandidates = [
"package/package.json",
"package/npm-shrinkwrap.json",
"package/node_modules/@lydell/node-pty/package.json",
"package/skills/reverse-engineer-anything/SKILL.md",
"package/.claude-plugin/plugin.json",
"package/.codex-plugin/plugin.json",
@@ -191,16 +182,9 @@ export async function verifyPackagePack({ root, workspace, commands }) {
throw new Error(
`Plugin runtime dependency is not bundled: ${dependency}`,
);
const pty = await readPackedJson(
"package/node_modules/@lydell/node-pty/package.json",
);
for (const dependency of Object.keys(pty.optionalDependencies))
if (
!packedFiles.includes(`package/node_modules/${dependency}/package.json`)
)
throw new Error(
`Plugin PTY platform dependency is missing: ${dependency}`,
);
for (const { name, path } of pluginPlatformPackages(packedLock))
if (!packedFileSet.has(`package/${path}/package.json`))
throw new Error(`Plugin platform dependency is missing: ${name}`);
if (
packedManifest.scripts?.postinstall !== undefined ||
packedManifest.dependencies?.["node-pty"] !== undefined ||
@@ -0,0 +1,9 @@
{
"schemas": {
"input compact": "9dbdd7bf9deef4cf",
"output compact": "fc6c5d5a78a47254"
},
"patterns": {
"input": ["^[^\\x00]*$"]
}
}
@@ -137,6 +137,12 @@
"reason": "The ZIP reader's plaintext-work budget is derived from the admitted trace archive's own size, which trace_limits.archive_bytes bounds."
}
},
"src/deb/DebPackageProvider.ts": {
"DEB_PACKAGE_FIXED_ALLOWANCES[cause.allowance]": {
"class": "forwarding",
"reason": "Reports the Debian parser's named ar name, tar extension, relationship alternative, Zstandard window, or XZ dictionary allowance using the parser's maximum."
}
},
"src/domain/analysisErrorCore.ts": {
"text(recovery.fixedAllowance.name)": {
"class": "forwarding",
@@ -165,6 +165,7 @@ const TARGETS: TargetFixtures = {
"windows-shortcut": { ...artifact, format: "windows-shortcut" },
"python-pyc": { ...artifact, format: "python-pyc" },
devicetree: { ...artifact, format: "devicetree" },
deb: { ...artifact, format: "deb" },
};
const provider = { id: "fixture", name: "Fixture", version: "1" } as const;
@@ -0,0 +1,220 @@
import { expect, it } from "vitest";
import {
AnalysisCancelledError,
AnalysisInputError,
AnalysisOutputError,
} from "../../domain/analysisErrorCore.js";
import type { DebPackage } from "../../domain/deb/debPackage.js";
import { ok } from "../../domain/result.js";
import { DebPackageService } from "./DebPackageService.js";
const identity = {
id: "rea-deb-package",
name: "Source-owned Debian package reader seam",
version: "1",
};
const report: DebPackage = {
artifact: {
path: "/artifacts/hello.deb",
sha256: "a".repeat(64),
bytes: 128,
},
ar: {
magic: "!<arch>\n",
format_version: "2.0",
members: [
{
name: "debian-binary",
role: "debian-binary",
size: 4,
offset: 8,
compression: null,
},
],
extra_member_names: [],
},
control: {
package: "hello",
version: { raw: "1:2.03-1", epoch: 1, upstream: "2.03", revision: "1" },
architecture: "all",
maintainer: "Alice <alice@example.com>",
installed_size: 12,
section: "misc",
priority: "optional",
homepage: "https://example.invalid/hello",
description_summary: "greeting tool",
source: "hello",
multi_arch: "foreign",
essential: false,
relationships: {
depends: [
[
{
name: "libc6",
arch_qualifier: null,
operator: ">=",
version: "2.34",
arch_restriction: null,
},
],
],
pre_depends: null,
recommends: null,
suggests: null,
conflicts: null,
breaks: null,
replaces: null,
provides: null,
enhances: null,
},
conffiles: { present: true, count: 1 },
md5sums: { present: true, count: 1 },
maintainer_scripts: [
{ name: "preinst", interpreter: "/bin/sh", bytes: 17 },
],
},
data_entries: [],
md5sums_cross_check: {
listed: 1,
present: 1,
missing_from_inventory: 0,
missing_from_md5sums: 0,
},
issues: [],
coverage: {
status: "complete",
ar_members: 1,
control_entries: 1,
data_entries: 0,
examined_control_bytes: 64,
examined_data_bytes: 0,
},
limitations: [
"This workflow reads the .deb ar container and its control/data tars without installing the package or running maintainer scripts.",
],
};
it("rejects a relative path and extra arguments before reading", async () => {
let calls = 0;
const service = new DebPackageService({
close: async () => {},
identity,
inspect: () => {
calls += 1;
return Promise.resolve(ok(report));
},
});
const relative = await service.inspect({ path: "hello.deb" });
const extra = await service.inspect({
path: report.artifact.path,
detail: "complete",
});
expect(relative.ok).toBe(false);
expect(extra.ok).toBe(false);
if (!relative.ok) expect(relative.error).toBeInstanceOf(AnalysisInputError);
if (!extra.ok) expect(extra.error).toBeInstanceOf(AnalysisInputError);
expect(calls).toBe(0);
});
it("records the selected artifact as observed Evidence", async () => {
const result = await new DebPackageService({
close: async () => {},
identity,
inspect: () => Promise.resolve(ok(report)),
}).inspect({ path: report.artifact.path });
if (!result.ok) throw result.error;
expect(result.value).toMatchObject({
confidence: "observed",
subject: { identity: { format: "file" } },
normalized_result: report,
});
expect(result.value.locations).toEqual([
{ kind: "artifact-path", path: report.artifact.path },
{ kind: "file-offset-range", start: 0, end: report.artifact.bytes },
]);
expect(result.value.parameters).toEqual({ path: report.artifact.path });
});
it("records only the budgets the caller selected", async () => {
const result = await new DebPackageService({
close: async () => {},
identity,
inspect: () => Promise.resolve(ok(report)),
}).inspect({ path: report.artifact.path, max_data_entries: 8 });
if (!result.ok) throw result.error;
expect(result.value.parameters).toEqual({
path: report.artifact.path,
max_data_entries: 8,
});
});
it("retains completed Debian package Evidence on late cancellation", async () => {
const controller = new AbortController();
const reason = new AnalysisInputError("opaque caller metadata");
const service = new DebPackageService({
close: async () => {},
identity,
inspect: () => {
controller.abort(reason);
return Promise.resolve(ok(report));
},
});
const result = await service.inspect(
{ path: report.artifact.path },
{ signal: controller.signal },
);
if (result.ok) throw new Error("Expected cancellation");
expect(result.error).toBeInstanceOf(AnalysisCancelledError);
expect(result.error.cause).toBe(reason);
expect(result.error.partialObservation).toMatchObject({
operation: "inspect_deb_package",
normalized_result: report,
subject: { local_path: report.artifact.path },
});
});
it("retains a pre-admission cancellation reason without calling the provider", async () => {
const reason = new Error("caller stopped before Debian package admission");
let calls = 0;
const service = new DebPackageService({
close: async () => {},
identity,
inspect: async () => {
calls += 1;
return ok(report);
},
});
const result = await service.inspect(
{ path: report.artifact.path },
{ signal: AbortSignal.abort(reason) },
);
if (result.ok) throw new Error("Expected cancellation");
expect(result.error).toBeInstanceOf(AnalysisCancelledError);
expect(result.error.cause).toBe(reason);
expect(result.error.partialObservation).toBeUndefined();
expect(calls).toBe(0);
});
it("preserves malformed provider output instead of relabeling it as a late abort", async () => {
const controller = new AbortController();
const service = new DebPackageService({
close: async () => {},
identity,
inspect: async () => {
controller.abort(new Error("later caller stop"));
return ok({
...report,
artifact: { ...report.artifact, path: "/different.deb" },
});
},
});
const result = await service.inspect(
{ path: report.artifact.path },
{ signal: controller.signal },
);
if (result.ok) throw new Error("Expected output failure");
expect(result.error).toBeInstanceOf(AnalysisOutputError);
expect(result.error.partialObservation).toBeUndefined();
});
+71
View File
@@ -0,0 +1,71 @@
import type { ExecutionOptions } from "../../ports/AnalysisProvider.js";
import type { DebPackagePort } from "../../ports/deb/DebPackagePort.js";
import type { AnalysisError } from "../../domain/analysisErrorBase.js";
import { createEvidence, type Evidence } from "../../domain/evidence.js";
import {
inspectDebPackageInputSchema,
debPackageSchema,
} from "../../domain/deb/debPackage.js";
import type { Result } from "../../domain/result.js";
import { callerAnalysisParameters } from "../AnalysisInput.js";
import { executeArtifactInspection } from "../ArtifactInspectionExecution.js";
const OPERATION = "inspect_deb_package";
/** Shared caller validation, output parsing and Evidence provenance for CLI and MCP. */
export class DebPackageService {
constructor(readonly provider: DebPackagePort) {}
close(): Promise<void> {
return this.provider.close();
}
inspect(
rawInput: unknown,
options?: ExecutionOptions,
): Promise<Result<Evidence, AnalysisError>> {
return executeArtifactInspection(
{
operation: OPERATION,
inputSchema: inspectDebPackageInputSchema,
outputSchema: debPackageSchema,
provider: this.provider,
invalidOutputMessage:
"Debian package provider returned malformed output or changed artifact identity.",
toParameters: (input) => input,
validateReport: (report, input) =>
report.artifact.path === input.path &&
report.artifact.bytes <= input.max_file_bytes &&
report.coverage.ar_members <= input.max_ar_members &&
report.coverage.control_entries <= input.max_control_entries &&
report.coverage.data_entries <= input.max_data_entries,
buildEvidence: (value, identity, parameters) =>
createEvidence(
{
path: value.artifact.path,
format: "file",
sha256: value.artifact.sha256,
},
identity,
{
operation: OPERATION,
parameters: callerAnalysisParameters(rawInput)(parameters),
result: value,
confidence: "observed",
limitations: value.limitations,
locations: [
{ kind: "artifact-path", path: value.artifact.path },
{
kind: "file-offset-range",
start: 0,
end: value.artifact.bytes,
},
],
},
),
},
rawInput,
options,
);
}
}
+1
View File
@@ -569,6 +569,7 @@ const NON_ZIP_FORMATS = {
"windows-shortcut": described("windows-shortcut", plain),
"python-pyc": described("python-pyc", plain),
devicetree: described("devicetree", plain),
deb: described("deb", plain),
entitlements: described("entitlements", plain),
directory: container("directory", {
absentInventory: "unavailable",
+4 -23
View File
@@ -4,11 +4,13 @@ import { Budget } from "../../domain/budget.js";
import { malformedInput } from "../../domain/parseFailure.js";
import { isStrictUtf8 } from "../../domain/strictUtf8.js";
import {
isTarDirectoryHeader,
parsePaxRecords,
parseTarHeaderBlock,
TAR_BLOCK_BYTES,
TAR_TYPEFLAGS,
tarPaddedSize,
tarStoredDataBytes,
type TarHeaderDialect,
type TarPaxRecords,
} from "../../domain/tarFormat.js";
@@ -460,7 +462,7 @@ export const walkTar = async (
break;
}
}
const stored = storedDataBytes(typeflag, name, size);
const stored = tarStoredDataBytes(typeflag, name, size);
const skipped = await stream.skip(stored, signal);
if (skipped < stored) {
stop(
@@ -555,27 +557,6 @@ export const walkTar = async (
};
};
/** A directory header, including an old regular header whose name ends in `/`. */
const isDirectoryHeader = (flag: number, name: string): boolean =>
flag === TAR_TYPEFLAGS.directory || (flag === 0 && name.endsWith("/"));
/** Typeflags POSIX ustar records without data blocks, besides directories. */
const HEADER_ONLY_TYPEFLAGS: ReadonlySet<number> = new Set([
TAR_TYPEFLAGS.symlink,
TAR_TYPEFLAGS.characterDevice,
TAR_TYPEFLAGS.blockDevice,
TAR_TYPEFLAGS.fifo,
]);
/**
* Data bytes stored after a member header. POSIX ustar stores none for
* symbolic links, devices, directories and FIFOs, whose size field may still
* be nonzero, so the next header follows at once. Hard links keep their size:
* pax interchange archives may store a body for them.
*/
const storedDataBytes = (flag: number, name: string, size: number): number =>
isDirectoryHeader(flag, name) || HEADER_ONLY_TYPEFLAGS.has(flag) ? 0 : size;
/**
* What a header contributes: an inventory member, an omission, or nothing
* for the archive's own `./` root and a GNU volume label.
@@ -587,7 +568,7 @@ const memberRole = (
):
| { readonly member: TarMember["kind"] | "root" }
| { readonly omit: ArtifactTraversalOmissionKind } => {
const directory = isDirectoryHeader(flag, name);
const directory = isTarDirectoryHeader(flag, name);
if (flag === TAR_TYPEFLAGS.gnuVolumeLabel) return { member: "root" };
if (directory && /^(?:\.\/?)?$/u.test(name)) return { member: "root" };
if ([...records.keys()].some((key) => key.startsWith("GNU.sparse.")))
+2
View File
@@ -32,6 +32,7 @@ import * as modelModule from "./cli/modelCommands.js";
import * as gpuModule from "./cli/gpuCommands.js";
import * as rustModule from "./cli/rustCommands.js";
import * as pythonPycModule from "./cli/pythonPycCommands.js";
import * as debPackageModule from "./cli/debPackageCommands.js";
import * as nugetNupkgModule from "./cli/nugetNupkgCommands.js";
import * as vsixPackageModule from "./cli/vsixPackageCommands.js";
import * as ociImageLayoutModule from "./cli/ociImageLayoutCommands.js";
@@ -96,6 +97,7 @@ const CLI_COMMAND_MODULES: CliCommandModules = {
gpu: gpuModule,
rust: rustModule,
pythonPyc: pythonPycModule,
debPackage: debPackageModule,
nugetNupkg: nugetNupkgModule,
vsixPackage: vsixPackageModule,
ociImageLayout: ociImageLayoutModule,
+5
View File
@@ -100,6 +100,10 @@ export const CLI_COMMAND_REGISTRATIONS = {
() => import("./pythonPycCommands.js"),
"registerPythonPycCommands",
),
debPackage: cliRegistrar(
() => import("./debPackageCommands.js"),
"registerDebPackageCommands",
),
nugetNupkg: cliRegistrar(
() => import("./nugetNupkgCommands.js"),
"registerNugetNupkgCommands",
@@ -312,6 +316,7 @@ const CLI_FAMILY_REGISTRATIONS: {
"gpu",
"rust",
"pythonPyc",
"debPackage",
"nugetNupkg",
"vsixPackage",
"ociImageLayout",
+35
View File
@@ -0,0 +1,35 @@
import type { Logger } from "pino";
import { createDebPackageService } from "../composition/debPackage.js";
import { DEB_PACKAGE_TOOL_CONTRACTS } from "../contracts/deb/debPackageToolContracts.js";
import { contractNamed } from "./contractCliDescription.js";
import { registerContractCommand } from "./contractCommand.js";
import { inspectWithService } from "./contractCommandRunners.js";
import type { CliInstance } from "./types.js";
/** Resolve an operator-selected Debian package through the shared inspection workflow. */
export const registerDebPackageCommands = (
cli: CliInstance,
logger: Logger,
): void => {
const service = createDebPackageService();
const contract = contractNamed(
DEB_PACKAGE_TOOL_CONTRACTS,
"inspect_deb_package",
);
registerContractCommand(
cli,
logger,
contract,
{
description:
"Inspect a local Debian .deb without installing it or running maintainer scripts",
positionals: ["path"],
callerPaths: ["path"],
fields: {
path: { description: "Local Debian .deb package" },
},
},
inspectWithService(() => service, "rea-deb-package"),
);
};
@@ -105,6 +105,7 @@ import { NUGET_NUPKG_PROVIDER_IDENTITY } from "../nuget/NugetNupkgProviderIdenti
import { VSIX_PACKAGE_PROVIDER_IDENTITY } from "../vsix/VsixPackageProviderIdentity.js";
import { OCI_IMAGE_LAYOUT_PROVIDER_IDENTITY } from "../oci/OciImageLayoutProviderIdentity.js";
import { PYTHON_PYC_PROVIDER_IDENTITY } from "../python/PythonPycProviderIdentity.js";
import { DEB_PACKAGE_PROVIDER_IDENTITY } from "../deb/DebPackageProviderIdentity.js";
import { RIZIN_DEBUGGER_PROVIDER_IDENTITY } from "../rizin/RizinDebuggerProviderIdentity.js";
import { RIZIN_PROVIDER_IDENTITY } from "../rizin/RizinProviderIdentity.js";
import { RUST_BINARY_PROVIDER_IDENTITY } from "../rust/RustBinaryProviderIdentity.js";
@@ -518,6 +519,13 @@ export const CAPABILITY_DECLARATIONS = {
}),
],
},
debPackage: {
providers: [
providerBinding(DEB_PACKAGE_PROVIDER_IDENTITY, {
group: "DEB_PACKAGE_TOOL_CONTRACTS",
}),
],
},
nugetNupkg: {
providers: [
providerBinding(NUGET_NUPKG_PROVIDER_IDENTITY, {
+6
View File
@@ -48,6 +48,7 @@ import { createIl2cppMetadataService } from "./il2cpp.js";
import { createElectronFuseService } from "./electronFuses.js";
import { createReleaseExposureService } from "./releaseExposure.js";
import { createPythonPycService } from "./pythonPyc.js";
import { createDebPackageService } from "./debPackage.js";
import { createNugetNupkgService } from "./nugetNupkg.js";
import { createVsixPackageService } from "./vsixPackage.js";
import { createOciImageLayoutService } from "./ociImageLayout.js";
@@ -114,6 +115,7 @@ import type { GoBinaryService } from "../application/go/GoBinaryService.js";
import type { ElectronFuseService } from "../application/electron/ElectronFuseService.js";
import type { RustBinaryService } from "../application/rust/RustBinaryService.js";
import type { PythonPycService } from "../application/python/PythonPycService.js";
import type { DebPackageService } from "../application/deb/DebPackageService.js";
import type { NugetNupkgService } from "../application/nuget/NugetNupkgService.js";
import type { VsixPackageService } from "../application/vsix/VsixPackageService.js";
import type { OciImageLayoutService } from "../application/oci/OciImageLayoutService.js";
@@ -153,6 +155,7 @@ export interface CapabilityServiceOptions {
readonly il2cppMetadata?: Il2cppMetadataService;
readonly rustBinary?: RustBinaryService;
readonly pythonPyc?: PythonPycService;
readonly debPackage?: DebPackageService;
readonly nugetNupkg?: NugetNupkgService;
readonly vsixPackage?: VsixPackageService;
readonly ociImageLayout?: OciImageLayoutService;
@@ -429,6 +432,9 @@ const modules = {
pythonPyc: service(
({ options }) => options.pythonPyc ?? createPythonPycService(),
),
debPackage: service(
({ options }) => options.debPackage ?? createDebPackageService(),
),
nugetNupkg: service(
({ options }) => options.nugetNupkg ?? createNugetNupkgService(),
),
+6
View File
@@ -0,0 +1,6 @@
import { DebPackageService } from "../application/deb/DebPackageService.js";
import { DebPackageProvider } from "../deb/DebPackageProvider.js";
/** Compose read-only .deb inspection without installing packages or running scripts. */
export const createDebPackageService = (): DebPackageService =>
new DebPackageService(new DebPackageProvider());
@@ -0,0 +1,29 @@
import {
inspectDebPackageInputSchema,
debPackageSchema,
} from "../../domain/deb/debPackage.js";
import type { ToolContract } from "../toolContractTypes.js";
import { evidenceEffects, toolContractMetadata } from "../toolEffects.js";
import { evidenceResultOf } from "../toolOutputSchemaPrimitives.js";
/** Static Debian package inspection is independent of dpkg, apt, and active native providers. */
export const DEB_PACKAGE_TOOL_CONTRACTS = [
{
name: "inspect_deb_package",
availability: "standalone",
cli: true,
...toolContractMetadata("inspect_deb_package", evidenceEffects),
kind: "artifact-provider",
requiresActiveTarget: true,
description:
"Inspect a local Debian .deb without installing it, running maintainer scripts, or contacting a mirror. Returns the ar container (magic, members, debian-binary version), control fields (Package, Version with epoch/revision, Architecture, Maintainer, relationships parsed into alternatives with operators and arch qualifiers), conffiles/md5sums presence and counts, maintainer-script interpreter lines and byte lengths, and a bounded data.tar file inventory with an md5sums path cross-check. gzip, zstd, xz, and uncompressed control/data members are decoded in-process; bzip2 and lzma members are unsupported. Missing optional fields stay null, not empty. Malformed or truncated ar/tar input is a typed refusal that retains members already parsed. Package signatures are not verified. Complete Evidence is the result.",
inputSchema: inspectDebPackageInputSchema,
outputSchema: evidenceResultOf(debPackageSchema),
examples: [
{
title: "Inspect package identity, dependencies, and file inventory",
input: { path: "/artifacts/hello_2.03-1_all.deb" },
},
],
},
] as const satisfies readonly ToolContract[];
+2
View File
@@ -13,6 +13,7 @@ import { MODEL_TOOL_CONTRACTS } from "./model/modelToolContracts.js";
import { IL2CPP_TOOL_CONTRACTS } from "./il2cpp/il2cppToolContracts.js";
import { RUST_TOOL_CONTRACTS } from "./rust/rustToolContracts.js";
import { PYTHON_PYC_TOOL_CONTRACTS } from "./python/pythonPycToolContracts.js";
import { DEB_PACKAGE_TOOL_CONTRACTS } from "./deb/debPackageToolContracts.js";
import { NUGET_NUPKG_TOOL_CONTRACTS } from "./nuget/nupkgToolContracts.js";
import { VSIX_PACKAGE_TOOL_CONTRACTS } from "./vsix/vsixPackageToolContracts.js";
import { OCI_IMAGE_LAYOUT_TOOL_CONTRACTS } from "./oci/ociImageLayoutToolContracts.js";
@@ -75,6 +76,7 @@ const CATALOG_CONTRACT_GROUPS = {
GPU_TOOL_CONTRACTS,
RUST_TOOL_CONTRACTS,
PYTHON_PYC_TOOL_CONTRACTS,
DEB_PACKAGE_TOOL_CONTRACTS,
NUGET_NUPKG_TOOL_CONTRACTS,
VSIX_PACKAGE_TOOL_CONTRACTS,
OCI_IMAGE_LAYOUT_TOOL_CONTRACTS,
+1
View File
@@ -50,6 +50,7 @@ export const TOOL_FAMILY_DEFINITIONS = [
...TOOL_CONTRACT_GROUPS.MODEL_TOOL_CONTRACTS,
...TOOL_CONTRACT_GROUPS.RUST_TOOL_CONTRACTS,
...TOOL_CONTRACT_GROUPS.PYTHON_PYC_TOOL_CONTRACTS,
...TOOL_CONTRACT_GROUPS.DEB_PACKAGE_TOOL_CONTRACTS,
...TOOL_CONTRACT_GROUPS.NUGET_NUPKG_TOOL_CONTRACTS,
...TOOL_CONTRACT_GROUPS.VSIX_PACKAGE_TOOL_CONTRACTS,
...TOOL_CONTRACT_GROUPS.OCI_IMAGE_LAYOUT_TOOL_CONTRACTS,
+81
View File
@@ -0,0 +1,81 @@
import { ParseFailureError } from "../domain/parseFailure.js";
import type {
DEB_PACKAGE_LIMIT_MAXIMA,
DebPackage,
} from "../domain/deb/debPackage.js";
/** Distinguish corrupt ar/tar bytes from layouts this reader does not decode. */
export class DebPackageFormatFailure extends ParseFailureError<
"malformed" | "unsupported" | "truncated"
> {
constructor(
kind: "malformed" | "unsupported" | "truncated",
message: string,
readonly partial?: DebPackage,
options?: ErrorOptions,
) {
super(
kind === "unsupported"
? { kind, format: "deb", detail: message, undecodedContent: true }
: { kind, format: "deb", detail: message },
options,
);
this.name = "DebPackageFormatFailure";
}
}
/** Resource boundary exceeded while inventorying members or expanding a tar. */
export class DebPackageCapacityFailure extends ParseFailureError<"limit"> {
constructor(
readonly resource: keyof typeof DEB_PACKAGE_LIMIT_MAXIMA,
readonly maximum: number,
message: string,
readonly partial?: DebPackage,
options?: ErrorOptions,
) {
super(
{
kind: "limit",
format: "deb",
detail: message,
limit: { name: resource, maximum },
},
options,
);
this.name = "DebPackageCapacityFailure";
}
}
/**
* Fixed allowances the reader applies to report-amplifying structures. They
* are not request budgets: no inspect_deb_package option raises them.
*/
export const DEB_PACKAGE_FIXED_ALLOWANCES = {
ar_member_name_bytes: "The ar member name allowance",
tar_extension_headers: "The tar extension header allowance",
relationship_alternatives: "The control relationship alternatives allowance",
zstd_window_bytes: "The Zstandard decoder window allowance",
xz_dictionary_bytes: "The XZ LZMA2 dictionary allowance",
} as const;
/** A fixed reader allowance stopped inspection; the input is not shown to be invalid. */
export class DebPackageAllowanceFailure extends ParseFailureError<"limit"> {
constructor(
readonly allowance: keyof typeof DEB_PACKAGE_FIXED_ALLOWANCES,
readonly maximum: number,
message: string,
readonly partial?: DebPackage,
options?: ErrorOptions,
) {
super(
{
kind: "limit",
format: "deb",
detail: message,
limit: { name: allowance, maximum },
},
options,
);
this.name = "DebPackageAllowanceFailure";
}
}
+306
View File
@@ -0,0 +1,306 @@
import { gzipSync, zstdCompressSync } from "node:zlib";
import { compressXz } from "./xzDecoder.js";
const TAR_BLOCK = 512;
const AR_MAGIC = Buffer.from("!<arch>\n", "ascii");
const field = (value: string, width: number): string =>
value.slice(0, width).padEnd(width, " ");
const octalField = (value: number, width: number): string =>
`${value.toString(8).padStart(width - 1, "0")}\0`;
export type DebTarEntrySpec = {
readonly name: string;
/** Raw name bytes, written in place of `name` when given. */
readonly nameBytes?: Uint8Array;
readonly content?: Uint8Array | string;
readonly type?: string;
readonly mode?: number;
/** Raw mode field text, written in place of `mode` when given. */
readonly modeField?: string;
readonly uid?: number;
readonly gid?: number;
readonly uname?: string;
readonly gname?: string;
readonly linkname?: string;
};
/** One POSIX ustar header plus payload, padded to 512-byte blocks. */
export const tarMember = (entry: DebTarEntrySpec): Buffer => {
const content =
entry.content === undefined
? Buffer.alloc(0)
: typeof entry.content === "string"
? Buffer.from(entry.content, "utf8")
: Buffer.from(entry.content);
const header = Buffer.alloc(TAR_BLOCK);
const type =
entry.type ?? (content.length === 0 && entry.linkname ? "2" : "0");
if (entry.nameBytes === undefined) header.write(entry.name.slice(0, 100));
else header.set(entry.nameBytes.subarray(0, 100));
header.write(entry.modeField ?? octalField(entry.mode ?? 0o644, 8), 100);
header.write(octalField(entry.uid ?? 0, 8), 108);
header.write(octalField(entry.gid ?? 0, 8), 116);
header.write(octalField(content.length, 12), 124);
header.write(octalField(0, 12), 136);
header.write(" ", 148);
header[156] = type.charCodeAt(0);
if (entry.linkname !== undefined)
header.write(entry.linkname.slice(0, 100), 157);
header.write("ustar\0", 257);
header.write("00", 263);
header.write((entry.uname ?? "root").slice(0, 32), 265);
header.write((entry.gname ?? "root").slice(0, 32), 297);
let sum = 0;
for (const byte of header) sum += byte;
header.write(`${sum.toString(8).padStart(6, "0")}\0 `, 148);
const padded = Math.ceil(content.length / TAR_BLOCK) * TAR_BLOCK;
const payload = Buffer.alloc(padded);
payload.set(content);
return Buffer.concat([header, payload]);
};
/** ustar archive of the given members, terminated by two empty blocks. */
export const tarArchive = (entries: readonly DebTarEntrySpec[]): Buffer =>
Buffer.concat([...entries.map(tarMember), Buffer.alloc(TAR_BLOCK * 2)]);
/** Corrupt the first tar header checksum while leaving the rest intact. */
export const tarArchiveWithBadChecksum = (
entries: readonly DebTarEntrySpec[],
): Buffer => {
const bytes = tarArchive(entries);
bytes[148] = 0x30;
bytes[149] = 0x30;
bytes[150] = 0x30;
bytes[151] = 0x30;
bytes[152] = 0x30;
bytes[153] = 0x31;
return bytes;
};
const arHeader = (name: string, size: number, raw = false): Buffer => {
const header = Buffer.alloc(60, 0x20);
header.write(field(raw || name.endsWith("/") ? name : `${name}/`, 16), 0);
header.write(field("0", 12), 16);
header.write(field("0", 6), 28);
header.write(field("0", 6), 34);
header.write(field("100644", 8), 40);
header.write(field(String(size), 10), 48);
header[58] = 0x60;
header[59] = 0x0a;
return header;
};
export type DebArMemberSpec = {
readonly name: string;
readonly data: Uint8Array;
/** Store the name as a BSD `#1/N` extended name ahead of the payload. */
readonly bsdName?: boolean;
};
/** SysV ar archive as Debian packages use it: even-byte padded members. */
export const arArchive = (members: readonly DebArMemberSpec[]): Buffer => {
const parts: Buffer[] = [AR_MAGIC];
for (const member of members) {
const name = Buffer.from(member.name, "ascii");
const data =
member.bsdName === true
? Buffer.concat([name, Buffer.from(member.data)])
: Buffer.from(member.data);
parts.push(
member.bsdName === true
? arHeader(`#1/${String(name.length)}`, data.length, true)
: arHeader(member.name, data.length),
data,
);
if (data.length % 2 === 1) parts.push(Buffer.from("\n", "ascii"));
}
return Buffer.concat(parts);
};
export const gzipBytes = (bytes: Uint8Array): Buffer => gzipSync(bytes);
export const zstdBytes = (bytes: Uint8Array): Buffer => zstdCompressSync(bytes);
/** XZ stream magic plus inert payload; not a complete xz member. */
export const xzStub = (): Buffer =>
Buffer.from([0xfd, 0x37, 0x7a, 0x58, 0x5a, 0x00, 0x00, 0x04]);
export const DEFAULT_CONTROL_TEXT = `Package: hello
Version: 1:2.03-1
Architecture: all
Maintainer: Alice <alice@example.com>
Installed-Size: 12
Section: misc
Priority: optional
Homepage: https://example.invalid/hello
Description: greeting tool
This package prints a greeting.
Source: hello
Multi-Arch: foreign
Essential: no
Depends: libc6 (>= 2.34), python3:any | python3-minimal (>= 3.11), foo [amd64 i386], bar (>= 1.0) [!armel]
Pre-Depends: dpkg (>= 1.15.6)
Recommends: extra-thing
`;
export const DEFAULT_CONFFILES = "/etc/hello.conf\n";
export const DEFAULT_MD5SUMS =
"d41d8cd98f00b204e9800998ecf8427e usr/bin/hello\n";
export const DEFAULT_PREINST = "#!/bin/sh\nexit 0\n";
const defaultControlEntries = (
controlText: string,
options: {
readonly conffiles?: string | null | undefined;
readonly md5sums?: string | null | undefined;
readonly scripts?: boolean | undefined;
},
): DebTarEntrySpec[] => {
const entries: DebTarEntrySpec[] = [
{ name: "./", type: "5", mode: 0o755, content: "" },
{ name: "./control", content: controlText, mode: 0o644 },
];
if (options.conffiles !== null)
entries.push({
name: "./conffiles",
content: options.conffiles ?? DEFAULT_CONFFILES,
mode: 0o644,
});
if (options.md5sums !== null)
entries.push({
name: "./md5sums",
content: options.md5sums ?? DEFAULT_MD5SUMS,
mode: 0o644,
});
if (options.scripts !== false) {
for (const name of [
"preinst",
"postinst",
"prerm",
"postrm",
"config",
"triggers",
])
entries.push({
name: `./${name}`,
content: DEFAULT_PREINST,
mode: 0o755,
});
}
return entries;
};
const defaultDataEntries = (): DebTarEntrySpec[] => [
{ name: "./", type: "5", mode: 0o755, content: "" },
{ name: "./usr/", type: "5", mode: 0o755, content: "" },
{ name: "./usr/bin/", type: "5", mode: 0o755, content: "" },
{ name: "./usr/bin/hello", content: "", mode: 0o755 },
{ name: "./usr/bin/hi", type: "2", mode: 0o777, linkname: "hello" },
{ name: "./etc/", type: "5", mode: 0o755, content: "" },
{ name: "./etc/hello.conf", content: "color=blue\n", mode: 0o644 },
];
export type DebPackageFixtureOptions = {
readonly controlText?: string;
readonly conffiles?: string | null;
readonly md5sums?: string | null;
readonly scripts?: boolean;
readonly controlCompression?: "none" | "gzip" | "zstd" | "xz";
readonly dataCompression?: "none" | "gzip" | "zstd" | "xz";
readonly controlMemberBytes?: Uint8Array;
readonly extraMembers?: readonly DebArMemberSpec[];
readonly debianBinary?: string;
readonly dataEntries?: readonly DebTarEntrySpec[];
readonly controlEntries?: readonly DebTarEntrySpec[];
readonly corruptDataChecksum?: boolean;
/** Store the three core members under BSD `#1/N` extended names. */
readonly bsdNames?: boolean;
};
const compress = (
bytes: Uint8Array,
compression: DebPackageFixtureOptions["controlCompression"],
): { readonly name: string; readonly data: Buffer } => {
switch (compression) {
case "gzip":
return { name: "control.tar.gz", data: gzipBytes(bytes) };
case "zstd":
return { name: "control.tar.zst", data: zstdBytes(bytes) };
case "xz":
return { name: "control.tar.xz", data: compressXz(bytes) };
default:
return { name: "control.tar", data: Buffer.from(bytes) };
}
};
const compressData = (
bytes: Uint8Array,
compression: DebPackageFixtureOptions["dataCompression"],
): { readonly name: string; readonly data: Buffer } => {
const packed = compress(bytes, compression);
return {
name: packed.name.replace("control.tar", "data.tar"),
data: packed.data,
};
};
/** Tiny well-formed .deb with relationships, conffiles, scripts, and a file inventory. */
export const debPackageFixture = (
options: DebPackageFixtureOptions = {},
): Buffer => {
const controlEntries =
options.controlEntries ??
defaultControlEntries(options.controlText ?? DEFAULT_CONTROL_TEXT, {
conffiles: options.conffiles,
md5sums: options.md5sums,
scripts: options.scripts,
});
const dataEntries = options.dataEntries ?? defaultDataEntries();
const controlTar = tarArchive(controlEntries);
const dataTar = options.corruptDataChecksum
? tarArchiveWithBadChecksum(dataEntries)
: tarArchive(dataEntries);
const packedControl = compress(
controlTar,
options.controlCompression ?? "gzip",
);
const control =
options.controlMemberBytes === undefined
? packedControl
: {
name: packedControl.name,
data: Buffer.from(options.controlMemberBytes),
};
const data = compressData(dataTar, options.dataCompression ?? "gzip");
const bsdName = options.bsdNames === true;
return arArchive([
{
name: "debian-binary",
data: Buffer.from(options.debianBinary ?? "2.0\n", "utf8"),
bsdName,
},
{ name: control.name, data: control.data, bsdName },
{ name: data.name, data: data.data, bsdName },
...(options.extraMembers ?? []),
]);
};
/** Bytes that are not an ar archive. */
export const notArBytes = (): Buffer => Buffer.from("not a debian package\n");
/** ar magic followed by a member whose declared size runs past EOF. */
export const truncatedArMemberBytes = (): Buffer => {
const header = arHeader("debian-binary", 64);
return Buffer.concat([AR_MAGIC, header, Buffer.from("2.0\n")]);
};
/** Complete debian-binary member, then a control member whose size runs past EOF. */
export const truncatedAfterDebianBinaryBytes = (): Buffer => {
const prefix = arArchive([
{ name: "debian-binary", data: Buffer.from("2.0\n", "utf8") },
]);
const header = arHeader("control.tar.gz", 64);
return Buffer.concat([prefix, header, Buffer.from("short")]);
};
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+193
View File
@@ -0,0 +1,193 @@
import { DEB_PACKAGE_PROVIDER_IDENTITY } from "./DebPackageProviderIdentity.js";
import { errorMessage } from "../kernel/errorMessage.js";
import {
ArtifactResourceScope,
completedStableArtifactObservation,
projectArtifactCloseFailure,
readStableArtifact,
type StableArtifactSnapshot,
} from "../resources/index.js";
import type { DebPackagePort } from "../ports/deb/DebPackagePort.js";
import type { ExecutionOptions } from "../ports/AnalysisProvider.js";
import {
debPackageBudgetLimit,
type InspectDebPackageInput,
} from "../domain/deb/debPackage.js";
import {
parseFailureAnalysisError,
parseLimitConstraint,
} from "../domain/parseFailureAnalysisError.js";
import { ProviderAdapterError } from "../domain/providerAdapterError.js";
import { err, ok } from "../domain/result.js";
import type { JsonValue } from "../domain/jsonValue.js";
import type { AnalysisErrorOptions } from "../domain/analysisErrorBase.js";
import {
classifyProviderFailure,
type ProviderFailureDialect,
} from "../providers/classifyProviderFailure.js";
import { fixedAllowanceOptions } from "../domain/fixedAllowanceRemediation.js";
import {
DEB_PACKAGE_FIXED_ALLOWANCES,
DebPackageAllowanceFailure,
DebPackageCapacityFailure,
DebPackageFormatFailure,
} from "./DebPackage.errors.js";
import { parseDebPackage } from "./DebPackageParser.js";
const OPERATION = "inspect_deb_package";
const partialDiagnostics = (cause: unknown) => {
if (
!(cause instanceof DebPackageFormatFailure) &&
!(cause instanceof DebPackageCapacityFailure) &&
!(cause instanceof DebPackageAllowanceFailure)
)
return {};
const partial = cause.partial;
if (partial === undefined) return {};
// The partial report is already bounded by the caller's limits, so carry
// it whole: control facts, scripts, member offsets and file rows read
// before the refusal stay visible to CLI and MCP callers.
return { diagnostics: { partial: partial satisfies JsonValue } };
};
const capacityConstraint = (
cause: DebPackageCapacityFailure,
details: Omit<AnalysisErrorOptions, "cause">,
) =>
parseLimitConstraint(
OPERATION,
cause.resource === "max_file_bytes" ? "file-size" : "capacity",
cause,
{
...details,
retryable: false,
limit: debPackageBudgetLimit(cause.resource, cause.maximum),
...partialDiagnostics(cause),
},
);
/**
* The refusal for a fixed reader allowance, such as ar name bytes or
* relationship alternatives. No request budget raises it, so the recovery
* names the allowance rather than an option.
*/
const allowanceConstraint = (
cause: DebPackageAllowanceFailure,
details: Omit<AnalysisErrorOptions, "cause">,
) =>
parseLimitConstraint(OPERATION, "capacity", cause, {
...details,
...fixedAllowanceOptions(
DEB_PACKAGE_FIXED_ALLOWANCES[cause.allowance],
"parser",
{ limit: cause.maximum },
),
...partialDiagnostics(cause),
});
/**
* Debian's dialect for the shared provider failure classifier. Parser limit
* and format refusals, and the recovery text for those limits, are the only
* cases this provider names.
*/
const failureDialect = (
input: InspectDebPackageInput,
): ProviderFailureDialect => ({
providerId: DEB_PACKAGE_PROVIDER_IDENTITY.id,
operation: OPERATION,
recognise: (cause, details) => {
if (cause instanceof DebPackageCapacityFailure)
return capacityConstraint(cause, details);
if (cause instanceof DebPackageAllowanceFailure)
return allowanceConstraint(cause, details);
return parseFailureAnalysisError(
OPERATION,
input.path,
cause,
partialDiagnostics(cause),
);
},
file: {
path: input.path,
description: "deb",
retainCompletedIdentity: true,
fileSize: (limit, { cause, ...details }) =>
capacityConstraint(
new DebPackageCapacityFailure(
"max_file_bytes",
input.max_file_bytes,
limit.message,
undefined,
{ cause },
),
details,
),
},
unclassified: (cause, details) =>
new ProviderAdapterError(DEB_PACKAGE_PROVIDER_IDENTITY.id, OPERATION, {
...details,
cause,
diagnostics: {
path: input.path,
reason: errorMessage(cause),
},
}),
});
/** Portable parser over one bounded, identity-checked regular file. */
export class DebPackageProvider implements DebPackagePort {
readonly identity = DEB_PACKAGE_PROVIDER_IDENTITY;
readonly #resources = new ArtifactResourceScope();
async close(): Promise<void> {
try {
await this.#resources.close();
} catch (cause: unknown) {
throw projectArtifactCloseFailure(
cause,
DEB_PACKAGE_PROVIDER_IDENTITY.id,
OPERATION,
);
}
}
async inspect(input: InspectDebPackageInput, options?: ExecutionOptions) {
let snapshot: StableArtifactSnapshot | undefined;
try {
const report = await this.#resources.run(async () => {
snapshot = await readStableArtifact(
input.path,
input.max_file_bytes,
options?.signal,
undefined,
this.#resources,
);
return parseDebPackage(
snapshot.bytes,
{
path: input.path,
sha256: snapshot.sha256,
bytes: snapshot.bytes.length,
},
input,
options?.signal,
);
});
return ok(report);
} catch (cause) {
const failure = classifyProviderFailure(cause, failureDialect(input));
// The read already completed; its byte identity stays on the parser refusal.
if (snapshot !== undefined) {
const observation = completedStableArtifactObservation(
cause,
input.path,
snapshot,
);
if (observation !== undefined)
failure.retainPartialObservation(observation);
}
return err(failure);
}
}
}
+6
View File
@@ -0,0 +1,6 @@
/** Bundled reader identity; package name and version are separate observed facts. */
export const DEB_PACKAGE_PROVIDER_IDENTITY = {
id: "rea-deb-package",
name: "REA Debian package reader",
version: "1",
} as const;
+508
View File
@@ -0,0 +1,508 @@
import { crc32 } from "node:zlib";
import { afterEach, expect, it } from "vitest";
import { AnalysisCancelledError } from "../domain/analysisErrorCore.js";
import {
compressXz,
decodeXz,
lzma2DictionaryBytes,
replaceXzBindingForTests,
XZ_DICTIONARY_MAX_BYTES,
xzUncompressedSize,
} from "./xzDecoder.js";
afterEach(() => {
replaceXzBindingForTests(undefined);
});
const writeU32LE = (buf: Buffer, offset: number, value: number): void => {
buf.writeUInt32LE(value >>> 0, offset);
};
const encodeMbInt = (value: number): Buffer => {
const bytes: number[] = [];
let remaining = value;
do {
let byte = remaining & 0x7f;
remaining = Math.floor(remaining / 128);
if (remaining > 0) byte |= 0x80;
bytes.push(byte);
} while (remaining > 0);
return Buffer.from(bytes);
};
/**
* Rewrite the LZMA2 dictionary property byte in the first block header of a
* real XZ stream and recompute the block header CRC32.
*/
const withLzma2DictionaryProp = (xz: Buffer, propByte: number): Buffer => {
const copy = Buffer.from(xz);
const blockStart = 12;
const headerSize = (copy[blockStart]! + 1) * 4;
// Default single-filter LZMA2 block header:
// [0]=size, [1]=flags(0x00), [2]=filterId(0x21), [3]=propsSize(0x01), [4]=props
expect(copy[blockStart + 2]).toBe(0x21);
expect(copy[blockStart + 3]).toBe(0x01);
copy[blockStart + 4] = propByte;
writeU32LE(
copy,
blockStart + headerSize - 4,
crc32(copy.subarray(blockStart, blockStart + headerSize - 4)),
);
return copy;
};
/**
* Rewrite a single-block XZ stream's Index so it falsely declares a tiny
* uncompressed size while keeping all CRCs valid.
*/
const withSpoofedIndexUncompressedSize = (
xz: Buffer,
claimedSize: number,
): Buffer => {
const footerStart = xz.length - 12;
const oldBackwardSize = (xz.readUInt32LE(footerStart + 4) + 1) * 4;
const oldIndexStart = footerStart - oldBackwardSize;
// Read original unpadded size from the single-record index (skip 0x00 + count=1).
let unpadded = 0;
let shift = 0;
for (let i = oldIndexStart + 2; i < footerStart - 4; i++) {
const b = xz[i]!;
unpadded += (b & 0x7f) * 2 ** shift;
shift += 7;
if ((b & 0x80) === 0) break;
}
const indexBody = Buffer.concat([
Buffer.from([0x00, 0x01]),
encodeMbInt(unpadded),
encodeMbInt(claimedSize),
]);
const padLen = (4 - (indexBody.length % 4)) % 4;
const indexNoCrc = Buffer.concat([indexBody, Buffer.alloc(padLen)]);
const indexCrc = Buffer.alloc(4);
writeU32LE(indexCrc, 0, crc32(indexNoCrc));
const newIndex = Buffer.concat([indexNoCrc, indexCrc]);
const footer = Buffer.from(xz.subarray(footerStart));
writeU32LE(footer, 4, newIndex.length / 4 - 1);
writeU32LE(footer, 0, crc32(footer.subarray(4, 10)));
return Buffer.concat([xz.subarray(0, oldIndexStart), newIndex, footer]);
};
it("reads the uncompressed size from a completed xz index", () => {
const payload = Buffer.alloc(10752, 1);
const compressed = compressXz(payload);
expect(xzUncompressedSize(compressed)).toBe(payload.length);
});
it("decodes a valid xz stream within the selected limit", async () => {
const payload = Buffer.from("control.tar contents\n");
const decoded = await decodeXz(compressXz(payload), 4096);
expect(decoded.ok).toBe(true);
if (!decoded.ok) throw new Error("Expected xz decode");
expect(Buffer.from(decoded.value).equals(payload)).toBe(true);
});
it("decodes concatenated xz streams and sums their declared sizes", async () => {
const first = Buffer.from("first stream\n");
const second = Buffer.from("second stream\n");
const combined = Buffer.concat([
compressXz(first),
Buffer.alloc(4),
compressXz(second),
]);
expect(xzUncompressedSize(combined)).toBe(first.length + second.length);
const decoded = await decodeXz(combined, 4096);
expect(decoded.ok).toBe(true);
if (!decoded.ok) throw new Error("Expected concatenated xz decode");
expect(Buffer.from(decoded.value).toString("utf8")).toBe(
"first stream\nsecond stream\n",
);
});
it("skips trailing 4-byte stream padding before reading the footer", async () => {
const payload = Buffer.from("data.tar contents\n");
const padded = Buffer.concat([compressXz(payload), Buffer.alloc(8)]);
expect(xzUncompressedSize(padded)).toBe(payload.length);
const decoded = await decodeXz(padded, 4096);
expect(decoded.ok).toBe(true);
if (!decoded.ok) throw new Error("Expected padded xz decode");
expect(Buffer.from(decoded.value).equals(payload)).toBe(true);
});
it("rejects zero padding that is not a multiple of four bytes", () => {
const padded = Buffer.concat([
compressXz(Buffer.from("hello")),
Buffer.alloc(3),
]);
expect(xzUncompressedSize(padded)).toBeNull();
});
it("refuses a truncated xz stream", async () => {
const compressed = compressXz(Buffer.from("hello"));
const decoded = await decodeXz(compressed.subarray(0, 8), 4096);
expect(decoded).toEqual({ ok: false, error: { kind: "truncated" } });
});
it("refuses a corrupt xz stream", async () => {
const compressed = compressXz(Buffer.from("hello"));
compressed.writeUInt8(compressed.readUInt8(20) ^ 0xff, 20);
const decoded = await decodeXz(compressed, 4096);
expect(decoded.ok).toBe(false);
if (decoded.ok) throw new Error("Expected corrupt xz");
expect(decoded.error.kind).toBe("malformed");
});
it("refuses xz output past the selected limit before expanding", async () => {
const payload = Buffer.alloc(4096, 2);
const decoded = await decodeXz(compressXz(payload), 64);
expect(decoded).toEqual({ ok: false, error: { kind: "too_large" } });
});
it("refuses an xz stream declaring an oversized LZMA2 dictionary before decoding", async () => {
const base = compressXz(Buffer.from("small payload"));
// prop=32 -> 256 MiB, prop=40 -> 4 GiB - 1 (both above 128 MiB ceiling)
expect(lzma2DictionaryBytes(32)).toBe(256 * 1024 * 1024);
expect(lzma2DictionaryBytes(40)).toBe(0xffffffff);
const hugeDict = withLzma2DictionaryProp(base, 40);
let decodes = 0;
replaceXzBindingForTests({
status: "ready",
api: {
compressSync: (input) =>
compressXz(typeof input === "string" ? Buffer.from(input) : input),
decompressStream: (input) => {
decodes += 1;
return input as unknown as ReadableStream<Buffer>;
},
},
});
const decoded = await decodeXz(hugeDict, 1 << 20);
expect(decoded).toEqual({
ok: false,
error: {
kind: "dictionary_too_large",
dictionaryBytes: 0xffffffff,
maximum: XZ_DICTIONARY_MAX_BYTES,
},
});
expect(decodes).toBe(0);
});
it("stops streaming decode when a spoofed xz index under-reports expanded size", async () => {
// Real stream expands to 2 MiB, but its rewritten index claims only 16 bytes.
const realCompressed = compressXz(Buffer.alloc(2 * 1024 * 1024, 0x41));
const spoofed = withSpoofedIndexUncompressedSize(realCompressed, 16);
expect(xzUncompressedSize(spoofed)).toBe(16);
const decoded = await decodeXz(spoofed, 128 * 1024);
expect(decoded).toEqual({ ok: false, error: { kind: "too_large" } });
});
it("honors an already-aborted AbortSignal before decoding", async () => {
const controller = new AbortController();
const reason = new Error("caller cancelled xz decode");
controller.abort(reason);
const error = await decodeXz(
compressXz(Buffer.from("hello")),
4096,
controller.signal,
).catch((caught: unknown) => caught);
expect(error).toBeInstanceOf(AnalysisCancelledError);
expect(error).toMatchObject({
_tag: "AnalysisCancelledError",
operation: "inspect_deb_package",
cause: reason,
});
});
it("wraps a raw mid-stream abort reason as a typed AnalysisCancelledError", async () => {
const controller = new AbortController();
const reason = new Error("caller cancelled mid-stream xz decode");
const compressed = compressXz(Buffer.from("hello"));
replaceXzBindingForTests({
status: "ready",
api: {
compressSync: (input) =>
compressXz(typeof input === "string" ? Buffer.from(input) : input),
decompressStream: () =>
new ReadableStream<Buffer>({
pull() {
controller.abort(reason);
throw reason;
},
}),
},
});
const error = await decodeXz(compressed, 4096, controller.signal).catch(
(caught: unknown) => caught,
);
expect(error).toBeInstanceOf(AnalysisCancelledError);
expect(error).toMatchObject({
_tag: "AnalysisCancelledError",
operation: "inspect_deb_package",
cause: reason,
});
});
it("rejects a crafted high-record-count xz index upfront without retaining block objects", async () => {
const recordCount = 1_000_000;
// Valid 12-byte XZ Stream Header (CRC64 check type 0x04).
const header = Buffer.alloc(12);
Buffer.from([0xfd, 0x37, 0x7a, 0x58, 0x5a, 0x00, 0x00, 0x04]).copy(header);
writeU32LE(header, 8, crc32(header.subarray(6, 8)));
// Crafted XZ Index with 1,000,000 two-byte (unpadded=8, uncompressed=0) records
// and no physical blocks before it (~2 MiB index, valid CRC32).
const countBytes = encodeMbInt(recordCount);
const recordsBytes = Buffer.alloc(recordCount * 2);
for (let i = 0; i < recordCount; i++) {
recordsBytes[i * 2] = 0x08; // unpadded = 8
recordsBytes[i * 2 + 1] = 0x00; // uncompressed = 0
}
const bodyLen = 1 + countBytes.length + recordsBytes.length;
const padLen = (4 - (bodyLen % 4)) % 4;
const index = Buffer.alloc(bodyLen + padLen + 4);
index[0] = 0x00;
countBytes.copy(index, 1);
recordsBytes.copy(index, 1 + countBytes.length);
writeU32LE(
index,
bodyLen + padLen,
crc32(index.subarray(0, bodyLen + padLen)),
);
// Valid 12-byte XZ Stream Footer pointing to the crafted index.
const footer = Buffer.alloc(12);
writeU32LE(footer, 4, index.length / 4 - 1);
footer[8] = 0x00;
footer[9] = 0x04;
footer[10] = 0x59;
footer[11] = 0x5a;
writeU32LE(footer, 0, crc32(footer.subarray(4, 10)));
const crafted = Buffer.concat([header, index, footer]);
let decodes = 0;
replaceXzBindingForTests({
status: "ready",
api: {
compressSync: (input) =>
compressXz(typeof input === "string" ? Buffer.from(input) : input),
decompressStream: (input) => {
decodes += 1;
return input as unknown as ReadableStream<Buffer>;
},
},
});
expect(xzUncompressedSize(crafted)).toBeNull();
const decoded = await decodeXz(crafted, 1 << 20);
expect(decoded).toEqual({ ok: false, error: { kind: "malformed" } });
expect(decodes).toBe(0);
});
it("refuses xz when the native binding cannot load", async () => {
const compressed = compressXz(Buffer.from("x"));
replaceXzBindingForTests({
status: "unavailable",
cause: new Error("missing addon"),
});
expect(await decodeXz(compressed, 64)).toEqual({
ok: false,
error: { kind: "unavailable" },
});
});
it("refuses an xz stream whose index cannot be read before decoding it", async () => {
const compressed = Buffer.from(compressXz(Buffer.alloc(1024, 0x61)));
// Corrupt the footer's backward size so the index cannot be located.
compressed[compressed.length - 8] = 0xff;
compressed[compressed.length - 7] = 0xff;
let decodes = 0;
replaceXzBindingForTests({
status: "ready",
api: {
compressSync: (input) =>
compressXz(typeof input === "string" ? Buffer.from(input) : input),
decompressStream: (input) => {
decodes += 1;
return input as unknown as ReadableStream<Buffer>;
},
},
});
expect(await decodeXz(compressed, 1 << 20)).toEqual({
ok: false,
error: { kind: "malformed" },
});
expect(decodes).toBe(0);
});
const extractSingleBlock = (
xz: Buffer,
): {
readonly header: Buffer;
readonly block: Buffer;
readonly unpadded: number;
readonly uncompressed: number;
readonly flags1: number;
} => {
const footerStart = xz.length - 12;
const backwardSize = (xz.readUInt32LE(footerStart + 4) + 1) * 4;
const indexStart = footerStart - backwardSize;
const readMb = (offset: number): { value: number; next: number } => {
let value = 0;
let shift = 0;
for (let i = offset; i < footerStart - 4; i++) {
const b = xz[i]!;
value += (b & 0x7f) * 2 ** shift;
shift += 7;
if ((b & 0x80) === 0) return { value, next: i + 1 };
}
throw new Error("invalid mbint");
};
const unpadded = readMb(indexStart + 2);
const uncompressed = readMb(unpadded.next);
return {
header: xz.subarray(0, 12),
block: Buffer.from(xz.subarray(12, indexStart)),
unpadded: unpadded.value,
uncompressed: uncompressed.value,
flags1: xz[7]!,
};
};
const assembleXzStream = (
header: Buffer,
flags1: number,
blocks: readonly Buffer[],
records: readonly {
readonly unpadded: number;
readonly uncompressed: number;
}[],
): Buffer => {
const recordBuffers = records.flatMap((record) => [
encodeMbInt(record.unpadded),
encodeMbInt(record.uncompressed),
]);
const indexBody = Buffer.concat([
Buffer.from([0x00]),
encodeMbInt(records.length),
...recordBuffers,
]);
const padLen = (4 - (indexBody.length % 4)) % 4;
const indexNoCrc = Buffer.concat([indexBody, Buffer.alloc(padLen)]);
const indexCrc = Buffer.alloc(4);
writeU32LE(indexCrc, 0, crc32(indexNoCrc));
const index = Buffer.concat([indexNoCrc, indexCrc]);
const footer = Buffer.alloc(12);
writeU32LE(footer, 4, index.length / 4 - 1);
footer[8] = 0x00;
footer[9] = flags1;
footer[10] = 0x59;
footer[11] = 0x5a;
writeU32LE(footer, 0, crc32(footer.subarray(4, 10)));
return Buffer.concat([header, ...blocks, index, footer]);
};
it("decodes a valid multi-block xz stream by walking actual block boundaries", async () => {
const first = extractSingleBlock(compressXz(Buffer.from("block-one\n")));
const second = extractSingleBlock(compressXz(Buffer.from("block-two\n")));
const twoBlock = assembleXzStream(
first.header,
first.flags1,
[first.block, second.block],
[
{ unpadded: first.unpadded, uncompressed: first.uncompressed },
{ unpadded: second.unpadded, uncompressed: second.uncompressed },
],
);
expect(xzUncompressedSize(twoBlock)).toBe(
first.uncompressed + second.uncompressed,
);
const decoded = await decodeXz(twoBlock, 4096);
expect(decoded.ok).toBe(true);
if (!decoded.ok) throw new Error("Expected multi-block xz decode");
expect(Buffer.from(decoded.value).toString("utf8")).toBe(
"block-one\nblock-two\n",
);
});
it("refuses a forged xz index record that spans two blocks to hide an oversized LZMA2 dictionary", async () => {
const first = extractSingleBlock(compressXz(Buffer.from("benign-1")));
const hugeSecondXz = withLzma2DictionaryProp(
compressXz(Buffer.from("hidden-2")),
40,
);
const second = extractSingleBlock(hugeSecondXz);
// Forge a single index record whose unpadded size spans block 1 (padded) +
// block 2, hiding block 2's 4 GiB LZMA2 dictionary from index-only jumps.
const forged = assembleXzStream(
first.header,
first.flags1,
[first.block, second.block],
[
{
unpadded: first.block.length + second.unpadded,
uncompressed: first.uncompressed,
},
],
);
let decodes = 0;
replaceXzBindingForTests({
status: "ready",
api: {
compressSync: (input) =>
compressXz(typeof input === "string" ? Buffer.from(input) : input),
decompressStream: (input) => {
decodes += 1;
return input as unknown as ReadableStream<Buffer>;
},
},
});
expect(xzUncompressedSize(forged)).toBeNull();
const decoded = await decodeXz(forged, 1 << 20);
expect(decoded).toEqual({ ok: false, error: { kind: "malformed" } });
expect(decodes).toBe(0);
});
it("refuses an oversized LZMA2 dictionary in a later block of a multi-block xz stream", async () => {
const first = extractSingleBlock(compressXz(Buffer.from("benign-1")));
const second = extractSingleBlock(
withLzma2DictionaryProp(compressXz(Buffer.from("oversized-2")), 40),
);
const stream = assembleXzStream(
first.header,
first.flags1,
[first.block, second.block],
[
{ unpadded: first.unpadded, uncompressed: first.uncompressed },
{ unpadded: second.unpadded, uncompressed: second.uncompressed },
],
);
let decodes = 0;
replaceXzBindingForTests({
status: "ready",
api: {
compressSync: (input) =>
compressXz(typeof input === "string" ? Buffer.from(input) : input),
decompressStream: (input) => {
decodes += 1;
return input as unknown as ReadableStream<Buffer>;
},
},
});
const decoded = await decodeXz(stream, 1 << 20);
expect(decoded).toEqual({
ok: false,
error: {
kind: "dictionary_too_large",
dictionaryBytes: 0xffffffff,
maximum: XZ_DICTIONARY_MAX_BYTES,
},
});
expect(decodes).toBe(0);
});
+554
View File
@@ -0,0 +1,554 @@
import { createRequire } from "node:module";
import { crc32 } from "node:zlib";
import {
AnalysisCancelledError,
cancelledBy,
isAborted,
} from "../domain/analysisErrorCore.js";
import { err, ok, type Result } from "../domain/result.js";
import { errorMessage } from "../kernel/errorMessage.js";
import { isAbortOf } from "../process/SignalAbort.js";
const OPERATION = "inspect_deb_package";
const XZ_MAGIC = Buffer.from([0xfd, 0x37, 0x7a, 0x58, 0x5a, 0x00]);
const XZ_HEADER_SIZE = 12;
const XZ_FOOTER_SIZE = 12;
const XZ_MIN_BLOCK_SIZE = 8;
const XZ_FILTER_LZMA2 = 0x21;
const XZ_STREAM_INPUT_CHUNK_BYTES = 64 * 1024;
/**
* Fixed XZ LZMA2 dictionary allowance: 128 MiB, matching the Zstandard window
* ceiling. Covers standard `xz -0`..`xz -9` presets (up to 64 MiB) while
* refusing pathological 256 MiB–4 GiB dictionary declarations before the
* native decoder allocates working memory.
*/
export const XZ_DICTIONARY_MAX_BYTES = 128 * 1024 * 1024;
type XzApi = {
readonly decompressStream: (
input: ReadableStream<Uint8Array>,
) => ReadableStream<Buffer>;
readonly compressSync: (input: string | Uint8Array) => Buffer;
};
export type XzBinding =
| { readonly status: "ready"; readonly api: XzApi }
| { readonly status: "unavailable"; readonly cause: unknown };
export type XzDecodeFailure =
| { readonly kind: "unavailable" }
| { readonly kind: "truncated" }
| { readonly kind: "malformed"; readonly cause?: unknown }
| { readonly kind: "too_large" }
| {
readonly kind: "dictionary_too_large";
readonly dictionaryBytes: number;
readonly maximum: number;
};
let loaded: XzBinding | undefined;
let override: XzBinding | undefined;
const loadNativeXz = (): XzBinding => {
try {
const require = createRequire(import.meta.url);
const api = require("@napi-rs/lzma/xz") as XzApi;
if (
typeof api.decompressStream !== "function" ||
typeof api.compressSync !== "function"
)
throw new Error(
"@napi-rs/lzma/xz does not export streaming xz decompression and sync compression.",
);
return { status: "ready", api };
} catch (cause: unknown) {
return { status: "unavailable", cause };
}
};
export const loadXzBinding = (): XzBinding => {
if (override !== undefined) return override;
loaded ??= loadNativeXz();
return loaded;
};
/** Substitute the native binding in tests; pass undefined to restore. */
export const replaceXzBindingForTests = (
binding: XzBinding | undefined,
): void => {
override = binding;
};
const throwIfAborted = (signal: AbortSignal | undefined): void => {
if (isAborted(signal)) throw cancelledBy(OPERATION, signal);
};
const hasMagicAt = (bytes: Uint8Array, offset: number): boolean => {
if (offset < 0 || offset + XZ_MAGIC.length > bytes.length) return false;
for (let i = 0; i < XZ_MAGIC.length; i++)
if (bytes[offset + i] !== XZ_MAGIC[i]) return false;
return true;
};
const readU32LE = (bytes: Uint8Array, offset: number): number =>
(bytes[offset]! |
(bytes[offset + 1]! << 8) |
(bytes[offset + 2]! << 16) |
(bytes[offset + 3]! << 24)) >>>
0;
const readMbInt = (
bytes: Uint8Array,
offset: number,
end: number = bytes.length,
): { readonly value: number; readonly next: number } | null => {
let value = 0;
for (let index = 0; index < 9; index++) {
if (offset + index >= end) return null;
const byte = bytes[offset + index]!;
value += (byte & 0x7f) * 128 ** index;
if (!Number.isSafeInteger(value)) return null;
if ((byte & 0x80) === 0) return { value, next: offset + index + 1 };
}
return null;
};
/** Decode an LZMA2 filter properties byte into dictionary bytes (XZ spec §5.3.1). */
export const lzma2DictionaryBytes = (props: number): number | null => {
if (!Number.isInteger(props) || props < 0 || props > 40) return null;
if (props === 40) return 0xffffffff;
return (2 | (props & 1)) * 2 ** (Math.floor(props / 2) + 11);
};
const checkSizeForFlags = (flagsByte1: number): number | null => {
if ((flagsByte1 & 0xf0) !== 0) return null;
switch (flagsByte1 & 0x0f) {
case 0x00:
return 0;
case 0x01:
return 4;
case 0x04:
return 8;
case 0x0a:
return 32;
default:
return null;
}
};
/**
* Walk LZMA2 chunk headers from `start` within `[start, end)` to establish the
* exact Compressed Data byte length (including the `0x00` end-of-payload
* marker) and chunk-declared uncompressed byte count without decompressing.
*/
const scanLzma2Block = (
bytes: Uint8Array,
start: number,
end: number,
): {
readonly compressedSize: number;
readonly uncompressedSize: number;
} | null => {
let cursor = start;
let uncompressedSize = 0;
while (cursor < end) {
const control = bytes[cursor]!;
if (control === 0x00)
return {
compressedSize: cursor + 1 - start,
uncompressedSize,
};
if (control === 0x01 || control === 0x02) {
if (cursor + 3 > end) return null;
const chunkUncompressed =
((bytes[cursor + 1]! << 8) | bytes[cursor + 2]!) + 1;
cursor += 3 + chunkUncompressed;
if (cursor > end) return null;
uncompressedSize += chunkUncompressed;
if (!Number.isSafeInteger(uncompressedSize)) return null;
continue;
}
if (control < 0x80) return null;
const headerLength = control >= 0xc0 ? 6 : 5;
if (cursor + headerLength > end) return null;
const chunkUncompressed =
(((control & 0x1f) << 16) |
(bytes[cursor + 1]! << 8) |
bytes[cursor + 2]!) +
1;
const chunkCompressed =
((bytes[cursor + 3]! << 8) | bytes[cursor + 4]!) + 1;
cursor += headerLength + chunkCompressed;
if (cursor > end) return null;
uncompressedSize += chunkUncompressed;
if (!Number.isSafeInteger(uncompressedSize)) return null;
}
return null;
};
/**
* End of the stream before trailing Stream Padding. The xz format allows zero
* padding in 4-byte groups after the footer; a ragged zero tail stays in place
* so the footer check rejects it.
*/
const xzStreamEnd = (
bytes: Uint8Array,
from: number = bytes.length,
): number => {
let end = from;
while (
end >= 4 &&
bytes[end - 1] === 0 &&
bytes[end - 2] === 0 &&
bytes[end - 3] === 0 &&
bytes[end - 4] === 0
)
end -= 4;
return end;
};
const xzFooterPresent = (bytes: Uint8Array): boolean => {
const end = xzStreamEnd(bytes);
return (
end >= XZ_HEADER_SIZE + XZ_FOOTER_SIZE &&
hasMagicAt(bytes, 0) &&
bytes[end - 2] === 0x59 &&
bytes[end - 1] === 0x5a
);
};
interface XzPreflight {
readonly declaredUncompressed: number;
readonly maxDictionaryBytes: number;
}
/**
* Validate every stream header, footer, index, and block header in an `.xz`
* byte buffer before any bytes reach the native decoder. Verifies CRCs,
* declared uncompressed sizes, and every LZMA2 dictionary size property byte.
*/
const inspectXzStreams = (
bytes: Uint8Array,
maxUncompressed?: number,
): Result<XzPreflight, XzDecodeFailure> => {
if (bytes.length < XZ_HEADER_SIZE + XZ_FOOTER_SIZE)
return err({ kind: "truncated" });
if (!hasMagicAt(bytes, 0)) return err({ kind: "malformed" });
let streamEnd = xzStreamEnd(bytes);
if (streamEnd < XZ_HEADER_SIZE + XZ_FOOTER_SIZE)
return err({ kind: xzFooterPresent(bytes) ? "malformed" : "truncated" });
let totalUncompressed = 0;
let maxDictionaryBytes = 0;
while (streamEnd > 0) {
if (streamEnd < XZ_HEADER_SIZE + XZ_FOOTER_SIZE)
return err({ kind: "malformed" });
const footer = streamEnd - XZ_FOOTER_SIZE;
if (bytes[footer + 10] !== 0x59 || bytes[footer + 11] !== 0x5a)
return err({
kind: streamEnd === xzStreamEnd(bytes) ? "truncated" : "malformed",
});
if (
readU32LE(bytes, footer) !==
crc32(bytes.subarray(footer + 4, footer + 10))
)
return err({ kind: "malformed" });
const flags0 = bytes[footer + 8]!;
const flags1 = bytes[footer + 9]!;
const checkSize = checkSizeForFlags(flags1);
if (flags0 !== 0x00 || checkSize === null)
return err({ kind: "malformed" });
const backwardSize = (readU32LE(bytes, footer + 4) + 1) * 4;
const indexStart = footer - backwardSize;
if (indexStart < XZ_HEADER_SIZE || backwardSize < 8)
return err({ kind: "malformed" });
const index = bytes.subarray(indexStart, footer);
const indexBodyEnd = index.length - 4;
if (index[0] !== 0x00) return err({ kind: "malformed" });
if (
readU32LE(index, indexBodyEnd) !== crc32(index.subarray(0, indexBodyEnd))
)
return err({ kind: "malformed" });
const records = readMbInt(index, 1, indexBodyEnd);
if (records === null) return err({ kind: "malformed" });
// Reject impossible record counts upfront before scanning: each block
// occupies at least XZ_MIN_BLOCK_SIZE bytes before the index and each
// index record occupies at least 2 bytes.
const availableBlockBytes = indexStart - XZ_HEADER_SIZE;
const maxPossibleBlocks = Math.min(
Math.floor(availableBlockBytes / XZ_MIN_BLOCK_SIZE),
Math.floor((indexBodyEnd - records.next) / 2),
);
if (records.value > maxPossibleBlocks) return err({ kind: "malformed" });
let cursor = records.next;
let totalBlocksPadded = 0;
for (let n = 0; n < records.value; n++) {
const unpadded = readMbInt(index, cursor, indexBodyEnd);
if (unpadded === null || unpadded.value < XZ_MIN_BLOCK_SIZE)
return err({ kind: "malformed" });
const size = readMbInt(index, unpadded.next, indexBodyEnd);
if (size === null) return err({ kind: "malformed" });
const padded = Math.ceil(unpadded.value / 4) * 4;
totalBlocksPadded += padded;
if (
!Number.isSafeInteger(totalBlocksPadded) ||
totalBlocksPadded > availableBlockBytes
)
return err({ kind: "malformed" });
totalUncompressed += size.value;
if (!Number.isSafeInteger(totalUncompressed))
return err({ kind: "malformed" });
if (maxUncompressed !== undefined && totalUncompressed > maxUncompressed)
return err({ kind: "too_large" });
cursor = size.next;
}
const indexPadLength = indexBodyEnd - cursor;
if (indexPadLength < 0 || indexPadLength > 3)
return err({ kind: "malformed" });
for (let i = cursor; i < indexBodyEnd; i++)
if (index[i] !== 0) return err({ kind: "malformed" });
const streamHeaderStart = indexStart - totalBlocksPadded - XZ_HEADER_SIZE;
if (streamHeaderStart < 0 || !hasMagicAt(bytes, streamHeaderStart))
return err({ kind: "malformed" });
if (
bytes[streamHeaderStart + 6] !== flags0 ||
bytes[streamHeaderStart + 7] !== flags1
)
return err({ kind: "malformed" });
if (
readU32LE(bytes, streamHeaderStart + 8) !==
crc32(bytes.subarray(streamHeaderStart + 6, streamHeaderStart + 8))
)
return err({ kind: "malformed" });
// Walk actual XZ blocks sequentially from the stream header by framing each
// block's LZMA2 payload, verifying every block boundary against the index
// so a forged index record cannot span two blocks and hide the second.
let blockOffset = streamHeaderStart + XZ_HEADER_SIZE;
let recordCursor = records.next;
let scannedUncompressed = 0;
for (let n = 0; n < records.value; n++) {
const unpadded = readMbInt(index, recordCursor, indexBodyEnd);
if (unpadded === null) return err({ kind: "malformed" });
const size = readMbInt(index, unpadded.next, indexBodyEnd);
if (size === null) return err({ kind: "malformed" });
recordCursor = size.next;
const encodedHeaderSize = bytes[blockOffset];
if (encodedHeaderSize === undefined || encodedHeaderSize === 0)
return err({ kind: "malformed" });
const blockHeaderSize = (encodedHeaderSize + 1) * 4;
if (blockOffset + blockHeaderSize + checkSize > indexStart)
return err({ kind: "malformed" });
const blockHeader = bytes.subarray(
blockOffset,
blockOffset + blockHeaderSize,
);
if (
readU32LE(blockHeader, blockHeaderSize - 4) !==
crc32(blockHeader.subarray(0, blockHeaderSize - 4))
)
return err({ kind: "malformed" });
const blockFlags = blockHeader[1]!;
if ((blockFlags & 0x3c) !== 0) return err({ kind: "malformed" });
const numFilters = (blockFlags & 0x03) + 1;
let headerCursor = 2;
const headerBodyEnd = blockHeaderSize - 4;
let headerCompressedSize: number | null = null;
if ((blockFlags & 0x40) !== 0) {
const compressedSize = readMbInt(
blockHeader,
headerCursor,
headerBodyEnd,
);
if (compressedSize === null) return err({ kind: "malformed" });
headerCompressedSize = compressedSize.value;
headerCursor = compressedSize.next;
}
if ((blockFlags & 0x80) !== 0) {
const uncompressedSize = readMbInt(
blockHeader,
headerCursor,
headerBodyEnd,
);
if (uncompressedSize === null || uncompressedSize.value !== size.value)
return err({ kind: "malformed" });
headerCursor = uncompressedSize.next;
}
for (let f = 0; f < numFilters; f++) {
const filterId = readMbInt(blockHeader, headerCursor, headerBodyEnd);
if (filterId === null) return err({ kind: "malformed" });
const propsSize = readMbInt(blockHeader, filterId.next, headerBodyEnd);
if (propsSize === null) return err({ kind: "malformed" });
headerCursor = propsSize.next;
if (headerCursor + propsSize.value > headerBodyEnd)
return err({ kind: "malformed" });
const isLastFilter = f === numFilters - 1;
if (filterId.value === XZ_FILTER_LZMA2) {
if (!isLastFilter || propsSize.value !== 1)
return err({ kind: "malformed" });
const dictBytes = lzma2DictionaryBytes(blockHeader[headerCursor]!);
if (dictBytes === null) return err({ kind: "malformed" });
if (dictBytes > maxDictionaryBytes) maxDictionaryBytes = dictBytes;
if (dictBytes > XZ_DICTIONARY_MAX_BYTES)
return err({
kind: "dictionary_too_large",
dictionaryBytes: dictBytes,
maximum: XZ_DICTIONARY_MAX_BYTES,
});
} else if (isLastFilter) {
return err({ kind: "malformed" });
}
headerCursor += propsSize.value;
}
for (let i = headerCursor; i < headerBodyEnd; i++)
if (blockHeader[i] !== 0) return err({ kind: "malformed" });
const compressedStart = blockOffset + blockHeaderSize;
const scanned = scanLzma2Block(
bytes,
compressedStart,
indexStart - checkSize,
);
if (scanned === null) return err({ kind: "malformed" });
if (
headerCompressedSize !== null &&
scanned.compressedSize !== headerCompressedSize
)
return err({ kind: "malformed" });
const padStart = compressedStart + scanned.compressedSize;
const padLength = (4 - (scanned.compressedSize % 4)) % 4;
const blockEnd = padStart + padLength + checkSize;
if (blockEnd > indexStart) return err({ kind: "malformed" });
for (let i = 0; i < padLength; i++)
if (bytes[padStart + i] !== 0) return err({ kind: "malformed" });
const actualUnpadded =
blockHeaderSize + scanned.compressedSize + checkSize;
if (actualUnpadded !== unpadded.value) return err({ kind: "malformed" });
scannedUncompressed += scanned.uncompressedSize;
if (!Number.isSafeInteger(scannedUncompressed))
return err({ kind: "malformed" });
if (
maxUncompressed !== undefined &&
scannedUncompressed > maxUncompressed
)
return err({ kind: "too_large" });
blockOffset = blockEnd;
}
if (blockOffset !== indexStart) return err({ kind: "malformed" });
streamEnd = xzStreamEnd(bytes, streamHeaderStart);
}
return ok({
declaredUncompressed: totalUncompressed,
maxDictionaryBytes,
});
};
/** Uncompressed size from a completed xz stream index, or null when absent/invalid. */
export const xzUncompressedSize = (bytes: Uint8Array): number | null => {
const preflight = inspectXzStreams(bytes);
return preflight.ok ? preflight.value.declaredUncompressed : null;
};
const isTruncatedXzError = (cause: unknown): boolean => {
return /failed to fill whole buffer|unexpected eof/iu.test(
errorMessage(cause),
);
};
const chunkedReadableStream = (
bytes: Uint8Array,
): ReadableStream<Uint8Array> => {
let offset = 0;
return new ReadableStream<Uint8Array>({
pull(controller) {
if (offset >= bytes.length) {
controller.close();
return;
}
const end = Math.min(offset + XZ_STREAM_INPUT_CHUNK_BYTES, bytes.length);
controller.enqueue(bytes.subarray(offset, end));
offset = end;
},
});
};
export const decodeXz = async (
bytes: Uint8Array,
limit: number,
signal?: AbortSignal,
): Promise<Result<Uint8Array, XzDecodeFailure>> => {
throwIfAborted(signal);
const binding = loadXzBinding();
if (binding.status === "unavailable") return err({ kind: "unavailable" });
// Validate stream framing, CRCs, LZMA2 dictionary size, and index-declared
// uncompressed size before any bytes reach the native decoder.
const preflight = inspectXzStreams(bytes, limit);
if (!preflight.ok) return preflight;
// Stream-decode with a hard chunk-by-chunk output cap so a spoofed index
// cannot cause unbounded output allocation.
const reader = binding.api
.decompressStream(chunkedReadableStream(bytes))
.getReader();
const onAbort = (): void => {
void reader.cancel().catch(() => {});
};
signal?.addEventListener("abort", onAbort, { once: true });
const chunks: Uint8Array[] = [];
let total = 0;
try {
for (;;) {
throwIfAborted(signal);
const { done, value } = await reader.read();
throwIfAborted(signal);
if (done) break;
if (value.length === 0) continue;
total += value.length;
if (total > limit) {
await reader.cancel().catch(() => {});
return err({ kind: "too_large" });
}
chunks.push(value);
}
return ok(chunks.length === 1 ? chunks[0]! : Buffer.concat(chunks, total));
} catch (cause: unknown) {
await reader.cancel().catch(() => {});
if (cause instanceof AnalysisCancelledError) throw cause;
if (isAbortOf(cause, signal)) throw cancelledBy(OPERATION, signal);
if (!hasMagicAt(bytes, 0) || bytes.length < 32 || isTruncatedXzError(cause))
return err({ kind: "truncated" });
return err({ kind: "malformed", cause });
} finally {
signal?.removeEventListener("abort", onAbort);
reader.releaseLock();
}
};
export const compressXz = (bytes: Uint8Array): Buffer => {
const binding = loadXzBinding();
if (binding.status !== "ready")
throw new Error("xz compressor is unavailable on this platform.");
return binding.api.compressSync(bytes);
};
+2
View File
@@ -23,6 +23,7 @@ import { projectApkSignatureView } from "./apkSignatureView.js";
import { byteEntropySchema } from "../native/byteEntropy.js";
import { projectErlangBeamView } from "./erlangBeamView.js";
import { projectPythonPycView } from "./pythonPycView.js";
import { projectDebPackageView } from "./debPackageView.js";
import { projectNugetNupkgView } from "./nugetNupkgView.js";
import { projectVsixPackageView } from "./vsixPackageView.js";
import { projectOciImageLayoutView } from "./ociImageLayoutView.js";
@@ -214,6 +215,7 @@ const retainedViewProjectors = new Map<string, RetainedViewProjector>([
retain("inspect_elf_dependencies", projectElfDependenciesView),
retain("inspect_native_load_image", projectNativeLoadImageView),
retain("inspect_python_pyc", projectPythonPycView),
retain("inspect_deb_package", projectDebPackageView),
retain("inspect_nuget_nupkg", projectNugetNupkgView),
retain("inspect_vsix_package", projectVsixPackageView),
retain("inspect_oci_image_layout", projectOciImageLayoutView),
@@ -274,6 +274,7 @@ import { nativeLoadImageSummaryViewResultSchema } from "./summarySchemas/nativeL
import { nativeObservationSummaryViewResultSchemas } from "./summarySchemas/nativeObservationSummarySchemas.js";
import { nativeProcedureReferencesSummaryViewResultSchema } from "./summarySchemas/nativeProcedureReferencesSummarySchema.js";
import { nativeValueTraceSummaryViewResultSchema } from "./summarySchemas/nativeValueTraceSummarySchema.js";
import { debPackageSummaryViewResultSchema } from "./summarySchemas/debPackageSummarySchema.js";
import { nugetNupkgSummaryViewResultSchema } from "./summarySchemas/nugetNupkgSummarySchema.js";
import { objdumpSummaryViewResultSchema } from "./summarySchemas/objdumpSummarySchema.js";
import { ociImageLayoutSummaryViewResultSchema } from "./summarySchemas/ociImageLayoutSummarySchema.js";
@@ -347,6 +348,7 @@ export {
byteEntropyPageViewResultSchema,
byteEntropySummaryViewResultSchema,
dartAotSummaryViewResultSchema,
debPackageSummaryViewResultSchema,
desktopApplicationSummaryViewResultSchema,
devicetreeSummaryViewResultSchema,
elfDependenciesSummaryViewResultSchema,
@@ -421,6 +423,7 @@ const viewResultBase = {
parent_operation: z.enum([
"trace_web_source_location",
"inspect_python_pyc",
"inspect_deb_package",
"inspect_nuget_nupkg",
"inspect_vsix_package",
"inspect_oci_image_layout",
@@ -790,6 +793,7 @@ export const analysisViewResultSchema = z.discriminatedUnion("kind", [
uefiFirmwareSummaryViewResultSchema,
uefiExtractionSummaryViewResultSchema,
pythonPycSummaryViewResultSchema,
debPackageSummaryViewResultSchema,
nativeExportsSummaryViewResultSchema,
elfDependenciesSummaryViewResultSchema,
byteEntropySummaryViewResultSchema,
+98
View File
@@ -0,0 +1,98 @@
import { z } from "zod";
import { debPackageSchema } from "../deb/debPackage.js";
import { err, ok } from "../result.js";
import type { AnalysisViewParent } from "./analysisViewParent.js";
import {
ownedView,
type AdmittedView,
type SummaryAnalysisView,
} from "./analysisViewShape.js";
import { analysisViewInputError } from "./analysisViewErrors.js";
import { createAnalysisViewResultReader } from "./analysisViewParent.js";
import {
boundedViewMessages,
completeWithinViewCoverage,
} from "./analysisViewCoverage.js";
/** Package identity and counts; member rows and relationships stay in the complete parent. */
export const debPackageSummarySchema = debPackageSchema
.pick({
artifact: true,
ar: true,
coverage: true,
})
.extend({
package: z.string().min(1).nullable(),
version: z.string().min(1).nullable(),
architecture: z.string().min(1).nullable(),
relationship_group_count: z.int().nonnegative(),
maintainer_script_count: z.int().nonnegative(),
data_entry_count: z.int().nonnegative(),
issue_count: z.int().nonnegative(),
limitation_count: z.int().nonnegative(),
});
const readReport = createAnalysisViewResultReader(debPackageSchema);
const relationshipGroupCount = (
relationships: Record<string, readonly unknown[] | null>,
): number =>
Object.values(relationships).reduce(
(total, groups) => total + (groups?.length ?? 0),
0,
);
/** Summarize retained Debian package facts without reopening the .deb. */
export const projectDebPackageView = (
parent: AnalysisViewParent,
admitted: AdmittedView,
) => {
const view = ownedView<SummaryAnalysisView>(admitted, "summary");
if (view === undefined)
return err(
analysisViewInputError([
{
path: ["view"],
reason: "invalid_value",
message: "Debian package Evidence supports the summary view.",
},
]),
);
const parsed = readReport(parent);
if (!parsed.ok) return parsed;
const report = parsed.value;
return ok({
parent_evidence_id: parent.evidenceId,
parent_operation: "inspect_deb_package" as const,
parent_digest: parent.evidenceId.slice(3),
artifact: {
path: report.artifact.path,
sha256: report.artifact.sha256,
},
limitations: boundedViewMessages(
[...parent.limitations, ...report.limitations],
parent.evidenceId,
"limitations",
),
unknowns: [],
kind: "summary" as const,
view,
summary: {
artifact: report.artifact,
ar: report.ar,
coverage: report.coverage,
package: report.control?.package ?? null,
version: report.control?.version?.raw ?? null,
architecture: report.control?.architecture ?? null,
relationship_group_count:
report.control === null
? 0
: relationshipGroupCount(report.control.relationships),
maintainer_script_count: report.control?.maintainer_scripts.length ?? 0,
data_entry_count: report.data_entries.length,
issue_count: report.issues.length,
limitation_count: report.limitations.length,
},
coverage: completeWithinViewCoverage(report.data_entries.length),
});
};
@@ -0,0 +1,9 @@
import { z } from "zod";
import { summaryViewResultBase } from "../analysisViewBase.js";
import { debPackageSummarySchema } from "../debPackageView.js";
export const debPackageSummaryViewResultSchema = z.strictObject({
...summaryViewResultBase,
parent_operation: z.literal("inspect_deb_package"),
summary: debPackageSummarySchema,
});
@@ -6,6 +6,7 @@ import {
espImage,
} from "../../tests/fixtures/espImage.js";
import { buildFv } from "../../tests/fixtures/uefiImage.js";
import { DEB_AR_HEADER_BYTES, DEB_AR_MAGIC } from "./deb/debPackage.js";
import {
recognizeArtifactFormat,
recognizesArtifactPrefix,
@@ -339,3 +340,62 @@ it("lets a prefix the table recognizes outrank whole-file firmware probes", () =
);
expect(recognizesArtifactPrefix(volume, volume.length)).toBe(false);
});
/** Minimal Unix ar archive with the given members (SysV trailing `/` or BSD `#1/N`). */
const minimalAr = (
members: readonly {
readonly name: string;
readonly data: string;
readonly bsdName?: boolean;
}[],
): Buffer => {
const parts: Buffer[] = [DEB_AR_MAGIC];
for (const member of members) {
const payload =
member.bsdName === true
? Buffer.from(`${member.name}${member.data}`, "ascii")
: Buffer.from(member.data, "ascii");
const header = Buffer.alloc(DEB_AR_HEADER_BYTES, 0x20);
const label =
member.bsdName === true
? `#1/${String(member.name.length)}`
: `${member.name}/`;
header.write(label.slice(0, 16), 0, "ascii");
header.write("0", 16, "ascii");
header.write("0", 28, "ascii");
header.write("0", 34, "ascii");
header.write("100644", 40, "ascii");
header.write(String(payload.length), 48, "ascii");
header[58] = 0x60;
header[59] = 0x0a;
parts.push(header, payload);
if (payload.length % 2 === 1) parts.push(Buffer.from("\n", "ascii"));
}
return Buffer.concat(parts);
};
it("recognizes a Debian package ar archive whose first member is debian-binary", () => {
const deb = minimalAr([{ name: "debian-binary", data: "2.0\n" }]);
expect(recognize(deb)).toMatchObject({
state: "recognized",
format: "deb",
});
const bsdDeb = minimalAr([
{ name: "debian-binary", data: "2.0\n", bsdName: true },
]);
expect(recognize(bsdDeb)).toMatchObject({
state: "recognized",
format: "deb",
});
});
it("does not recognize a plain ar archive that is not a Debian package", () => {
const plainAr = minimalAr([{ name: "hello.o", data: "object" }]);
expect(recognize(plainAr)).toBeUndefined();
const lateDebianBinary = minimalAr([
{ name: "hello.o", data: "object" },
{ name: "debian-binary", data: "2.0\n" },
]);
expect(recognize(lateDebianBinary)).toBeUndefined();
expect(recognize(Buffer.from("!<arch>\n", "ascii"))).toBeUndefined();
});
+3
View File
@@ -31,6 +31,7 @@ import {
hasDevicetreeMagic,
readDevicetreeHeader,
} from "./firmware/devicetreeHeader.js";
import { hasDebPackageHeader } from "./deb/debPackage.js";
import { observePythonBytecodePrefix } from "./python/pythonBytecodeIdentity.js";
import { hasSqliteHeader } from "./sqliteFormat.js";
import { recognizeTarPrefix, tarHeaderRefusal } from "./tarFormat.js";
@@ -89,6 +90,7 @@ export const STANDALONE_ARTIFACT_FORMATS = [
"windows-shortcut",
"python-pyc",
"devicetree",
"deb",
] as const;
export type StandaloneArtifactFormat =
@@ -268,6 +270,7 @@ export const ARTIFACT_FORMAT_RECOGNIZERS: readonly ArtifactFormatRecognizer[] =
when("ntfs-mft", hasMftFileRecordHeader),
when("sqlite", hasSqliteHeader),
when("windows-shortcut", hasWindowsShortcutHeader),
when("deb", hasDebPackageHeader),
// Only a pinned CPython magic claims the format; a CR LF trailer alone
// is too weak a signature for arbitrary bytes.
when("python-pyc", (prefix) => {
+2
View File
@@ -124,6 +124,7 @@ export const ARTIFACT_FORMAT_IDS = [
"windows-shortcut",
"python-pyc",
"devicetree",
"deb",
"unknown",
] as const;
@@ -173,6 +174,7 @@ const artifactContentFormatSchema = artifactFormatSchema.extract([
"windows-shortcut",
"python-pyc",
"devicetree",
"deb",
"directory",
"file",
"unknown",
+5
View File
@@ -712,6 +712,11 @@ const STANDALONE_FORMAT_READERS = {
rationale:
"Decode the flattened devicetree header, reservations and node tree.",
},
deb: {
operation: "inspect_deb_package",
rationale:
"Read the ar container, control metadata, maintainer scripts and data.tar inventory without installing or executing the package.",
},
} as const satisfies Record<
"uefi" | StandaloneArtifactFormat,
{ readonly operation: string; readonly rationale: string }
+203
View File
@@ -0,0 +1,203 @@
import { expect, it } from "vitest";
import {
countDebianRelationshipItems,
debArMemberRole,
debArchiveCompressionFromName,
inspectDebPackageInputSchema,
MAX_DEB_RELATIONSHIP_ALTERNATIVES,
parseDebianDependency,
parseDebianRelationshipField,
parseDebianVersion,
} from "./debPackage.js";
it("splits Debian versions into epoch, upstream, and revision without inventing parts", () => {
expect(parseDebianVersion("1:2.03-1")).toEqual({
raw: "1:2.03-1",
epoch: 1,
upstream: "2.03",
revision: "1",
});
expect(parseDebianVersion("2.03")).toEqual({
raw: "2.03",
epoch: null,
upstream: "2.03",
revision: null,
});
expect(parseDebianVersion("1.0-1ubuntu2")).toEqual({
raw: "1.0-1ubuntu2",
epoch: null,
upstream: "1.0",
revision: "1ubuntu2",
});
});
it("parses relationship alternatives, operators, and architecture qualifiers", () => {
expect(parseDebianDependency("libc6 (>= 2.34)")).toEqual({
name: "libc6",
arch_qualifier: null,
operator: ">=",
version: "2.34",
arch_restriction: null,
});
expect(parseDebianDependency("python3:any")).toEqual({
name: "python3",
arch_qualifier: "any",
operator: null,
version: null,
arch_restriction: null,
});
expect(parseDebianDependency("foo [amd64 i386]")).toEqual({
name: "foo",
arch_qualifier: null,
operator: null,
version: null,
arch_restriction: {
negated: false,
architectures: ["amd64", "i386"],
},
});
expect(parseDebianDependency("bar (>= 1.0) [!armel]")).toEqual({
name: "bar",
arch_qualifier: null,
operator: ">=",
version: "1.0",
arch_restriction: { negated: true, architectures: ["armel"] },
});
expect(
parseDebianRelationshipField(
"libc6 (>= 2.34), python3:any | python3-minimal (>= 3.11)",
).groups,
).toEqual([
[
{
name: "libc6",
arch_qualifier: null,
operator: ">=",
version: "2.34",
arch_restriction: null,
},
],
[
{
name: "python3",
arch_qualifier: "any",
operator: null,
version: null,
arch_restriction: null,
},
{
name: "python3-minimal",
arch_qualifier: null,
operator: ">=",
version: "3.11",
arch_restriction: null,
},
],
]);
});
it("classifies ar member roles and compression from stored names", () => {
expect(debArMemberRole("debian-binary")).toBe("debian-binary");
expect(debArMemberRole("control.tar.gz")).toBe("control");
expect(debArMemberRole("data.tar.zst")).toBe("data");
expect(debArMemberRole("_gpgorigin")).toBe("unknown");
expect(debArchiveCompressionFromName("control.tar")).toBe("none");
expect(debArchiveCompressionFromName("data.tar.gz")).toBe("gzip");
expect(debArchiveCompressionFromName("control.tar.zst")).toBe("zstd");
expect(debArchiveCompressionFromName("data.tar.xz")).toBe("xz");
});
it("requires an absolute path and rejects extra inspection arguments", () => {
expect(
inspectDebPackageInputSchema.safeParse({ path: "hello.deb" }).success,
).toBe(false);
expect(
inspectDebPackageInputSchema.safeParse({
path: "/artifacts/hello.deb",
extra: true,
}).success,
).toBe(false);
expect(
inspectDebPackageInputSchema.parse({ path: "/artifacts/hello.deb" }).path,
).toBe("/artifacts/hello.deb");
});
it("reads hyphenated architecture qualifiers", () => {
expect(parseDebianDependency("libfoo:kfreebsd-amd64")).toMatchObject({
name: "libfoo",
arch_qualifier: "kfreebsd-amd64",
});
});
it("returns relationship alternatives it cannot read, as written", () => {
expect(
parseDebianRelationshipField("libc6 (>= 2.34), libbar (2.0) | libbaz"),
).toEqual({
groups: [
[
{
name: "libc6",
arch_qualifier: null,
operator: ">=",
version: "2.34",
arch_restriction: null,
},
],
[
{
name: "libbaz",
arch_qualifier: null,
operator: null,
version: null,
arch_restriction: null,
},
],
],
unreadCount: 1,
firstUnread: "libbar (2.0)",
});
});
it("counts nested architecture and build profile list items under the relationship budget before splitting", () => {
expect(
countDebianRelationshipItems(
"libc6 (<< 2.35), foo [amd64 i386] <nocheck nodoc> | bar (>= 1.0)",
),
).toBe(7);
const oversizedArchs = `aa [${Array(MAX_DEB_RELATIONSHIP_ALTERNATIVES).fill("a").join(" ")}]`;
expect(
countDebianRelationshipItems(
oversizedArchs,
MAX_DEB_RELATIONSHIP_ALTERNATIVES,
),
).toBe(MAX_DEB_RELATIONSHIP_ALTERNATIVES + 1);
const oversizedProfiles = `aa <${Array(MAX_DEB_RELATIONSHIP_ALTERNATIVES).fill("a").join(" ")}>`;
expect(
countDebianRelationshipItems(
oversizedProfiles,
MAX_DEB_RELATIONSHIP_ALTERNATIVES,
),
).toBe(MAX_DEB_RELATIONSHIP_ALTERNATIVES + 1);
expect(parseDebianDependency("aa [amd64 i386]", 2)).toEqual({
name: "aa",
arch_qualifier: null,
operator: null,
version: null,
arch_restriction: {
negated: false,
architectures: ["amd64", "i386"],
},
});
expect(parseDebianDependency("aa [amd64 i386 arm64]", 2)).toBeNull();
expect(
parseDebianDependency(
`aa [${Array(MAX_DEB_RELATIONSHIP_ALTERNATIVES + 1)
.fill("a")
.join(" ")}]`,
),
).toBeNull();
});
+632
View File
@@ -0,0 +1,632 @@
import { z } from "zod";
import type { AnalysisParameterLimit } from "../analysisSettings.js";
import {
parameterBudgetLimit,
parameterBudgetSchema,
type ParameterBudget,
} from "../parameterBudget.js";
import { digestSchema } from "../digests.js";
import { absoluteLocalPathStringSchema } from "../localPath.js";
import { coverageStatusSchema } from "../coverage.js";
const uint = z.number().int().min(0).max(0xffffffff);
/** Hard ceiling on the caller-selected input read budget. */
export const MAX_INSPECT_DEB_PACKAGE_FILE_BYTES = 536870912;
/** Hard ceiling on ar members examined in one package. */
export const MAX_INSPECT_DEB_PACKAGE_AR_MEMBERS = 256;
/** Hard ceiling on control.tar entries inventoried in one package. */
export const MAX_INSPECT_DEB_PACKAGE_CONTROL_ENTRIES = 65536;
/** Hard ceiling on data.tar entries inventoried in one package. */
export const MAX_INSPECT_DEB_PACKAGE_DATA_ENTRIES = 65536;
/** Hard ceiling on decompressed control.tar bytes. */
export const MAX_INSPECT_DEB_PACKAGE_CONTROL_BYTES = 16 * 1024 * 1024;
/** Hard ceiling on decompressed data.tar bytes. */
export const MAX_INSPECT_DEB_PACKAGE_DATA_BYTES = 256 * 1024 * 1024;
export const DEB_PACKAGE_LIMIT_MAXIMA = {
max_file_bytes: MAX_INSPECT_DEB_PACKAGE_FILE_BYTES,
max_ar_members: MAX_INSPECT_DEB_PACKAGE_AR_MEMBERS,
max_control_entries: MAX_INSPECT_DEB_PACKAGE_CONTROL_ENTRIES,
max_data_entries: MAX_INSPECT_DEB_PACKAGE_DATA_ENTRIES,
max_control_bytes: MAX_INSPECT_DEB_PACKAGE_CONTROL_BYTES,
max_data_bytes: MAX_INSPECT_DEB_PACKAGE_DATA_BYTES,
} as const;
export const DEB_PACKAGE_LIMIT_DEFAULTS = {
max_file_bytes: 64 * 1024 * 1024,
max_ar_members: 32,
max_control_entries: 4096,
max_data_entries: 4096,
max_control_bytes: 1 * 1024 * 1024,
max_data_bytes: 32 * 1024 * 1024,
} as const;
export const DEB_PACKAGE_BUDGETS = {
max_file_bytes: {
minimum: 16,
maximum: DEB_PACKAGE_LIMIT_MAXIMA.max_file_bytes,
default_value: DEB_PACKAGE_LIMIT_DEFAULTS.max_file_bytes,
unit: "bytes",
},
max_ar_members: {
minimum: 1,
maximum: DEB_PACKAGE_LIMIT_MAXIMA.max_ar_members,
default_value: DEB_PACKAGE_LIMIT_DEFAULTS.max_ar_members,
unit: "count",
},
max_control_entries: {
minimum: 1,
maximum: DEB_PACKAGE_LIMIT_MAXIMA.max_control_entries,
default_value: DEB_PACKAGE_LIMIT_DEFAULTS.max_control_entries,
unit: "count",
},
max_data_entries: {
minimum: 1,
maximum: DEB_PACKAGE_LIMIT_MAXIMA.max_data_entries,
default_value: DEB_PACKAGE_LIMIT_DEFAULTS.max_data_entries,
unit: "count",
},
max_control_bytes: {
minimum: 1,
maximum: DEB_PACKAGE_LIMIT_MAXIMA.max_control_bytes,
default_value: DEB_PACKAGE_LIMIT_DEFAULTS.max_control_bytes,
unit: "bytes",
},
max_data_bytes: {
minimum: 1,
maximum: DEB_PACKAGE_LIMIT_MAXIMA.max_data_bytes,
default_value: DEB_PACKAGE_LIMIT_DEFAULTS.max_data_bytes,
unit: "bytes",
},
} as const satisfies Record<
keyof typeof DEB_PACKAGE_LIMIT_MAXIMA,
ParameterBudget
>;
export const debPackageBudgetLimit = (
parameter: keyof typeof DEB_PACKAGE_BUDGETS,
effectiveValue: number,
): AnalysisParameterLimit =>
parameterBudgetLimit(
parameter,
DEB_PACKAGE_BUDGETS[parameter],
effectiveValue,
);
/** Debian relationship operators recorded from control text. */
export const DEB_VERSION_OPERATORS = ["<<", "<=", "=", ">=", ">>"] as const;
export type DebVersionOperator = (typeof DEB_VERSION_OPERATORS)[number];
export const DEB_AR_MEMBER_ROLES = [
"debian-binary",
"control",
"data",
"unknown",
] as const;
export type DebArMemberRole = (typeof DEB_AR_MEMBER_ROLES)[number];
export const DEB_ARCHIVE_COMPRESSIONS = [
"none",
"gzip",
"zstd",
"xz",
"bzip2",
"lzma",
"unknown",
] as const;
export type DebArchiveCompression = (typeof DEB_ARCHIVE_COMPRESSIONS)[number];
export const DEB_TAR_ENTRY_TYPES = [
"file",
"directory",
"symlink",
"hardlink",
"character",
"block",
"fifo",
"unknown",
] as const;
export const DEB_MAINTAINER_SCRIPTS = [
"preinst",
"postinst",
"prerm",
"postrm",
"config",
"triggers",
] as const;
export const DEB_RELATIONSHIP_FIELDS = [
"depends",
"pre_depends",
"recommends",
"suggests",
"conflicts",
"breaks",
"replaces",
"provides",
"enhances",
] as const;
export type DebRelationshipField = (typeof DEB_RELATIONSHIP_FIELDS)[number];
export const DEB_CONTROL_RELATIONSHIP_NAMES: Readonly<
Record<DebRelationshipField, string>
> = {
depends: "Depends",
pre_depends: "Pre-Depends",
recommends: "Recommends",
suggests: "Suggests",
conflicts: "Conflicts",
breaks: "Breaks",
replaces: "Replaces",
provides: "Provides",
enhances: "Enhances",
};
/** Global magic that begins every Unix ar archive, including Debian `.deb`. */
export const DEB_AR_MAGIC = Buffer.from("!<arch>\n", "ascii");
/** Fixed 60-byte header preceding each Unix ar member. */
export const DEB_AR_HEADER_BYTES = 60;
const trimArField = (value: string): string => {
const nul = value.indexOf("\0");
return (nul === -1 ? value : value.slice(0, nul)).trim();
};
/**
* Whether leading bytes begin a Debian `.deb` package: Unix ar magic
* (`!<arch>\n`) followed by a valid first member header whose name is
* `debian-binary` (plain, SysV `debian-binary/`, or BSD `#1/N`).
*/
export const hasDebPackageHeader = (prefix: Uint8Array): boolean => {
const headerEnd = DEB_AR_MAGIC.length + DEB_AR_HEADER_BYTES;
if (prefix.length < headerEnd) return false;
for (let i = 0; i < DEB_AR_MAGIC.length; i++)
if (prefix[i] !== DEB_AR_MAGIC[i]) return false;
const header = prefix.subarray(DEB_AR_MAGIC.length, headerEnd);
if (header[58] !== 0x60 || header[59] !== 0x0a) return false;
const sizeText = trimArField(
Buffer.from(header.buffer, header.byteOffset + 48, 10).toString("ascii"),
);
if (!/^\d+$/u.test(sizeText)) return false;
const size = Number(sizeText);
if (!Number.isSafeInteger(size)) return false;
const rawName = trimArField(
Buffer.from(header.buffer, header.byteOffset, 16).toString("ascii"),
);
if (rawName.startsWith("#1/")) {
const lengthText = rawName.slice(3);
if (!/^\d+$/u.test(lengthText)) return false;
const nameLength = Number(lengthText);
if (
!Number.isSafeInteger(nameLength) ||
nameLength > size ||
headerEnd + nameLength > prefix.length
)
return false;
const extended = trimArField(
Buffer.from(
prefix.buffer,
prefix.byteOffset + headerEnd,
nameLength,
).toString("ascii"),
);
return extended === "debian-binary";
}
return rawName.replace(/\/$/u, "") === "debian-binary";
};
/** ar member role from its stored name; unknown members stay flagged, not guessed. */
export const debArMemberRole = (name: string): DebArMemberRole => {
const base = name.replace(/\/$/u, "").toLowerCase();
if (base === "debian-binary") return "debian-binary";
if (base === "control.tar" || base.startsWith("control.tar."))
return "control";
if (base === "data.tar" || base.startsWith("data.tar.")) return "data";
return "unknown";
};
/** Compression declared by a control/data member name; unknown when the suffix is not recognized. */
export const debArchiveCompressionFromName = (
name: string,
): DebArchiveCompression => {
const base = name.replace(/\/$/u, "").toLowerCase();
if (base.endsWith(".tar.gz") || base.endsWith(".tar.gzip")) return "gzip";
if (base.endsWith(".tar.zst") || base.endsWith(".tar.zstd")) return "zstd";
if (base.endsWith(".tar.xz")) return "xz";
if (base.endsWith(".tar.bz2") || base.endsWith(".tar.bzip2")) return "bzip2";
if (base.endsWith(".tar.lzma")) return "lzma";
if (base.endsWith(".tar")) return "none";
return "unknown";
};
/** Epoch, upstream, and Debian revision as Debian Policy splits them; missing parts stay null. */
export const parseDebianVersion = (
raw: string,
): {
readonly raw: string;
readonly epoch: number | null;
readonly upstream: string;
readonly revision: string | null;
} => {
const trimmed = raw.trim();
const colon = trimmed.indexOf(":");
const epochText = colon === -1 ? null : trimmed.slice(0, colon);
const rest = colon === -1 ? trimmed : trimmed.slice(colon + 1);
const dash = rest.lastIndexOf("-");
const epoch =
epochText === null || epochText.length === 0
? null
: /^\d+$/u.test(epochText)
? Number(epochText)
: null;
if (dash === -1)
return { raw: trimmed, epoch, upstream: rest, revision: null };
return {
raw: trimmed,
epoch,
upstream: rest.slice(0, dash),
revision: rest.slice(dash + 1),
};
};
const OPERATOR_PATTERN = /^(<<|<=|=|>=|>>)/u;
/**
* Fixed allowance for relationship items (alternatives plus nested
* architecture/profile list items) across a control file. Each separator or
* bracketed token can become a report element, so counting before splitting
* prevents small control text from expanding into millions of items.
*/
export const MAX_DEB_RELATIONSHIP_ALTERNATIVES = 65_536;
const isWhitespaceCode = (code: number, text: string, index: number): boolean =>
code === 0x20 ||
(code >= 0x09 && code <= 0x0d) ||
(code >= 0x80 && /\s/u.test(text[index]!));
const countWhitespaceTokens = (text: string, limit: number): number => {
let count = 0;
let inToken = false;
for (let index = 0; index < text.length; index += 1) {
const code = text.charCodeAt(index);
if (isWhitespaceCode(code, text, index)) {
inToken = false;
} else if (!inToken) {
inToken = true;
count += 1;
if (count > limit) return count;
}
}
return count;
};
/**
* Count relationship alternatives plus nested architecture `[...]` and build
* profile `<...>` list items before splitting. Stops early once past `limit`.
*/
export const countDebianRelationshipItems = (
value: string,
limit?: number,
): number => {
if (value.length === 0) return 0;
let items = 1;
if (limit !== undefined && items > limit) return items;
let delimiter = 0;
let inToken = false;
for (let index = 0; index < value.length; index += 1) {
const code = value.charCodeAt(index);
if (delimiter === 0x29) {
if (code === 0x29) {
delimiter = 0;
} else if (code === 0x2c || code === 0x7c) {
delimiter = 0;
items += 1;
}
} else if (delimiter !== 0) {
if (code === delimiter) {
delimiter = 0;
inToken = false;
} else if (code === 0x2c || code === 0x7c) {
delimiter = 0;
inToken = false;
items += 1;
} else if (isWhitespaceCode(code, value, index)) {
inToken = false;
} else if (!inToken) {
inToken = true;
items += 1;
}
} else if (code === 0x2c || code === 0x7c) {
items += 1;
} else if (code === 0x28) {
delimiter = 0x29;
} else if (code === 0x5b) {
delimiter = 0x5d;
inToken = false;
} else if (code === 0x3c) {
delimiter = 0x3e;
inToken = false;
}
if (limit !== undefined && items > limit) return items;
}
return items;
};
/** One relationship alternative: package name, optional arch qualifier, operator, and arch restriction. */
export const parseDebianDependency = (
spec: string,
maxArchitectureItems: number = MAX_DEB_RELATIONSHIP_ALTERNATIVES,
): {
readonly name: string;
readonly arch_qualifier: string | null;
readonly operator: DebVersionOperator | null;
readonly version: string | null;
readonly arch_restriction: {
readonly negated: boolean;
readonly architectures: readonly string[];
} | null;
} | null => {
let rest = spec.trim();
// Architecture qualifiers may be hyphenated, as in `kfreebsd-amd64`.
const nameMatch = /^([a-z0-9][a-z0-9+.\-]*)(?::([a-z0-9][a-z0-9-]*))?/iu.exec(
rest,
);
if (nameMatch?.[1] === undefined) return null;
const name = nameMatch[1];
const arch_qualifier = nameMatch[2] ?? null;
rest = rest.slice(nameMatch[0].length).trim();
let operator: DebVersionOperator | null = null;
let version: string | null = null;
if (rest.startsWith("(")) {
const close = rest.indexOf(")");
if (close === -1) return null;
const inner = rest.slice(1, close).trim();
const op = OPERATOR_PATTERN.exec(inner);
if (op?.[1] === undefined) return null;
operator = op[1] as DebVersionOperator;
version = inner.slice(op[0].length).trim();
if (version.length === 0) return null;
rest = rest.slice(close + 1).trim();
}
let arch_restriction: {
readonly negated: boolean;
readonly architectures: readonly string[];
} | null = null;
if (rest.startsWith("[")) {
const close = rest.indexOf("]");
if (close === -1) return null;
const inner = rest.slice(1, close);
if (
countWhitespaceTokens(inner, maxArchitectureItems) > maxArchitectureItems
)
return null;
const tokens = inner
.trim()
.split(/\s+/u)
.filter((token) => token.length > 0);
if (tokens.length === 0) return null;
const negated = tokens.every((token) => token.startsWith("!"));
const mixed = tokens.some((token) => token.startsWith("!")) !== negated;
if (mixed) return null;
arch_restriction = {
negated,
architectures: tokens.map((token) =>
token.startsWith("!") ? token.slice(1) : token,
),
};
rest = rest.slice(close + 1).trim();
}
if (rest.length > 0) return null;
return { name, arch_qualifier, operator, version, arch_restriction };
};
/** Comma-separated relationship groups, each a list of `|` alternatives. */
export const parseDebianRelationshipField = (
value: string,
): {
readonly groups: readonly (readonly NonNullable<
ReturnType<typeof parseDebianDependency>
>[])[];
/** How many alternatives the parser could not read. */
readonly unreadCount: number;
/** The first unreadable alternative, as written, or null. */
readonly firstUnread: string | null;
} => {
const groups: NonNullable<ReturnType<typeof parseDebianDependency>>[][] = [];
// Count unreadable alternatives rather than collecting them, so a field of
// many `|` separators cannot grow the report with its input.
let unreadCount = 0;
let firstUnread: string | null = null;
for (const group of value.split(",")) {
const trimmed = group.trim();
if (trimmed.length === 0) continue;
const alternatives: NonNullable<
ReturnType<typeof parseDebianDependency>
>[] = [];
for (const spec of trimmed.split("|")) {
const parsed = parseDebianDependency(spec);
if (parsed === null) {
unreadCount += 1;
firstUnread ??= spec.trim();
} else alternatives.push(parsed);
}
if (alternatives.length > 0) groups.push(alternatives);
}
return { groups, unreadCount, firstUnread };
};
/** Complete bounded inspection of one Debian .deb ar archive. */
export const inspectDebPackageInputSchema = z.strictObject({
path: absoluteLocalPathStringSchema.describe(
"Absolute filesystem path to a Debian .deb package",
),
max_file_bytes: parameterBudgetSchema(
DEB_PACKAGE_BUDGETS.max_file_bytes,
).describe("Maximum stable artifact bytes to read (default 64 MiB)"),
max_ar_members: parameterBudgetSchema(
DEB_PACKAGE_BUDGETS.max_ar_members,
).describe("Maximum ar members to inventory (default 32)"),
max_control_entries: parameterBudgetSchema(
DEB_PACKAGE_BUDGETS.max_control_entries,
).describe("Maximum control.tar entries to inventory (default 4096)"),
max_data_entries: parameterBudgetSchema(
DEB_PACKAGE_BUDGETS.max_data_entries,
).describe("Maximum data.tar entries to inventory (default 4096)"),
max_control_bytes: parameterBudgetSchema(
DEB_PACKAGE_BUDGETS.max_control_bytes,
).describe("Maximum decompressed control.tar bytes (default 1 MiB)"),
max_data_bytes: parameterBudgetSchema(
DEB_PACKAGE_BUDGETS.max_data_bytes,
).describe("Maximum decompressed data.tar bytes (default 32 MiB)"),
});
const nullableText = z.string().min(1).nullable();
const versionSchema = z
.strictObject({
raw: z.string().min(1),
epoch: z.number().int().nonnegative().nullable(),
upstream: z.string().min(1),
revision: nullableText,
})
.nullable();
const archRestrictionSchema = z
.strictObject({
negated: z.boolean(),
architectures: z.array(z.string().min(1)),
})
.nullable();
const dependencySchema = z.strictObject({
name: z.string().min(1),
arch_qualifier: nullableText,
operator: z.enum(DEB_VERSION_OPERATORS).nullable(),
version: nullableText,
arch_restriction: archRestrictionSchema,
});
const relationshipGroupSchema = z.array(z.array(dependencySchema).min(1));
const optionalRelationships = z
.array(relationshipGroupSchema.element)
.nullable();
const listedFileSchema = z.strictObject({
present: z.boolean(),
count: z.number().int().nonnegative().nullable(),
});
export const debIssueSchema = z.strictObject({
kind: z.enum(["malformed", "truncated", "unsupported", "limit"]),
member: nullableText,
field: nullableText,
detail: z.string().min(1),
offset: z.number().int().nonnegative().nullable(),
});
const arMemberSchema = z.strictObject({
name: z.string().min(1),
role: z.enum(DEB_AR_MEMBER_ROLES),
size: uint,
offset: uint,
compression: z.enum(DEB_ARCHIVE_COMPRESSIONS).nullable(),
});
const tarEntrySchema = z.strictObject({
path: z.string().min(1),
type: z.enum(DEB_TAR_ENTRY_TYPES),
mode: nullableText,
size: uint,
uid: z.number().int().nonnegative().nullable(),
gid: z.number().int().nonnegative().nullable(),
user: nullableText,
group: nullableText,
link_target: nullableText,
});
const maintainerScriptSchema = z.strictObject({
name: z.enum(DEB_MAINTAINER_SCRIPTS),
interpreter: nullableText,
bytes: uint,
});
const controlSchema = z
.strictObject({
package: nullableText,
version: versionSchema,
architecture: nullableText,
maintainer: nullableText,
installed_size: z.number().int().nonnegative().nullable(),
section: nullableText,
priority: nullableText,
homepage: nullableText,
description_summary: nullableText,
source: nullableText,
multi_arch: nullableText,
essential: z.boolean().nullable(),
relationships: z.strictObject({
depends: optionalRelationships,
pre_depends: optionalRelationships,
recommends: optionalRelationships,
suggests: optionalRelationships,
conflicts: optionalRelationships,
breaks: optionalRelationships,
replaces: optionalRelationships,
provides: optionalRelationships,
enhances: optionalRelationships,
}),
conffiles: listedFileSchema,
md5sums: listedFileSchema,
maintainer_scripts: z.array(maintainerScriptSchema),
})
.nullable();
const md5CrossCheckSchema = z
.strictObject({
listed: uint,
present: uint,
missing_from_inventory: uint,
missing_from_md5sums: uint,
})
.nullable();
/** Observed .deb identity, relationships, scripts, and tar inventory; unknowns stay null. */
export const debPackageSchema = z.strictObject({
artifact: z.strictObject({
path: z.string().min(1),
sha256: digestSchema,
bytes: uint,
}),
ar: z.strictObject({
magic: z.literal("!<arch>\n"),
format_version: nullableText,
members: z.array(arMemberSchema),
extra_member_names: z.array(z.string().min(1)),
}),
control: controlSchema,
data_entries: z.array(tarEntrySchema),
md5sums_cross_check: md5CrossCheckSchema,
issues: z.array(debIssueSchema),
coverage: z.strictObject({
status: coverageStatusSchema,
ar_members: uint,
control_entries: uint,
data_entries: uint,
examined_control_bytes: uint,
examined_data_bytes: uint,
}),
limitations: z.array(z.string().min(1)).min(1),
});
export type DebPackage = z.infer<typeof debPackageSchema>;
export type InspectDebPackageInput = z.infer<
typeof inspectDebPackageInputSchema
>;
export type DebPackageIssue = z.infer<typeof debIssueSchema>;
export type DebTarEntry = z.infer<typeof tarEntrySchema>;
export type DebArMember = z.infer<typeof arMemberSchema>;
export type DebControl = NonNullable<z.infer<typeof controlSchema>>;
@@ -1252,3 +1252,26 @@ it.each([1, 65_536])(
expect(fields?.get("other")).toBe("value");
},
);
it.each([
["string", (text: string): string | Buffer => text],
["buffer", (text: string): string | Buffer => Buffer.from(text)],
])("stops at the paragraph limit for %s input", (_, input) => {
const text = `Package: first\n\nPackage: second\n\n${"a:b\n\n".repeat(1_000)}`;
const paragraphs = deb822Paragraphs(input(text), 1);
expect(paragraphs).toHaveLength(1);
expect(paragraphs[0]?.get("package")).toBe("first");
expect(deb822Paragraphs(input(text), 2)).toHaveLength(2);
expect(deb822Paragraphs(input("Package: only\n"), 1)).toHaveLength(1);
expect(deb822Paragraphs(input(text))).toHaveLength(1_002);
});
it("trims a field with a long interior whitespace run in linear time", () => {
const run = " \t".repeat(500_000);
const started = performance.now();
const [fields] = deb822Paragraphs(
`Description: \t1${run}x \r\n ${run}tail${run}\n`,
);
expect(performance.now() - started).toBeLessThan(2_000);
expect(fields?.get("description")).toBe(`1${run}x\ntail`);
});
+13 -3
View File
@@ -348,8 +348,12 @@ const stanza = (
/** Keep the position of undecodable lines without inserting replacement text. */
function* sourceLines(text: string | Buffer): Generator<string | undefined> {
if (typeof text === "string") {
yield* text.split("\n");
return;
for (let start = 0; ;) {
const end = text.indexOf("\n", start);
yield text.slice(start, end === -1 ? text.length : end);
if (end === -1) return;
start = end + 1;
}
}
for (let start = 0; start <= text.length;) {
const end = text.indexOf(0x0a, start);
@@ -529,10 +533,15 @@ const isDeb822LineWhitespace = (character: string): boolean =>
const trimDeb822Line = (value: string): string =>
trimEdges(value, isDeb822LineWhitespace);
/** Fields of each deb822 paragraph by lowercase name; continuation lines keep their line breaks. */
/**
* Fields of each deb822 paragraph by lowercase name; continuation lines keep
* their line breaks. Stop reading when the paragraph limit is reached.
*/
export const deb822Paragraphs = (
text: string | Buffer,
limit = Number.POSITIVE_INFINITY,
): ReadonlyMap<string, string>[] => {
if (limit <= 0) return [];
const found: Map<string, string>[] = [];
let current = new Map<string, string>();
let last: string | undefined;
@@ -562,6 +571,7 @@ export const deb822Paragraphs = (
const afterLeadingCr = line.replace(/^\r+/u, "");
if (afterLeadingCr.length === 0) {
finish();
if (found.length >= limit) return found;
} else if (line.startsWith("#")) continue;
else if (/^[ \t\v\f]/u.test(afterLeadingCr) && last !== undefined) {
const content = trimDeb822Line(line);
+1
View File
@@ -104,6 +104,7 @@ export const PE_OVERLAY_LEADING_FORMATS = [
"windows-shortcut",
"python-pyc",
"devicetree",
"deb",
] as const;
export type PeOverlayLeadingFormat =
(typeof PE_OVERLAY_LEADING_FORMATS)[number];
+110
View File
@@ -0,0 +1,110 @@
import { describe, expect, it } from "vitest";
import {
parsePaxRecords,
parseTarNumber,
TAR_BLOCK_BYTES,
tarHeaderChecksumMatches,
tarHeaderDialect,
walkPaxRecords,
} from "./tarFormat.js";
const buildHeader = (
mutate?: (block: Buffer) => void,
signed = false,
): Buffer => {
const block = Buffer.alloc(TAR_BLOCK_BYTES);
block.write("hello.txt", 0);
block.write("0000644\0", 100);
block.write("0000000\0", 108);
block.write("0000000\0", 116);
block.write("00000000000\0", 124);
block.write("00000000000\0", 136);
block.write(" ", 148);
block[156] = 0x30;
block.write("ustar\0", 257);
block.write("00", 263);
mutate?.(block);
block.write(" ", 148);
let sum = 0;
for (const byte of block) sum += signed && byte >= 0x80 ? byte - 0x100 : byte;
block.write(`${sum.toString(8).padStart(6, "0")}\0 `, 148);
return block;
};
describe("parseTarNumber", () => {
it("parses octal and GNU base-256 values including first-byte magnitude and sign bits", () => {
expect(parseTarNumber(Buffer.from("0000755\0"))).toBe(0o755n);
expect(
parseTarNumber(
new Uint8Array([0x80, 0x00, 0x00, 0x00, 0x00, 0x2d, 0xc6, 0xc0]),
),
).toBe(3_000_000n);
expect(
parseTarNumber(
new Uint8Array([0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07]),
),
).toBe((1n << 56n) + 7n);
expect(
parseTarNumber(
new Uint8Array([0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]),
),
).toBe(-1n);
expect(parseTarNumber(Buffer.from("07x5\0"))).toBeUndefined();
});
});
describe("tarHeaderChecksumMatches and tarHeaderDialect", () => {
it("verifies unsigned and historic signed checksums and rejects corrupt or short blocks", () => {
const ustar = buildHeader();
expect(tarHeaderDialect(ustar)).toBe("ustar");
expect(tarHeaderChecksumMatches(ustar)).toBe(true);
const signed = buildHeader((block) => {
block[0] = 0xff;
}, true);
expect(tarHeaderChecksumMatches(signed)).toBe(true);
const bad = Buffer.from(ustar);
bad[0] = (bad[0] ?? 0) ^ 1;
expect(tarHeaderChecksumMatches(bad)).toBe(false);
expect(tarHeaderChecksumMatches(ustar.subarray(0, 100))).toBe(false);
expect(tarHeaderDialect(ustar.subarray(0, 100))).toBeUndefined();
const gnu = buildHeader((block) => {
block.write("ustar \0", 257, "latin1");
});
expect(tarHeaderDialect(gnu)).toBe("gnu");
});
});
describe("walkPaxRecords and parsePaxRecords", () => {
it("walks raw records with byte offsets and leaves UTF-8 policy to callers", () => {
const valid = Buffer.from("12 path=abc\n");
const nonUtf8 = Buffer.concat([
Buffer.from("11 uname="),
Buffer.from([0xff, 0x0a]),
]);
const payload = Buffer.concat([valid, nonUtf8, Buffer.alloc(4)]);
const seen: [string, Uint8Array][] = [];
const error = walkPaxRecords(payload, (key, value) => {
seen.push([Buffer.from(key).toString("utf8"), value]);
});
expect(error).toBeUndefined();
expect(seen).toHaveLength(2);
expect(seen[0]?.[0]).toBe("path");
expect(Buffer.from(seen[0]?.[1] ?? []).toString("utf8")).toBe("abc");
expect(seen[1]?.[0]).toBe("uname");
expect([...(seen[1]?.[1] ?? [])]).toEqual([0xff]);
expect(parsePaxRecords(payload)).toEqual({
reason: "pax record value is not UTF-8",
});
const malformed = Buffer.concat([valid, Buffer.from("99 path=abc\n")]);
expect(walkPaxRecords(malformed, () => undefined)).toEqual({
offset: valid.length,
reason: "pax record length exceeds its extended header",
});
});
});
+92 -33
View File
@@ -25,7 +25,10 @@ export const hasGzipMagic = (prefix: Uint8Array): boolean =>
/** Header dialect, from the `magic` and `version` fields. */
export type TarHeaderDialect = "ustar" | "gnu";
const headerDialect = (block: Uint8Array): TarHeaderDialect | undefined => {
export const tarHeaderDialect = (
block: Uint8Array,
): TarHeaderDialect | undefined => {
if (block.length < TAR_MAGIC_OFFSET + 8) return undefined;
const magic = Buffer.from(
block.buffer,
block.byteOffset + TAR_MAGIC_OFFSET,
@@ -47,7 +50,8 @@ export const isZeroBlock = (block: Uint8Array): boolean =>
* checksum field read as spaces. Historic writers summed signed bytes, which
* POSIX readers also accept.
*/
const checksumMatches = (block: Uint8Array): boolean => {
export const tarHeaderChecksumMatches = (block: Uint8Array): boolean => {
if (block.length < TAR_BLOCK_BYTES) return false;
const declared = parseTarNumber(
block.subarray(
TAR_CHECKSUM_OFFSET,
@@ -137,14 +141,14 @@ export const parseTarHeaderBlock = (block: Uint8Array): TarHeaderParse => {
if (block.length !== TAR_BLOCK_BYTES)
return { state: "invalid", reason: "header block is incomplete" };
if (isZeroBlock(block)) return { state: "zero" };
const dialect = headerDialect(block);
const dialect = tarHeaderDialect(block);
if (dialect === undefined)
return {
state: "invalid",
reason:
"header has no ustar magic (pre-POSIX v7 headers are unsupported)",
};
if (!checksumMatches(block))
if (!tarHeaderChecksumMatches(block))
return { state: "invalid", reason: "header checksum does not match" };
const number = (offset: number, length: number) =>
parseTarNumber(block.subarray(offset, offset + length));
@@ -268,7 +272,7 @@ export const recognizeTarPrefix = (
export const tarHeaderRefusal = (prefix: Uint8Array): string | undefined => {
if (prefix.length < TAR_BLOCK_BYTES) return undefined;
const block = prefix.subarray(0, TAR_BLOCK_BYTES);
if (headerDialect(block) === undefined) return undefined;
if (tarHeaderDialect(block) === undefined) return undefined;
const parsed = parseTarHeaderBlock(block);
return parsed.state === "invalid" ? `tar first ${parsed.reason}` : undefined;
};
@@ -292,6 +296,58 @@ export const TAR_TYPEFLAGS = {
export type TarPaxRecords = ReadonlyMap<string, string>;
export interface TarPaxRecordError {
readonly offset: number;
readonly reason: string;
}
/**
* Walk pax extended-header records: `"<length> <key>=<value>\n"`, where
* `length` counts the whole record in bytes. Passes each record's raw keyword
* and value slices to `onRecord`, leaving UTF-8 policy and key retention to
* the caller. Returns the byte offset and reason of the first unreadable
* record, or `undefined` when every record parsed (or `stop` was called).
*/
export const walkPaxRecords = (
bytes: Uint8Array,
onRecord: (key: Uint8Array, value: Uint8Array, stop: () => void) => void,
): TarPaxRecordError | undefined => {
let offset = 0;
let stopped = false;
const stop = () => {
stopped = true;
};
while (offset < bytes.length) {
// Trailing NUL padding ends the records.
if (bytes[offset] === 0 && bytes.subarray(offset).every((b) => b === 0))
break;
const space = bytes.indexOf(0x20, offset);
if (space === -1 || space - offset > 20)
return { offset, reason: "pax record has no length field" };
const lengthText = Buffer.from(bytes.subarray(offset, space)).toString(
"latin1",
);
if (!/^[1-9][0-9]*$/u.test(lengthText))
return { offset, reason: "pax record length is not a decimal number" };
const length = Number(lengthText);
const end = offset + length;
if (!Number.isSafeInteger(end) || end > bytes.length || end <= space + 1)
return {
offset,
reason: "pax record length exceeds its extended header",
};
if (bytes[end - 1] !== 0x0a)
return { offset, reason: "pax record does not end with a newline" };
const body = bytes.subarray(space + 1, end - 1);
const equals = body.indexOf(0x3d);
if (equals <= 0) return { offset, reason: "pax record has no keyword" };
onRecord(body.subarray(0, equals), body.subarray(equals + 1), stop);
if (stopped) return undefined;
offset = end;
}
return undefined;
};
/** Keywords whose values `hdrcharset=BINARY` leaves as raw bytes (POSIX pax "hdrcharset"). */
const PAX_BINARY_KEYWORDS = new Set(["path", "linkpath", "uname", "gname"]);
@@ -308,34 +364,10 @@ export const parsePaxRecords = (
| { readonly records: TarPaxRecords; readonly latin1: readonly string[] }
| { readonly reason: string } => {
const values: [string, Uint8Array][] = [];
let offset = 0;
while (offset < bytes.length) {
// Trailing NUL padding ends the records.
if (bytes[offset] === 0 && bytes.subarray(offset).every((b) => b === 0))
break;
const space = bytes.indexOf(0x20, offset);
if (space === -1 || space - offset > 20)
return { reason: "pax record has no length field" };
const lengthText = Buffer.from(bytes.subarray(offset, space)).toString(
"latin1",
);
if (!/^[1-9][0-9]*$/u.test(lengthText))
return { reason: "pax record length is not a decimal number" };
const length = Number(lengthText);
const end = offset + length;
if (!Number.isSafeInteger(end) || end > bytes.length || end <= space + 1)
return { reason: "pax record length exceeds its extended header" };
if (bytes[end - 1] !== 0x0a)
return { reason: "pax record does not end with a newline" };
const body = bytes.subarray(space + 1, end - 1);
const equals = body.indexOf(0x3d);
if (equals <= 0) return { reason: "pax record has no keyword" };
values.push([
Buffer.from(body.subarray(0, equals)).toString("utf8"),
body.subarray(equals + 1),
]);
offset = end;
}
const error = walkPaxRecords(bytes, (key, value) => {
values.push([Buffer.from(key).toString("utf8"), value]);
});
if (error !== undefined) return { reason: error.reason };
const binary = values.some(
([key, value]) =>
key === "hdrcharset" &&
@@ -360,3 +392,30 @@ export const parsePaxRecords = (
/** Number of whole blocks that hold `size` data bytes. */
export const tarPaddedSize = (size: number): number =>
Math.ceil(size / TAR_BLOCK_BYTES) * TAR_BLOCK_BYTES;
/** A directory header, including an old regular header whose name ends in `/`. */
export const isTarDirectoryHeader = (flag: number, name: string): boolean =>
flag === TAR_TYPEFLAGS.directory || (flag === 0 && name.endsWith("/"));
/** Typeflags POSIX ustar records without data blocks, besides directories. */
const HEADER_ONLY_TYPEFLAGS: ReadonlySet<number> = new Set([
TAR_TYPEFLAGS.symlink,
TAR_TYPEFLAGS.characterDevice,
TAR_TYPEFLAGS.blockDevice,
TAR_TYPEFLAGS.fifo,
]);
/**
* Data bytes stored after a member header. POSIX ustar stores none for
* symbolic links, devices, directories and FIFOs, whose size field may still
* be nonzero, so the next header follows at once. Hard links keep their size:
* pax interchange archives may store a body for them.
*/
export const tarStoredDataBytes = (
flag: number,
name: string,
size: number,
): number =>
isTarDirectoryHeader(flag, name) || HEADER_ONLY_TYPEFLAGS.has(flag)
? 0
: size;
+1
View File
@@ -56,6 +56,7 @@ export const BINARY_TARGET_FORMAT_KINDS = {
"windows-shortcut": "artifact",
"python-pyc": "artifact",
devicetree: "artifact",
deb: "artifact",
"source-map": "artifact",
} as const;
+20
View File
@@ -0,0 +1,20 @@
import type {
ExecutionOptions,
ProviderIdentity,
} from "../AnalysisProvider.js";
import type { AnalysisError } from "../../domain/analysisErrorBase.js";
import type {
DebPackage,
InspectDebPackageInput,
} from "../../domain/deb/debPackage.js";
import type { Result } from "../../domain/result.js";
/** Stable read and .deb ar/tar decoding, independent of dpkg or an analysis target. */
export interface DebPackagePort {
readonly identity: ProviderIdentity;
close(): Promise<void>;
inspect(
input: InspectDebPackageInput,
options?: ExecutionOptions,
): Promise<Result<DebPackage, AnalysisError>>;
}
+2
View File
@@ -219,6 +219,7 @@ export const createServer = (
vsixPackage,
ociImageLayout,
pythonPyc,
debPackage,
mavenGradleMetadata,
dwarfUnits,
elfDependencies,
@@ -440,6 +441,7 @@ export const createServer = (
vsixPackage,
ociImageLayout,
pythonPyc,
debPackage,
erlangBeam,
v8CodeCache,
wasmArtifact,
@@ -22,6 +22,7 @@ import type { PeOverlayService } from "../application/binaryDiagnostics/PeOverla
import type { PeResourcesService } from "../application/binaryDiagnostics/PeResourcesService.js";
import type { RecordedCrashService } from "../application/binaryDiagnostics/RecordedCrashService.js";
import type { WindowsShortcutService } from "../application/binaryDiagnostics/WindowsShortcutService.js";
import type { DebPackageService } from "../application/deb/DebPackageService.js";
import type { BeamService } from "../application/erlang/BeamService.js";
import type { EvmInterfaceService } from "../application/evm/EvmInterfaceService.js";
import type { GoBinaryService } from "../application/go/GoBinaryService.js";
@@ -221,6 +222,12 @@ export const OFFLINE_INSPECTION_TOOL_BINDINGS = {
summary: (input, options) => service.inspect(input, options),
},
})) satisfies Bind<NugetNupkgService>,
debPackage: ((service) => ({
inspect_deb_package: {
admission: "application",
run: (input, options) => service.inspect(input, options),
},
})) satisfies Bind<DebPackageService>,
vsixPackage: ((service) => ({
inspect_vsix_package: {
admission: "application",
+115
View File
@@ -0,0 +1,115 @@
import { createHash } from "node:crypto";
import { writeFile } from "node:fs/promises";
import { join } from "node:path";
import { expect } from "vitest";
import { DEB_PACKAGE_TOOL_CONTRACTS } from "../../src/contracts/deb/debPackageToolContracts.js";
import { debPackageSchema } from "../../src/domain/deb/debPackage.js";
import {
debPackageFixture,
notArBytes,
} from "../../src/deb/DebPackage.fixture.js";
import { createTestTempDirectory } from "../fixtures/temporaryDirectory.js";
import { cliTest } from "../support/cli/cliFixture.js";
const debContract = DEB_PACKAGE_TOOL_CONTRACTS.find(
(item) => item.name === "inspect_deb_package",
);
if (debContract === undefined)
throw new Error("Missing inspect_deb_package contract");
const completeDebEvidenceSchema = debContract.outputSchema.safeExtend({
normalized_result: debPackageSchema,
});
cliTest(
"inspects a fixture .deb without installing it or running maintainer scripts",
async ({ cli }) => {
const root = await createTestTempDirectory("rea-deb-cli-");
const path = join(root, "hello_2.03-1_all.deb");
const bytes = debPackageFixture();
await writeFile(path, bytes);
const result = await cli.run({
arguments: ["inspect-deb-package", path, "--json"],
});
expect(result.exitCode, result.stderr).toBe(0);
const evidence = completeDebEvidenceSchema.parse(result.json);
expect(evidence.normalized_result).toMatchObject({
artifact: {
path,
sha256: createHash("sha256").update(bytes).digest("hex"),
bytes: bytes.length,
},
ar: { format_version: "2.0" },
control: {
package: "hello",
version: { raw: "1:2.03-1", epoch: 1 },
architecture: "all",
maintainer_scripts: expect.arrayContaining([
{ name: "preinst", interpreter: "/bin/sh", bytes: 17 },
]),
},
});
expect(
evidence.normalized_result.control?.relationships.depends?.[1],
).toEqual([
{
name: "python3",
arch_qualifier: "any",
operator: null,
version: null,
arch_restriction: null,
},
{
name: "python3-minimal",
arch_qualifier: null,
operator: ">=",
version: "3.11",
arch_restriction: null,
},
]);
expect(
evidence.normalized_result.data_entries.some(
(entry) => entry.path === "usr/bin/hello" && entry.type === "file",
),
).toBe(true);
},
);
cliTest("refuses a file that is not a Debian ar archive", async ({ cli }) => {
const root = await createTestTempDirectory("rea-deb-cli-malformed-");
const path = join(root, "not.deb");
await writeFile(path, notArBytes());
const result = await cli.run({
arguments: ["inspect-deb-package", path, "--json"],
});
expect(result.exitCode).toBe(1);
expect(result.json).toMatchObject({
code: "unsupported_target",
details: {
operation: "inspect_deb_package",
failure_kind: "malformed",
format: "deb",
reason: expect.stringContaining("ar magic"),
},
});
});
cliTest("inspects xz-compressed control and data members", async ({ cli }) => {
const root = await createTestTempDirectory("rea-deb-cli-xz-");
const path = join(root, "hello.xz.deb");
const bytes = debPackageFixture({
controlCompression: "xz",
dataCompression: "xz",
});
await writeFile(path, bytes);
const result = await cli.run({
arguments: ["inspect-deb-package", path, "--json"],
});
expect(result.exitCode, result.stderr).toBe(0);
const evidence = completeDebEvidenceSchema.parse(result.json);
expect(evidence.normalized_result.control?.package).toBe("hello");
expect(
evidence.normalized_result.ar.members.map((member) => member.name),
).toEqual(["debian-binary", "control.tar.xz", "data.tar.xz"]);
});
@@ -11,6 +11,7 @@ import { cliTest } from "../support/cli/cliFixture.js";
const fileCommands = [
"inspect-sqlite-database",
"inspect-python-pyc",
"inspect-deb-package",
"inspect-apk-signature",
"inspect-packet-capture",
"decode-signal-recording",
@@ -274,6 +274,7 @@ const pathRequests: readonly [string, Record<string, unknown>][] = [
["audit_release_exposure", { path: nul }],
["inspect_binary_hardening", { path: nul }],
["inspect_python_pyc", { path: nul }],
["inspect_deb_package", { path: nul }],
["inspect_nuget_nupkg", { path: nul }],
["inspect_vsix_package", { path: nul }],
["inspect_oci_image_layout", { path: nul }],
@@ -254,6 +254,8 @@ describe("pyc and BEAM limit options", () => {
["inspect-python-pyc", "--max-file-bytes", "maxFileBytes", ["0x10"]],
["inspect-python-pyc", "--max-objects", "maxObjects", ["1e2"]],
["inspect-python-pyc", "--max-string-bytes", "maxStringBytes", ["0x1"]],
["inspect-deb-package", "--max-file-bytes", "maxFileBytes", ["0x10"]],
["inspect-deb-package", "--max-ar-members", "maxArMembers", ["1e2"]],
["inspect-erlang-beam", "--max-file-bytes", "maxFileBytes", ["0x10"]],
["inspect-erlang-beam", "--max-chunks", "maxChunks", ["1e1"]],
["inspect-erlang-beam", "--max-atoms", "maxAtoms", ["0b1"]],
@@ -283,6 +285,7 @@ describe("pyc and BEAM limit options", () => {
cliTest.for([
["inspect-python-pyc", "--max-depth=016"],
["inspect-deb-package", "--max-ar-members=016"],
["inspect-erlang-beam", "--max-chunks=016"],
] as const)("keeps a decimal %s limit", async ([command, flag], { cli }) => {
const result = await cli.run({
@@ -0,0 +1,264 @@
import { symlink, writeFile } from "node:fs/promises";
import { join } from "node:path";
import { afterEach, expect, it } from "vitest";
import { createDebPackageService } from "../../../src/composition/debPackage.js";
import { projectAnalysisError } from "../../../src/domain/analysisErrorProjection.js";
import {
DEFAULT_CONTROL_TEXT,
debPackageFixture,
notArBytes,
} from "../../../src/deb/DebPackage.fixture.js";
import {
compressXz,
replaceXzBindingForTests,
} from "../../../src/deb/xzDecoder.js";
import { awaitAcknowledgement } from "../../fixtures/lifecycleAcknowledgement.js";
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
afterEach(() => {
replaceXzBindingForTests(undefined);
});
it("reports unavailable or non-file Debian package paths as caller input errors", async () => {
const root = await createTestTempDirectory("rea-deb-files-");
const path = join(root, "hello.deb");
const alias = join(root, "alias.deb");
await writeFile(path, debPackageFixture());
await symlink(path, alias);
const service = createDebPackageService();
for (const [candidate, reason] of [
[root, "invalid_format"],
[alias, "invalid_format"],
[join(root, "missing.deb"), "invalid_value"],
[join(path, "child.deb"), "invalid_value"],
] as const) {
const result = await service.inspect({ path: candidate });
if (result.ok) throw new Error("Expected file acquisition failure");
expect(result.error).toMatchObject({
_tag: "AnalysisInputError",
operation: "inspect_deb_package",
issues: [
{
path: ["path"],
reason,
message: expect.any(String),
},
],
});
}
});
it("reports malformed Debian package bytes as a target failure", async () => {
const root = await createTestTempDirectory("rea-deb-malformed-");
const path = join(root, "malformed.deb");
await writeFile(path, notArBytes());
const result = await createDebPackageService().inspect({ path });
if (result.ok) throw new Error("Expected malformed target failure");
expect(result.error).toMatchObject({
_tag: "AnalysisTargetFailureError",
operation: "inspect_deb_package",
path,
failure: { kind: "malformed", format: "deb" },
});
});
it("returns typed resource and cancellation failures", async () => {
const root = await createTestTempDirectory("rea-deb-budget-");
const path = join(root, "hello.deb");
const bytes = debPackageFixture();
await writeFile(path, bytes);
const service = createDebPackageService();
const tooSmall = await service.inspect({ path, max_file_bytes: 16 });
if (tooSmall.ok) throw new Error("Expected resource budget failure");
expect(tooSmall.error._tag).toBe("AnalysisResourceConstraintError");
const fileSizeError = projectAnalysisError(tooSmall.error);
expect(fileSizeError).toMatchObject({
code: "resource_constraint",
retryable: false,
details: {
limit: {
control_kind: "parameter",
parameter: "max_file_bytes",
effective_value: 16,
minimum: 16,
maximum: 536870912,
default_value: 67108864,
unit: "bytes",
},
refusal: { kind: "adjustable_budget" },
},
remediation: { action: expect.stringContaining("max_file_bytes") },
});
expect(fileSizeError.remediation?.action).not.toContain("--max-file-bytes");
const oversize = await service.inspect({ path, max_data_entries: 1 });
if (oversize.ok) throw new Error("Expected data-entry budget failure");
expect(oversize.error._tag).toBe("AnalysisResourceConstraintError");
const entryError = projectAnalysisError(oversize.error);
expect(entryError).toMatchObject({
code: "resource_constraint",
retryable: false,
details: {
limit: {
control_kind: "parameter",
parameter: "max_data_entries",
effective_value: 1,
minimum: 1,
maximum: 65536,
default_value: 4096,
unit: "count",
},
refusal: { kind: "adjustable_budget" },
},
remediation: { action: expect.stringContaining("max_data_entries") },
});
expect(entryError.remediation?.action).not.toContain("--max-data-entries");
const cancelled = await service.inspect(
{ path },
{ signal: AbortSignal.abort() },
);
if (cancelled.ok) throw new Error("Expected cancellation");
expect(cancelled.error._tag).toBe("AnalysisCancelledError");
});
it("reports a fixed reader allowance as a limit with the partial report", async () => {
const root = await createTestTempDirectory("rea-deb-allowance-");
const path = join(root, "wide.deb");
await writeFile(
path,
debPackageFixture({
controlText: `${DEFAULT_CONTROL_TEXT}Depends: ${Array(65_537).fill("a").join("|")}\n`,
}),
);
const result = await createDebPackageService().inspect({ path });
if (result.ok) throw new Error("Expected relationship allowance failure");
expect(result.error._tag).toBe("AnalysisResourceConstraintError");
expect(projectAnalysisError(result.error)).toMatchObject({
code: "resource_constraint",
retryable: false,
});
expect(result.error).toMatchObject({
reportedLimits: { boundary: "relationship_alternatives", maximum: 65_536 },
recovery: {
fixedAllowance: {
name: "The control relationship alternatives allowance",
kind: "parser",
limit: 65_536,
},
},
diagnostics: { partial: { ar: { format_version: "2.0" } } },
});
});
it("reports typed cancellation and preserves partial control facts during XZ data decoding", async () => {
const root = await createTestTempDirectory("rea-deb-xz-cancel-");
const path = join(root, "hello-xz.deb");
await writeFile(
path,
debPackageFixture({
controlCompression: "gzip",
dataCompression: "xz",
}),
);
const controller = new AbortController();
const reason = new Error("caller cancelled during xz data decoding");
replaceXzBindingForTests({
status: "ready",
api: {
compressSync: (input) =>
compressXz(typeof input === "string" ? Buffer.from(input) : input),
decompressStream: () =>
new ReadableStream<Buffer>({
pull() {
controller.abort(reason);
throw reason;
},
}),
},
});
const result = await createDebPackageService().inspect(
{ path },
{ signal: controller.signal },
);
if (result.ok) throw new Error("Expected cancellation during XZ decoding");
expect(result.error._tag).toBe("AnalysisCancelledError");
expect(result.error.cause).toBe(reason);
expect(projectAnalysisError(result.error)).toMatchObject({
code: "cancelled",
});
expect(result.error.diagnostics).toMatchObject({
partial: {
ar: { format_version: "2.0" },
control: {
package: "hello",
version: { raw: "1:2.03-1" },
},
coverage: { status: "partial" },
},
});
});
it("waits for an in-flight async XZ parse before close resolves", async () => {
const root = await createTestTempDirectory("rea-deb-xz-close-");
const path = join(root, "hello-xz.deb");
const fixture = debPackageFixture({
controlCompression: "gzip",
dataCompression: "xz",
});
await writeFile(path, fixture);
let enteredXzDecode!: () => void;
const xzStarted = new Promise<void>((resolve) => {
enteredXzDecode = resolve;
});
let finishXzDecode!: () => void;
const xzGate = new Promise<void>((resolve) => {
finishXzDecode = resolve;
});
replaceXzBindingForTests({
status: "ready",
api: {
compressSync: (input) =>
compressXz(typeof input === "string" ? Buffer.from(input) : input),
decompressStream: () =>
new ReadableStream<Buffer>({
async pull(controller) {
enteredXzDecode();
await xzGate;
controller.enqueue(Buffer.alloc(1024));
controller.close();
},
}),
},
});
const service = createDebPackageService();
const inspectPromise = service.inspect({ path });
let closePromise: Promise<void> | undefined;
try {
await awaitAcknowledgement(
xzStarted,
inspectPromise,
"XZ data decode entry",
);
let closeResolved = false;
closePromise = service.close().then(() => {
closeResolved = true;
});
await new Promise((resolve) => setTimeout(resolve, 25));
expect(closeResolved).toBe(false);
finishXzDecode();
const [inspectResult] = await Promise.all([inspectPromise, closePromise]);
expect(closeResolved).toBe(true);
expect(inspectResult.ok).toBe(true);
} finally {
finishXzDecode();
await Promise.allSettled([inspectPromise, closePromise ?? service.close()]);
}
});
+119 -1
View File
@@ -1,6 +1,9 @@
import { expect, it } from "vitest";
import { pluginPackageMetadata } from "../../../scripts/lib/plugin-package.mjs";
import {
pluginPackageMetadata,
pluginPlatformPackages,
} from "../../../scripts/lib/plugin-package.mjs";
const fixture = () => ({
manifest: {
@@ -93,3 +96,118 @@ it("refuses a stale lock before producing a release artifact", () => {
"matching v3 package lock",
);
});
const platformLock = () => ({
name: "rea-agents",
version: "6.8.0",
lockfileVersion: 3,
packages: {
"": { name: "rea-agents", version: "6.8.0" } as Record<string, unknown>,
"node_modules/pty": {
version: "1.0.0",
optionalDependencies: { "pty-darwin-arm64": "1.0.0" },
} as Record<string, unknown>,
"node_modules/pty-darwin-arm64": {
version: "1.0.0",
integrity: "pty digest",
os: ["darwin"],
cpu: ["arm64"],
optional: true,
} as Record<string, unknown>,
"node_modules/xz": {
version: "2.0.0",
optionalDependencies: {
"xz-win32-x64": "2.0.0",
"xz-linux-x64": "2.0.0",
"xz-freebsd-x64": "2.0.0",
"xz-wasm32": "2.0.0",
},
} as Record<string, unknown>,
"node_modules/xz-win32-x64": {
version: "2.0.0",
integrity: "win digest",
os: ["win32"],
cpu: ["x64"],
optional: true,
} as Record<string, unknown>,
// A development copy of another version is hoisted; the runtime one nests.
"node_modules/xz/node_modules/xz-linux-x64": {
version: "2.0.0",
integrity: "linux digest",
os: ["linux"],
cpu: ["x64"],
optional: true,
} as Record<string, unknown>,
"node_modules/xz-freebsd-x64": {
version: "2.0.0",
integrity: "bsd digest",
os: ["freebsd"],
cpu: ["x64"],
optional: true,
} as Record<string, unknown>,
"node_modules/xz-wasm32": {
version: "2.0.0",
integrity: "wasm digest",
cpu: ["wasm32"],
optional: true,
} as Record<string, unknown>,
},
});
it("bundles supported-host binaries of every runtime native dependency, not only the PTY", () => {
expect(pluginPlatformPackages(platformLock())).toEqual([
{
name: "pty-darwin-arm64",
path: "node_modules/pty-darwin-arm64",
version: "1.0.0",
integrity: "pty digest",
},
{
name: "xz-win32-x64",
path: "node_modules/xz-win32-x64",
version: "2.0.0",
integrity: "win digest",
},
{
name: "xz-linux-x64",
path: "node_modules/xz/node_modules/xz-linux-x64",
version: "2.0.0",
integrity: "linux digest",
},
]);
});
it("refuses a supported-host binary the lock cannot pin", () => {
const lock = platformLock();
delete lock.packages["node_modules/xz-win32-x64"].integrity;
expect(() => pluginPlatformPackages(lock)).toThrow(
"Plugin platform dependency is not locked: xz-win32-x64",
);
delete (lock.packages as Record<string, unknown>)[
"node_modules/xz-win32-x64"
];
expect(() => pluginPlatformPackages(lock)).toThrow(
"Plugin platform dependency is not locked: xz-win32-x64",
);
});
it("covers the locked XZ decoder for macOS and Windows plugin hosts", async () => {
const { readFile } = await import("node:fs/promises");
const lock = JSON.parse(await readFile("package-lock.json", "utf8"));
const manifest = JSON.parse(await readFile("package.json", "utf8"));
const names = pluginPlatformPackages(
pluginPackageMetadata(manifest, lock).shrinkwrap,
).map(({ name }) => name);
expect(names).toEqual(
expect.arrayContaining([
"@lydell/node-pty-darwin-arm64",
"@lydell/node-pty-win32-x64",
"@napi-rs/lzma-darwin-arm64",
"@napi-rs/lzma-darwin-x64",
"@napi-rs/lzma-linux-x64-gnu",
"@napi-rs/lzma-win32-arm64-msvc",
"@napi-rs/lzma-win32-x64-msvc",
]),
);
expect(names).not.toContain("@napi-rs/lzma-wasm32-wasi");
});
@@ -11,6 +11,7 @@ import { WEB_SCRIPT_TOOL_CONTRACTS } from "../../../src/contracts/webScriptToolC
import { API_CONTRACT_TOOL_CONTRACTS } from "../../../src/contracts/apiContractToolContracts.js";
import { PLAYWRIGHT_TRACE_TOOL_CONTRACTS } from "../../../src/contracts/playwrightTraceToolContracts.js";
import { PYTHON_PYC_TOOL_CONTRACTS } from "../../../src/contracts/python/pythonPycToolContracts.js";
import { DEB_PACKAGE_TOOL_CONTRACTS } from "../../../src/contracts/deb/debPackageToolContracts.js";
import { NUGET_NUPKG_TOOL_CONTRACTS } from "../../../src/contracts/nuget/nupkgToolContracts.js";
import { VSIX_PACKAGE_TOOL_CONTRACTS } from "../../../src/contracts/vsix/vsixPackageToolContracts.js";
import { OCI_IMAGE_LAYOUT_TOOL_CONTRACTS } from "../../../src/contracts/oci/ociImageLayoutToolContracts.js";
@@ -25,6 +26,7 @@ const CONTRACTS = [
...API_CONTRACT_TOOL_CONTRACTS,
...PLAYWRIGHT_TRACE_TOOL_CONTRACTS,
...PYTHON_PYC_TOOL_CONTRACTS,
...DEB_PACKAGE_TOOL_CONTRACTS,
...NUGET_NUPKG_TOOL_CONTRACTS,
...VSIX_PACKAGE_TOOL_CONTRACTS,
...OCI_IMAGE_LAYOUT_TOOL_CONTRACTS,
@@ -43,6 +45,7 @@ const PATH_FIELDS = {
inspect_devicetree: ["path"],
inspect_playwright_trace: ["path"],
inspect_python_pyc: ["path"],
inspect_deb_package: ["path"],
inspect_nuget_nupkg: ["path"],
inspect_vsix_package: ["path"],
inspect_oci_image_layout: ["path"],
@@ -153,6 +156,7 @@ it("rejects one relative path field at a time on tools/list", async () => {
"inspect_devicetree.path",
"inspect_playwright_trace.path",
"inspect_python_pyc.path",
"inspect_deb_package.path",
"inspect_nuget_nupkg.path",
"inspect_vsix_package.path",
"inspect_oci_image_layout.path",
+195
View File
@@ -0,0 +1,195 @@
import { writeFile } from "node:fs/promises";
import { join } from "node:path";
import { afterAll, expect, it } from "vitest";
import { DEB_PACKAGE_TOOL_CONTRACTS } from "../../../src/contracts/deb/debPackageToolContracts.js";
import { debPackageSchema } from "../../../src/domain/deb/debPackage.js";
import {
debPackageFixture,
notArBytes,
} from "../../../src/deb/DebPackage.fixture.js";
import { canonicalOutputSchema } from "../../fixtures/canonicalOutputSchema.js";
import { createApplicationMcpHarness } from "../../fixtures/applicationMcpHarness.js";
import { createTestBinarySession } from "../../fixtures/binarySession.js";
import { createMcpSchemaValidation } from "../../fixtures/mcpSchemaValidation.js";
import { parseMcpToolError } from "../../fixtures/mcpToolError.js";
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
const debContract = DEB_PACKAGE_TOOL_CONTRACTS.find(
(item) => item.name === "inspect_deb_package",
);
if (debContract === undefined)
throw new Error("Missing inspect_deb_package contract");
const completeDebEvidenceSchema = debContract.outputSchema.safeExtend({
normalized_result: debPackageSchema,
});
const schemaValidation = createMcpSchemaValidation();
afterAll(() => schemaValidation.clear());
const connect = () =>
createApplicationMcpHarness({
session: createTestBinarySession(() => {
throw new Error(
"Debian package inspection must not start a deep provider",
);
}),
serverOptions: {
environment: {
...process.env,
REA_MCP_MAX_INPUT_ELEMENTS: process.env.REA_MCP_MAX_INPUT_ELEMENTS,
},
},
schemaValidator: schemaValidation,
});
it("advertises inspect_deb_package and reads package identity", async () => {
const { client, close } = await connect();
try {
const advertised = (await client.listTools()).tools.find(
(tool) => tool.name === "inspect_deb_package",
);
expect(advertised?.annotations).toMatchObject({
readOnlyHint: false,
idempotentHint: true,
});
if (advertised === undefined)
throw new Error("Missing advertised inspect_deb_package tool");
expect(advertised.outputSchema).toBeUndefined();
expect(
schemaValidation.assertions.validateSchema(
canonicalOutputSchema(advertised.name),
),
).toBe(true);
const root = await createTestTempDirectory("rea-deb-mcp-");
const path = join(root, "hello_2.03-1_all.deb");
await writeFile(path, debPackageFixture());
const response = await client.callTool(
{ name: "inspect_deb_package", arguments: { path } },
{ toolDefinition: advertised },
);
expect(response.isError, JSON.stringify(response.content)).not.toBe(true);
const evidence = completeDebEvidenceSchema.parse(
response.structuredContent,
);
expect(evidence.normalized_result.control?.package).toBe("hello");
expect(evidence.normalized_result.control?.version).toMatchObject({
epoch: 1,
upstream: "2.03",
revision: "1",
});
expect(evidence.normalized_result.ar.format_version).toBe("2.0");
} finally {
await close();
}
});
it("requires an absolute path for inspect_deb_package", async () => {
const { client, close } = await connect();
try {
const response = await client.callTool({
name: "inspect_deb_package",
arguments: { path: "hello.deb" },
});
expect(response.isError).toBe(true);
expect(parseMcpToolError(response).error).toMatchObject({
code: "invalid_request",
details: { operation: "inspect_deb_package" },
});
} finally {
await close();
}
});
it("delivers the parsed control facts when data.tar is refused", async () => {
const { client, close } = await connect();
try {
const root = await createTestTempDirectory("rea-deb-mcp-partial-");
const path = join(root, "bad-data.deb");
const bytes = debPackageFixture({ corruptDataChecksum: true });
await writeFile(path, bytes);
// The data member's header follows the even-padded control member; its
// offset depends on the compressed control size, so derive it.
const dataHeader = bytes.indexOf("data.tar.gz", 8, "latin1");
const dataOffset = dataHeader + 60;
const response = await client.callTool({
name: "inspect_deb_package",
arguments: { path },
});
expect(response.isError).toBe(true);
const { error } = parseMcpToolError(response);
expect(error).toMatchObject({
code: "unsupported_target",
details: {
operation: "inspect_deb_package",
failure_kind: "malformed",
format: "deb",
diagnostics: {
partial: {
ar: {
members: expect.arrayContaining([
expect.objectContaining({
name: "data.tar.gz",
offset: dataOffset,
}),
]),
},
control: {
package: "hello",
version: { raw: "1:2.03-1" },
maintainer_scripts: expect.arrayContaining([
expect.objectContaining({ name: "postinst" }),
]),
},
},
},
},
});
} finally {
await close();
}
});
it("refuses malformed ar bytes and inspects xz-compressed members", async () => {
const { client, close } = await connect();
try {
const root = await createTestTempDirectory("rea-deb-mcp-refuse-");
const malformed = join(root, "not.deb");
const xz = join(root, "hello.xz.deb");
await writeFile(malformed, notArBytes());
await writeFile(
xz,
debPackageFixture({
controlCompression: "xz",
dataCompression: "xz",
}),
);
const invalid = await client.callTool({
name: "inspect_deb_package",
arguments: { path: malformed },
});
expect(parseMcpToolError(invalid).error).toMatchObject({
code: "unsupported_target",
details: {
operation: "inspect_deb_package",
failure_kind: "malformed",
format: "deb",
},
});
const inspected = await client.callTool({
name: "inspect_deb_package",
arguments: { path: xz },
});
expect(inspected.isError, JSON.stringify(inspected.content)).not.toBe(true);
const evidence = completeDebEvidenceSchema.parse(
inspected.structuredContent,
);
expect(evidence.normalized_result.control?.package).toBe("hello");
expect(
evidence.normalized_result.ar.members.map((member) => member.name),
).toEqual(["debian-binary", "control.tar.xz", "data.tar.xz"]);
} finally {
await close();
}
});
@@ -10,6 +10,10 @@ import { createSqliteDatabaseFixture } from "../../../fixtures/sqlite/database.j
import { createTestTempDirectory } from "../../../fixtures/temporaryDirectory.js";
import { buildFv } from "../../../fixtures/uefiImage.js";
import { createDirectAnalysis } from "../../../../src/composition/directAnalysis.js";
import {
arArchive,
debPackageFixture,
} from "../../../../src/deb/DebPackage.fixture.js";
import { artifactInspectionResultSchema } from "../../../../src/domain/artifactInspection.js";
import { parseEvidence } from "../../../../src/domain/evidence.js";
@@ -123,6 +127,12 @@ it.each([
format: "sqlite",
operation: "inspect_sqlite_database",
},
{
name: "a Debian package",
create: writeBytes("hello.deb", () => debPackageFixture()),
format: "deb",
operation: "inspect_deb_package",
},
])(
"inventories $name and routes it to $operation",
async ({ create, format, operation }) => {
@@ -150,6 +160,21 @@ it("keeps bytes that only resemble a pyc frame unsupported", async () => {
).resolves.toMatchObject({ code: "target_unavailable" });
});
it("keeps a plain ar archive that is not a Debian package unsupported", async () => {
const directory = await createTestTempDirectory("rea-standalone-format-");
const path = join(directory, "libhello.a");
await writeFile(
path,
arArchive([{ name: "hello.o", data: Buffer.from("object") }]),
);
await expect(
runProviderAnalysis(path, "inspect_artifact", {}).then(
projectCliAnalysisResult,
),
).resolves.toMatchObject({ code: "target_unavailable" });
});
it("routes a bFLT executable's text segment to open_binary", async () => {
const directory = await createTestTempDirectory("rea-standalone-format-");
const path = await writeBytes("app.flt", () =>
@@ -50,6 +50,7 @@ export const PROVIDER_CAPABILITY_CONFORMANCE: Readonly<
cases: ["tests/acceptance/byteEntropyWindowsIdentity.test.ts"],
},
cutter: { cases: ["tests/boundary/cli/cutterStatusAttributionCli.test.ts"] },
debPackage: { cases: ["tests/acceptance/debPackageCli.test.ts"] },
desktopApplication: {
cases: ["tests/boundary/cli/desktopApplicationCli.test.ts"],
},
@@ -1243,6 +1243,15 @@ export const PROVIDER_LIFECYCLE_COVERAGE: Readonly<
),
},
},
"rea-deb-package": inProcess(
covered(
test(
"tests/acceptance/debPackageCli.test.ts",
"inspects a fixture .deb without installing it or running maintainer scripts",
),
),
typedFailures("tests/boundary/filesystem/debPackage.test.ts"),
),
"rea-devicetree": inProcess(
covered(
test(
@@ -29,6 +29,7 @@ const foreign = (
*/
export default targetFailureReaders([
foreign("inspect_python_pyc", "malformed", "python-pyc"),
foreign("inspect_deb_package", "malformed", "deb"),
foreign("inspect_rust_binary", "unsupported", "native-binary"),
foreign("inspect_go_binary", "unsupported", "native-binary"),
foreign("inspect_elf_notes", "malformed", "elf"),