mirror of
https://github.com/morluto/rea.git
synced 2026-11-29 18:06:46 +00:00
3a8a717b02edcd41b9dfbf64e82e5f7a761dfd8e
219
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
0f5ab1e042 |
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> |
||
|
|
47daa05a84 |
feat(pe): report the overlay appended after a PE image's last section (#13245)
* feat(pe): report the overlay appended after a PE image's last section * chore(schemas): add the inspect_pe_overlay schema summary * test(pe): expect the shared non-PE refusal message in MZ admission * test(cli): record completion goldens for inspect-pe-overlay * fix(pe): preserve overlay diagnostics and validate certificate spans Keep impossible security directory spans in measured overlay bytes and share bounded format recognition with inventory. Validate structured overlay facts in the domain while preserving provider diagnostics. * docs(pe): move the PE overlay guide under docs/guides * fix(pe): keep overlay format recognition within its probe * Address review feedback * fix(pe): keep header anomalies in the overlay report parsePeOverlay dropped pe_header_anomalies from readPeImage, so a SizeOfHeaders that ends before the section table reached the overlay report without its warning. Carry header_anomalies through the output contract and Evidence result, as the certificate, import and load config reports already do. * Address review feedback * fix(pe): report adjustable max_file_bytes budget and preserve omitted caller parameters in inspect_pe_overlay * fix(pe): preserve required_value on file-size limit and use executeArtifactInspection in PeOverlayService * chore(schemas): update inspect_pe_overlay advertised schema summary * fix(pe): include bflt in PE overlay leading formats * test(pe): import BINARY_DIAGNOSTICS_TOOL_CONTRACTS in PE overlay tests --------- 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> |
||
|
|
2c89136469 |
feat(artifacts): inspect VS Code extension packages offline (#12469)
* feat(artifacts): inspect VS Code extension packages offline REA had no owner for a local .vsix ZIP. inspect_vsix_package and inspect-vsix-package now read extension.vsixmanifest and extension/package.json, report identity disagreements, engine range, activation events, a contributes summary, hashed native/wasm/executable members, and a ZIP inventory without installing the extension or contacting a marketplace. Missing or malformed manifests return the inventory with limitations. Invalid ZIP input fails without partial success. Signature files are reported present or absent and are not verified. * fix(vsix): bound vsixmanifest XML nodes before building the tree A compressed extension.vsixmanifest within the 16 MiB byte budget can still expand into millions of XML nodes. Count nodes as a stream first, as the Maven POM reader does, and refuse the manifest with an xml_nodes limit before parseXmlDocument allocates its document. * fix(vsix): report the vsixmanifest node ceiling as a fixed allowance The xml_nodes limit is a fixed parser ceiling, not a caller budget, so the provider fell through to a generic memory refusal that implied more memory could help. Map it through fixedAllowanceOptions as the Maven provider does and cover the public error from the provider. * refactor(vsix): classify provider failures through the shared owner VsixPackageProvider kept its own chain for cancellation, identity, path, selected-file and cleanup failures. It now supplies a dialect to classifyProviderFailure with only the package's own refusals: its parse ceilings and budget recovery, format failures, fixed reader allowances and the max_file_bytes refusal. The held snapshot still supplies the completed identity for a parser failure after the read. * fix(vsix): report an empty contributes key instead of failing the report A package.json with an empty contributes key produced a key with an empty name, which the contract refuses, so the whole inventory was rejected. The empty key is now left out of contributes.keys and reported as a limitation. * fix(vsix): charge member decoding to one package-wide budget Each hashed member was read with a fresh per-member budget, so a small compressed package with thousands of members could make the parser decode several GiB. Member reads now draw on one artifactExpansionBudgetBytes budget for the package; once it is spent, remaining members stay in the inventory without a digest and a limitation names the spent budget. * fix(vsix): resolve dot segments in package.json entry points packageJsonEntryPath stripped only one leading ./, so a main such as ./out/./extension.js named extension/out/./extension.js and was reported absent even when extension/out/extension.js existed. Entry points now resolve . and .. segments under extension/; a path that climbs out of extension/ keeps its unresolved form and matches no member. * fix(vsix): resolve entry points with the loader's lookup rules An extension-less main such as ./out/extension was looked up as a literal ZIP name and reported absent although Node resolves it to extension/out/extension.js. main now tries Node's CommonJS file and directory suffixes, browser tries the .js the web extension host adds, and the reported path is the member found. * fix(vsix): resolve a directory main through its own package.json Node's directory lookup reads the directory's package.json main before falling back to index files, so an entry like main: ./out with out/package.json naming ./start.js now resolves as present. * Address review feedback * fix(vsix): report interesting member sizes past 4 GiB A ZIP64 member can declare an uncompressed size above 0xffffffff while the compressed package stays under max_file_bytes. The parser skips hashing it and reports the declared size, but interesting_members[].bytes used the 32-bit uint schema, so the service rejected the whole report. The field now takes any nonnegative integer, matching contents[].uncompressed_size. * fix(vsix): report a malformed directory package.json instead of its index When main names a directory whose package.json is not a JSON object, Node's loader throws ERR_INVALID_PACKAGE_CONFIG rather than falling back to index.js. Keep that outcome distinct from a manifest with no usable main: mark the entry point absent and add a limitation naming the member. * fix(vsix): classify Java archives as nested archives A bundled .jar, .war or .ear is a ZIP, but the path classifier returned unknown for it, so it was never hashed or counted as a nested archive. * fix(vsix): match entry points by exact member case Resolve main and browser entry points against exact ZIP member names, as a case-sensitive file system would, and report a member that matches only when case is ignored as a limitation instead of marking the entry present. The directory package.json used to resolve a directory main is matched exactly too. * fix(vsix): keep directory-only intent for a trailing-slash main A main such as "./out/", ".", "..", or one ending in "/." or "/.." can only name a directory under Node's loader. Normalizing it to a bare path let a sibling file like extension/out.js match and report the entry as present. Carry a directory-only flag from the raw value and skip file candidates in the declared-path lookup and in the check that decides whether to read <main>/package.json. * fix(vsix): only blame case when the spelling differs The case-only entry point warning scanned index candidates even when a malformed directory package.json had already stopped the main lookup, so an exact extension/out/index.js could be reported as a case mismatch. Skip index candidates when the directory manifest is malformed, and skip any candidate whose member is spelled exactly as declared. * fix(vsix): stop main lookup at an over-budget directory package.json When main names a directory whose package.json exceeds max_manifest_bytes, its main is unknown, so falling back to index.* could report a file Node would not load. Treat the unread manifest like a malformed one: report main unresolved, add a limitation that says the index files were not used, and skip the index files in the case-only scan. * fix(vsix): resolve a main that normalizes to the package root A main of ".", "./" or "./out/.." normalized to "extension/", so the directory lookups searched "extension//package.json" and "extension//index.js" and reported a present index file as absent. Return "extension" for the root so those lookups name real members. * fix(vsix): stop main lookup at an unread directory package.json An encrypted or duplicated directory package.json left the directory main unresolved as "none", so lookup fell through to index files even though the unread manifest may name another file or be invalid. Mark it unread and stop the lookup, as the over-budget branch already does. * test(vsix): tag the decode-budget regression long-running The package-wide decode budget test passed a fixed 60-second deadline, which also turned off coverage and CI deadline scaling. Use the long-running tag the testing guide prescribes instead. * fix(vsix): leave unread dependency declarations unknown A missing, encrypted, or malformed manifest reported its extension dependencies and extension pack as empty lists, so a declaration on the other side showed up as a disagreement. Report the unread side as null and only flag a disagreement when both manifests were read. * fix(vsix): look up entry points by their literal text package.json main, browser, and a directory package.json main were trimmed before lookup. A ZIP member name can begin or end with whitespace and Node does not trim the specifier, so "./out/start.js " was reported absent or matched the different "out/start.js" member. Use the declared text as written; only an empty string names nothing. * fix(vsix): keep activation events literal before eager classification VS Code matches activation events as exact strings, so "* " and "onStartupFinished " are not startup activations. The parser read activationEvents through the whitespace-trimming ID helper, which turned those values into "*" and "onStartupFinished" and reported them as eager. Read activation events with a literal helper that drops only empty strings and exact duplicates, and cover the padded values next to their exact-name controls. * fix(vsix): keep mode-executable members inventoried when unread A member with no recognized suffix but Unix execute bits was only classified after its magic was read. When the hash budget, the package decode budget, encryption, or traversal skipped that read, it stayed unknown and fell out of interesting_members and the executable count. Unread mode-executable members now keep an inferred executable kind. * fix(vsix): count a singleton contributes.commands object VS Code accepts contributes.commands as one command object as well as an array. Normalize the singleton form before capping and counting so a package with one command reports commands_total 1 and the commands key count matches. * fix(vsix): keep contributed command identifiers literal VS Code registers and invokes a contributed command by its exact identifier, and the parser already keeps onCommand activation events literal. Commands went through the trimming text helper, so a declared "demo.run " was reported as "demo.run" next to an "onCommand:demo.run " event, giving two different identities for the same command. Keep the declared command text as written and report null only for an empty string. Titles are display text and stay trimmed. * fix(vsix): do not infer executables from symlink modes A Unix symlink entry carries 0o120777, so its permission bits made an unread link look like an executable helper. Only regular files, or entries with no recorded file type, now count toward mode-inferred executables. * style(vsix): apply oxfmt to manifest limit guard * fix(vsix): keep mode-executable kind when read bytes have no known magic A suffixless regular Unix member with execute bits but no recognized magic (for example a shell helper without a shebang) was listed as an executable only when the hash budget skipped its read. Raising the budget enough to hash it resolved the kind to unknown and dropped it from interesting_members and the executable count. Fall back to the mode-derived executable kind when the read bytes match no magic. * fix(vsix): charge failed member expansions to the package budget A member whose ZIP header understates its uncompressed size can decode its whole allowance before the bounded writer refuses it. That work was not charged to the package-wide decode budget, so every later failing member got the same allowance again. Charge the allowance on a max_member_bytes failure so later members see the spent budget. * fix(vsix): bound JSON values before parsing manifests Both package.json readers called JSON.parse after a byte-only check, so a 16 MiB manifest of many tiny values could allocate far more memory than its text. A one-pass countJsonValues scan now runs first: an extension/package.json holding more than 1,048,576 values is refused with a fixed json_values parser allowance, and an over-allowance directory package.json is left unread with a limitation, so its index files are not used. * Address review feedback * fix(vsix): treat absolute directory package.json main as outside the package Node resolves a directory package main with path.resolve(dir, main), so an absolute main names a host file, never a package member. Report it as no main so the lookup falls back to index.* or reports the entry absent. * fix(vsix): tag escaped entry points instead of matching them as members A package.json main or browser that climbs out of extension/ was kept as an ordinary member path string. A traversal ZIP member with the same name (extension/../outside.js) is in the inventory, so the lookup reported the entry point present even though that member is never extracted. packageJsonEntryPath now returns a tagged resolved/escaped value. Escaped entry points skip the member, directory manifest and case-only lookups and are reported with present: false. * fix(vsix): decode directory package.json as UTF-8 like Node Node reads a nested package.json as UTF-8 only. A UTF-16 manifest fails with ERR_INVALID_PACKAGE_CONFIG, so report it malformed instead of transcoding it and marking main present. * fix(vsix): keep directory package.json main inside the extension root A directory package.json main such as ../../outside.js could pop the extension segment and resolve to an archive-root member, which was then reported as the present main entry point. Treat any main that climbs out of extension/ as naming no main, so the lookup falls back to index.* or reports the entry absent. * fix(vsix): keep a root directory main from matching archive-root files A nested package.json main such as ".." in extension/out resolves to the extension root itself. Trying file suffixes on that path matched an archive-root extension.js, which sits outside the installed payload. Mark such a main directoryOnly and resolve it through extension/index.* only, as Node does. * fix(vsix): skip member reads once the package decode budget is spent A compressed member declaring zero uncompressed bytes passed the declared-size check even with no package allowance left, so its decoder still ran and produced output before the writer rejected it. The failure then charged zero, letting each later zero-declared member decompress again past the package ceiling. Skip the read and report the spent budget once nothing remains. * fix(vsix): keep declared API proposal names literal Read enabledApiProposals with the literal list reader used for activation events. VS Code matches proposal names exactly, so trimming whitespace or splitting on commas reported identifiers the package never declared and collapsed declarations that differ only in surrounding whitespace. * fix(vsix): select manifests by their exact member path Count ZIP members by exact logical path. A package holding only extension/Package.json no longer has it parsed as extension/package.json, and a case-only sibling no longer marks the real lowercase manifest as a duplicate and drops its facts. Names that differ only in case, and a manifest present only under another case, are reported as their own limitations. * fix(vsix): treat shared libraries as interesting members Bundled .dll, .so (including versioned .so.N names) and .dylib files without Unix execute bits were classified unknown, so their magic was never read and they were missing from interesting_members and the summary count. Classify these suffixes as executable so they are hashed and listed like .exe and .node members. * refactor(vsix): run inspection through the shared artifact runner VsixPackageService now delegates input parsing, the provider call, output checks, Evidence creation and late cancellation to executeArtifactInspection, as NugetNupkgService does, keeping only the VSIX-specific report checks. * feat(vsix): point first-contact inspection of a .vsix to the VSIX reader inspect_artifact now suggests inspect_vsix_package when a ZIP holds a root extension.vsixmanifest file. The non-ZIP refusal test follows main's unsupported_target classification for malformed target bytes. * fix(vsix): align artifact failures with main * fix(vsix): bound inspect_vsix_package output with shared detail/summary contract * Address review feedback * fix(vsix): bound summary text fields and report structured parameter limits * fix(vsix): omit required_value on early-stop parameter limits * refactor(vsix): count eager activation events without intermediate array --------- Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: Matt Van Horn <mvanhorn@MacBook-Pro-10.local> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> |
||
|
|
6a6e7b0bbf |
feat(artifacts): inventory OCI image layouts offline (#12470)
* feat(artifacts): inventory OCI image layouts offline
OCI image-layout directories (oci-layout, index.json, blobs/) arrive as evidence and previously required walking the JSON by hand.
This adds inspect_oci_image_layout / inspect-oci-image-layout for the directory form only. It reports layout version, nested indexes, image config facts, layers, and streamed SHA-256 (and SHA-512 when declared) verification of present referenced blobs. Env values stay omitted unless include_env_values is selected. Missing blobs, digest and size mismatches, unreferenced blobs, unknown media types, unsupported digest algorithms, and symlink blobs are findings. Layer contents are not decompressed.
* fix(oci): preserve whitespace in image config strings
Keep config facts such as WorkingDir exactly as written instead of
returning their trimmed form. Blank values still count as absent.
* fix(oci): read the platform os.version member
The OCI image index stores a platform version under the literal
"os.version" member, so Windows entries that share OS and architecture
keep the build that tells them apart.
* fix(oci): keep config Env values unless the caller omits them
Env values are bytes from the selected image, and AGENTS.md asks to
preserve local evidence without inferring secrecy from names. The
include_env_values control now defaults to true; false still leaves each
value null and keeps the names.
* fix(oci): report descriptors the parser cannot model
An index, layer or config descriptor without a string mediaType or digest
was dropped with no diagnostic, so an index of only malformed descriptors
read as an empty, fully covered index. Each such descriptor now records a
malformed_blob_json finding naming its position, what it lacks and any
digest it carries.
* fix(oci): walk nested indexes breadth-first
The index walk was depth-first with a visited set that ignored depth, so
an index shared between a nested path and the root was first visited too
deep, and what it reached within max_index_depth was never inventoried.
Indexes now queue breadth-first, so each is first reached at the
shallowest depth any path gives it.
* fix(oci): check every declared size of a shared blob
When several descriptors referenced one blob with different sizes,
remember kept only the first declaration, so a wrong later size was
never checked. Each referenced blob now keeps every distinct declared
size, and the file-size and hashed-byte checks run against each one.
* fix(oci): report partial coverage when referenced JSON is not read
A referenced index, manifest or config that was a symlink, or otherwise
could not be read, left its facts unexamined while coverage still read
complete. Any skipped referenced JSON read now makes coverage partial,
whatever finding explains it.
* fix(oci): report unsupported layer digests without calling them missing
A layer whose digest used an unsupported algorithm got no finding and
was recorded as a missing blob, even when its file existed, and coverage
could read complete. Every referenced digest with an unsupported
algorithm now records unsupported_digest_algorithm, its blob record
reflects the file at blobs/<algorithm>/<encoded>, and such a finding
makes coverage partial.
* fix(oci): keep the parse outcome when reader cleanup fails
The provider's finally replaced the parse result with a cleanup failure
that always claimed the parse completed, so a refusal, cancellation or
integrity failure and its layout snapshot were lost when closing the
reader also failed. The parse outcome is now captured first; a failed
parse stays the primary error, with its partial facts, and the cleanup
failure is attached to it.
* Address review feedback
* fix(oci): keep oci-layout snapshot on missing imageLayoutVersion
Build the oci-layout file snapshot before checking imageLayoutVersion and
attach it to the refusal, so a readable oci-layout without a version still
reports its sha256 and byte count.
* fix(oci): keep directory traversal coverage in layout reports
parseOciImageLayout iterated the directory reader without an onCoverage
sink, so names the reader skipped (for example non-UTF-8 names on Linux)
left the report claiming complete coverage with no limitation. Collect
the traversal coverage, carry its limitations into the report, and let
unknown or partial traversal coverage override the findings-based status.
A reader that reports nothing is treated as unknown.
* fix(oci): keep reader failures on referenced blobs
A referenced index, manifest or config read that failed in the reader,
for example a close failure after the JSON was fully read, was recorded
as malformed_blob_json and the call carried on. Only format failures
become findings now; reader failures reach the caller with their own
facts.
* fix(oci): budget decoded descriptors separately from directory entries
max_entries bounds the directory walk, but index, manifest and layer
descriptors also spent it, so many manifests sharing layers were refused
far inside the advertised directory budget. Decoded descriptors now spend
their own max_descriptors allowance (default 65536, maximum 1048576), and
a refusal names that allowance.
* fix(oci): keep the completed inventory when reader cleanup fails
When parsing finished but closing the directory reader failed, the
provider threw a cleanup failure built against a placeholder outcome and
the completed inventory was dropped. The cleanup failure now carries the
completed report as unretained Evidence in its partial observation, the
same way DesktopApplicationReader keeps its report. A provider test
covers that case and checks that a later close retries the failed
reader cleanup.
* fix(oci): keep reader omissions out of complete layout coverage
parseOciImageLayout took the directory reader's coverage but not its
omission callback, so a FIFO, socket or device node under blobs/ was
dropped from the blob inventory while the report still said complete.
Collect omissions other than the intentional skip of directories
outside blobs/, name the first one in a limitation, and report unknown
coverage when any were seen.
* refactor(oci): classify layout failures through classifyProviderFailure
The provider kept its own raw-error ladder in layoutFailure. Its OCI
decisions (unsupported root or symlink, parse limits with budget
recovery, format failures, reader failures) are now the recognise step
of a ProviderFailureDialect, with the io report as its unclassified
fallback, so typed failures pass through, cancelled reads use the shared
cancellation path, and a failed read's cleanup is bound by the shared
owner.
* fix(oci): match referenced blobs by resolved path
parseOciDigest accepts uppercase SHA-256 hex and resolves it to the
lowercase blob path, but the unreferenced-blob sweep keyed membership by
the descriptor's original spelling. A blob named that way was hashed as
referenced and also reported as unreferenced_blob with a second
referenced: false row. Track the resolved paths of referenced blobs and
skip them in the sweep.
* fix(oci): read shared configs once and budget expanded config facts
Each manifest reread and reparsed its config, and every image carried its
own copy of the facts, so many small manifests sharing a large config
could expand to far more memory than the per-file limits suggest before
the service checked the report.
Each config blob is now read and parsed once per layout and its facts are
reused. The config bytes behind each image spend a new max_config_bytes
allowance (default 64 MiB, maximum 512 MiB) before the image is added, so
a shared config counts once per image and an expansion past the budget
refuses the inspect and names that allowance.
* fix(oci): report blob sizes above 4 GiB
Descriptor, layer and blob sizes used the 32-bit count schema, so a
layout with a blob over 4 GiB produced a report the output schema
rejected, hiding its blob_oversize finding. Sizes now accept any
nonnegative safe integer; depth and coverage counts stay 32-bit.
* fix(oci): report a referenced layer that is not a regular file
A referenced layer whose blob path is a directory was recorded as kind
other with present false, but no finding was emitted. Layer blobs never
go through the referenced JSON reader, so coverage stayed complete even
though the layer was never verified. The layer now gets a missing_blob
finding, matching non-file indexes, manifests and configs, and coverage
is reported as partial.
* fix(oci): keep the oci-layout hash when a later budget refuses
A manifest or config past max_json_bytes, or a layout past
max_descriptors or max_config_bytes, threw a bare ParseFailureError
after oci-layout had been read and hashed. The provider only attaches
partial facts to OciImageLayoutRefusal, so that completed observation
was dropped.
The parser now rewraps any later ParseFailureError as an
OciImageLayoutRefusal carrying the oci-layout snapshot, so every
refusal after that point reports it as the partial observation.
* fix(oci): keep blobs unknown when the reference walk is truncated
When max_index_depth, an unreadable index or manifest, or a descriptor
that cannot be modeled stops the reference walk, blobs outside the
walked part were reported as unreferenced_blob. They may still be
reachable from what was not examined, so the parser now only asserts
unreferenced status after a complete walk and otherwise records a
limitation and leaves those blobs out of the inventory.
* fix(oci): report wrong-typed manifests and layers arrays
A non-array manifests member in index.json now refuses the layout and
keeps the oci-layout observation. A non-array manifests member in a
nested index, or a non-array layers member in a manifest, records a
malformed_blob_json finding and marks the reference graph truncated
instead of reading as an empty collection.
* fix(oci): report image configs whose root is not a JSON object
A config blob holding valid JSON such as [] or null fell back to empty
facts with no finding, so the report claimed complete coverage. Record a
malformed_blob_json finding for the config digest while keeping the
manifest and layer observations.
* fix(oci): decode only image config media types as JSON
A manifest whose config is application/octet-stream or another
non-image type no longer has its config run through the JSON decoder.
Valid binary config bytes produced a false malformed_blob_json finding,
and a config larger than max_json_bytes refused the whole inventory even
when it fit max_blob_bytes. Such configs now stay opaque references that
the blob pass hashes; the unknown_media_type finding is kept.
* fix(oci): bound JSON reads by the descriptor budget
The service checked json_bytes_read against one max_json_bytes document
per returned index and image plus two. A layout reads a manifest and a
config per image, and manifests or nested indexes that fail to parse are
read without appearing in the report, so valid layouts whose every
document fit max_json_bytes could be rejected after parsing.
Every nested index or manifest read is charged one descriptor and each
manifest reads at most one config, so bound the total by oci-layout,
index.json and two documents per allowed descriptor.
* fix(oci): count OCI 1.1 subject blobs as referenced
A manifest or index subject that names a blob present in the layout now
joins the referenced set, so the blob is hashed and is not reported as
unreferenced. A subject absent from the layout is allowed by the spec
and adds no finding. A subject that is not a descriptor is reported as
malformed and keeps unreferenced blobs unknown.
* fix(oci): keep caller selections in cleanup-recovered Evidence
When the reader fails to close after a completed inspection, the provider
keeps the inventory as partial Evidence built from the resolved input, so
its parameters named defaults the caller never chose and its Evidence ID
differed from the success path. Build both from one OCI Evidence helper
and have the service rebuild a recovered inventory from the caller's own
selections.
* fix(oci): keep blob rows when the reference graph walk is incomplete
When a nested index or manifest could not be read or exceeded
max_index_depth, every blob outside the walked part was dropped from the
report, losing its path, size and kind. List those blobs with a null
referenced status instead, and report unreferenced_blob only when the
whole graph was examined.
* fix(oci): report unknown media types on present subjects
A subject blob present in the layout now joins the referenced set, which
removed its unreferenced_blob finding. Index entries, layers and configs
also report an unfamiliar media type, but subjects skipped that check, so
an unknown subject format went unreported. A present subject with an
unknown media type now records unknown_media_type.
* perf(oci): index emitted blob findings instead of rescanning them
The blob inventory loop checked each referenced digest against the whole
findings array before recording missing_blob, symlink_blob, or
unsupported_digest_algorithm, which is quadratic for layouts with many
missing blobs. Index finding kind and digest in a set built once before
the loop so each check is constant time. Output is unchanged.
* fix(oci): report invalid descriptor sizes as malformed
An index entry, config, layer or subject descriptor whose required size
was missing, a string, negative or fractional became a null size, which
dropped it from size validation without any finding, so the report could
claim complete coverage. The descriptor still keeps its other facts, but
the defect is now recorded as malformed_blob_json on the owning blob.
* fix(oci): keep damaged config, subject and descriptor facts in the report
Image config parsing kept any string in rootfs.diff_ids, so a readable
config with diff_ids [""] produced output the schema rejects and the
service discarded the whole inventory as an AnalysisOutputError. Config
parsing now owns that boundary: diff_ids members that are not nonempty
strings, and empty ExposedPorts or Volumes keys, are omitted and reported
once per config blob as malformed_blob_json, and the manifest and layer
observations stay in the report.
Related gaps in the same walk:
- A present subject was hashed but never walked, so blobs it names were
reported as unreferenced. A subject manifest now goes through
walkManifest and a subject index joins the breadth-first index queue one
level below its owner, within max_index_depth.
- A manifest with no config member reported complete coverage. A missing
config is now treated like a malformed one.
- A symlinked referenced blob was not hashed but left coverage complete.
symlink_blob now makes coverage partial.
- An unusable descriptor size was serialized into the finding message.
It is now described by type and length, with short strings quoted.
- A reader failure after oci-layout was hashed dropped that observation.
It is now attached when the reader did not attach its own.
- Annotation and label names allowed by OCI, including the empty key,
failed the output schema. The name is now any string. The advertised
compact output schema summary is unchanged.
* perf(oci): index declared sizes for shared blobs
Recording a distinct declared size scanned every earlier declaration for
the same blob, so many references to one blob with distinct sizes cost
quadratic work inside max_descriptors. ReferencedBlob now keeps a Set
beside declaredSizes for membership, and the array keeps declaration order
for verification.
* fix(oci): walk subject manifests from a queue
Finish each manifest before reading the one its local subject names, so a
long subject chain no longer keeps every parsed document alive at once.
* fix(oci): resolve unsupported-digest layer presence at its layout path
A layer stored at blobs/sha1/<hex> was reported present: false because
the layer lookup only resolved verifiable digests, while the blob
inventory reported the same file present. Use the grammar-based path
fallback for layer presence too.
* fix(oci): keep reference coverage uncertain for opaque index entries
An index entry with an unknown media type is not walked, so the blobs
it references are unknown. Mark the reference graph truncated so no
blob is reported unreferenced, and report coverage as partial whenever
the reference graph was not fully examined.
* fix(oci): walk digest aliases that differ only in hex casing once
Descriptors whose digests differ only in accepted hex casing resolve to
one blob, but the index queue, visited set and config cache were keyed
by the source spelling, so each alias reread and rewalked the whole
index. Key traversal by the resolved blob path while descriptors keep
their source spelling in the report.
* fix(oci): keep unparsed digest spellings out of accepted traversal keys
A descriptor spelled blobs/sha256/<hex> did not parse, so its traversal
key fell back to the raw text, which matched the blob path key of the
accepted sha256:<hex> digest. Listed first, it marked the manifest
visited and the valid descriptor was skipped. Prefix accepted and
unparsed keys separately.
* fix(oci): bound index entry text retained across indexes
Index entries keep their digests, media types, platforms and annotations
in the report, but no allowance covered that text across indexes, so many
nested indexes with large annotations could exhaust memory within every
other limit. Charge each retained entry to a new max_descriptor_bytes
budget (64 MiB default, 512 MiB maximum) before adding it.
* fix(oci): hash each blob file once across digest spellings
Digest spellings that differ only in accepted hex casing resolve to one
blob path, but the blob pass hashed the file once per spelling. Cache the
hash result, or its oversize refusal, by blob path so each file is read
once, while every spelling keeps its own row, size checks and digest
check.
* fix(oci): report non-object config and rootfs subobjects
A present config or rootfs value that is not a JSON object now records a
malformed_blob_json defect instead of being replaced by an empty object, so
coverage reports partial. Other image facts are kept. Regenerate the
inspect_oci_image_layout advertised-schema summary.
* fix(oci): check declared sizes for unsupported-digest blobs
A blob referenced by a valid but unsupported digest (for example sha1)
skipped the declared-size checks and left observed_size null, even
though the directory reader already captured the file size. Record
observed_size and emit size_mismatch for it, still without hashing.
* fix(oci): keep reader integrity failures that wrap a JSON parse failure
readJsonDocument unwrapped any ArtifactReaderFailure whose cause was a
ParseFailureError. When a malformed referenced blob changed during
inspection, DirectoryArtifactReader.inspectFile raised an "integrity"
failure carrying that ParseFailureError, and the unwrap turned it back
into a malformed_blob_json finding. Only unwrap the plain "io" transport
wrapper with no cleanup lease, so integrity, cancelled and limit
failures keep their reader facts.
* fix(oci): report malformed config leaf fields
A config with Env: "A=1" or Cmd: ["/bin/sh", false] used to come back
as env: [] or cmd: null with no finding, indistinguishable from an
image that declared neither. parseConfig now checks each present known
field (the top-level strings, User, Env, Entrypoint, Cmd, WorkingDir,
ExposedPorts, Volumes, Labels, StopSignal) and records
malformed_blob_json for a wrong type, keeping the other facts. Env
members that are not a named string and non-string label values are
omitted and counted. null stays an omitted declaration.
* fix(oci): allow json_bytes_read beyond 32 bits
coverage.json_bytes_read sums bytes across every JSON document read.
OciImageLayoutService bounds it by max_json_bytes * (2 + 2 *
max_descriptors), which at a 16 MiB per-document cap passes 0xffffffff
well within budget, so the uint schema made safeParse reject a completed
report as AnalysisOutputError. Give the counter a nonnegative safe-integer
schema; the other uint counters are unchanged.
* fix(oci): report malformed image history
A non-array history or a history member that is not an object was
silently dropped, so damaged build history looked the same as omitted
history. Report both as malformed_blob_json defects on the config blob
and keep the readable history records and other image facts.
* fix(oci): report damaged descriptor metadata and symlinked blob dirs
Descriptor platform and annotations that were present but malformed
(platform: [], a non-string platform field, annotations that are not an
object or hold non-string values) were normalized to null or [] with no
finding. Report each as a malformed_blob_json defect against the owning
document and keep the readable entries.
A symlink at blobs or blobs/<algorithm> is not followed, but nothing
recorded the skipped tree, so an empty index over a linked blob
directory reported an empty inventory with complete coverage. Record a
symlink_blob finding for the linked directory so coverage is partial.
* Address review feedback
* Address review feedback
* Address review feedback
* Bound repeated JSON member names in OCI findings
A long duplicate member name is now described by its length instead of
being copied into the finding message.
* fix(oci): keep the oci-layout hash when its JSON is malformed
The oci-layout file is now read and hashed first, and its observation is
recorded before decoding. An oci-layout with invalid UTF-8, invalid JSON
or a duplicate member is refused with its completed file identity.
* fix(oci): charge accepted descriptor text to max_descriptor_bytes
Accepted subject, config and layer descriptors keep their digest and
media type in image rows, the reference map, findings and blob rows, but
only index entries and rejected descriptors spent max_descriptor_bytes.
A layout with many manifests carrying long distinct layer digests could
retain unbounded text. Charge accepted descriptor text before retaining
it, once per referencing manifest or index.
* fix(oci): report presence defects for unsupported-digest blobs
A referenced blob with an unsupported digest algorithm whose layout path
is missing, a symlink, or not a regular file now gets the same
missing_blob or symlink_blob finding a supported digest gets, alongside
unsupported_digest_algorithm. Present files still only get the size
check and stay non-missing.
* perf(oci): drain index and manifest queues with a cursor
shift() relocates the remaining queue on every step, which makes draining
layouts with many index references quadratic. Walk both breadth-first
queues with an index cursor instead.
* fix(oci): keep blobs under a symlinked blob directory unexamined
When blobs or blobs/<algorithm> is a symlink, the reader lists the link
but never its children, so a referenced blob under it is absent from the
listing without being absent from the layout. One shared lookup now
tells listed, unexamined and confirmed-missing paths apart for the
reference walk, subjects, and both inventory branches. An unexamined
blob gets a symlink_blob finding naming the directory instead of
missing_blob, and an unexamined subject marks the reference graph
truncated.
* fix(oci): charge serialized config facts to max_config_bytes
The config allowance counted the config document's source bytes, but each
image carries the parsed facts, and a sparse history entry such as {}
expands into a record with four null fields. A small shared config with
thousands of empty history entries could pass the budget while the report
grew past the runtime's string limit. Each distinct config now charges the
exact compact JSON size of its facts, once per image that uses it.
* fix(oci): keep the oci-layout snapshot when its read fails to finalize
When the oci-layout read completes but closing its descriptor fails, or
cancellation arrives during the close, the reader rejects before the
parser records the layout hash. The reader keeps the completed bytes on
that failure, so the failure reached translation without the SHA-256 and
byte count it could have carried, unlike the same failure on index.json.
The parser now records the completed layout observation from that outcome
and rethrows the reader's failure unchanged, keeping its cleanup owner.
* fix(oci): keep reference status unknown under an unwalked present subject
A present subject with an unknown media type, or an index or manifest
subject whose digest algorithm is unsupported, is not read, so the blobs
it names were reported as unreferenced with complete coverage. Mark the
reference graph truncated in both cases so unmatched blobs keep an
unknown referenced status.
* fix(oci): keep a malformed index.json primary when its handle close fails
When index.json is malformed and closing its descriptor also fails, the
directory reader raises ArtifactFileCleanupFailure with reason io and keeps
the ParseFailureError as the physical outcome. The OCI dialect translated
the wrapper directly, so the malformed input surfaced as an I/O failure even
after the resource scope retried the close.
The dialect now supplies readCleanup: the shared classifier classifies the
failed outcome as primary, and the unresolved close is attached beside it
and bound to that read's exact cleanup lease. A cleanup-only read keeps its
previous projection.
* fix(oci): count a malformed blob's bytes in json_bytes_read
A referenced index, manifest or config that was read in full but failed
UTF-8, JSON or duplicate-member decoding became a malformed_blob_json
finding, yet its bytes never reached json_bytes_read, because the count
was added only after decoding succeeded.
The blob read now adds the byte count inside the completed read, before
decoding, so coverage reports every byte the parser examined.
* fix(oci): report a missing or non-directory-ancestor path as invalid input
A selected root that resolves to ENOENT or ENOTDIR is a bad path, not an
I/O failure. Classify it as an AnalysisInputError on `path` before the
generic reader translation; other root I/O keeps its execution failure.
* fix(oci): keep the layout hash when index.json close also fails
When malformed index.json also failed to close, readCleanup composed the
error from the classified parse failure, which carries no observation,
so the completed oci-layout hash was dropped. Carry the read's partial
observation onto the primary before composing.
The close-fault test now selects the index.json handle by file identity
(dev and inode) rather than the second close call, and asserts the
fault landed there and the oci-layout hash survived.
* fix(oci): report malformed subject digests and count examined entries
A subject whose digest is not a valid OCI digest has no layout path, so
the walk returned without a finding and kept claiming it could prove
which blobs nothing references. It now records a malformed_blob_json
finding on the owner and marks the reference graph truncated, the same
as any other subject descriptor it cannot model. An absent subject with
a well-formed digest stays finding-free.
coverage.entries_examined counted only the entries the reader yielded.
It now takes the reader's examinedEntries from onCoverage, which
includes names the reader examined but omitted, and falls back to the
yielded count when the reader does not report one. An omission that
rewrites the traversal coverage keeps that count.
* fix(oci): keep the root index out of the blob traversal namespace
The root index was walked and prequeued under the traversal key of its
SHA-256 digest, which is the key of the blob path blobs/sha256/<hex>.
When a damaged nested index named that digest and the blob file there
held different index JSON, the queue skipped the blob as already walked,
so its manifests, configs and layers were never read and were reported
as unreferenced under complete coverage.
index.json now walks under its own traversal identity. A descriptor that
names its digest reads and walks the blob stored at that path like any
other nested index.
* fix(oci): diagnose conflicting media types inside referenced JSON
A referenced manifest or nested index may repeat its media type in its
own optional mediaType member. The walk ignored that declaration, so a
document admitted as a manifest but declaring the index type, or an
unknown type, produced no finding.
Check a present declaration against the descriptor type the walk
admitted it under. An unknown declared type is reported as
unknown_media_type; a known but conflicting type or a non-string value
is reported as malformed_blob_json. The members are still read, so the
other readable facts are kept, and an omitted mediaType stays valid.
The root index.json is admitted under its own declaration and is not
checked against itself.
* fix(oci): charge unknown declared media types to max_descriptor_bytes
A referenced manifest or nested index whose own mediaType is an unknown
string is quoted in an unknown_media_type finding. That text was retained
without spending the descriptor text budget, so many hash-valid documents
with long declarations could grow findings well past max_descriptor_bytes.
Charge the escaped declaration before the finding is recorded.
* fix(oci): mark the reference graph incomplete on document-type conflicts
A referenced manifest or nested index whose own mediaType names another
document kind, or an unknown type, was diagnosed but its blobs were still
judged with a complete reference graph. The walker reads only the members
of the admitted kind, so members of the declared kind, such as an index's
manifests inside a document admitted as a manifest, were never followed
and the blobs they name were reported as unreferenced_blob.
Mark the reference graph truncated for an unknown declared type or one of
a different document kind, so unreached blobs keep an unknown referenced
status. The readable facts are still reported. A declaration of the same
kind, such as the Docker manifest type on an OCI manifest descriptor,
reads the same members and keeps unreferenced status definite.
* docs(oci): state that unsupported digest algorithms skip hashing
The guide said every present referenced blob gets a SHA-256. Blobs whose
digest uses an algorithm other than sha256 or sha512 are not hashed; their
row reports hashed: false with null sha256 and sha512. Document that and pin
the null hash fields in the sha1 layer test.
* fix(oci): check the root index.json mediaType against the index kind
The root index.json skipped declaration checking because no descriptor
names it, so its own mediaType chose the admitted type. A root that
declared the manifest type or an unknown type was still walked as an
index with a complete reference graph, and blobs named by members the
index walk never reads were reported as unreferenced_blob.
Admit the root as an index: an index declaration of either family
stands, and any other declaration is checked against the OCI index type
like a nested index, which diagnoses it and marks the graph incomplete.
Also document that unknown declared media types quoted in findings
spend max_descriptor_bytes.
* Address review feedback
* Address review feedback
* fix(oci): check each referencing media type against a revisited document
A manifest or nested index reached a second time was skipped before its
mediaType declaration was compared with the new descriptor type, so a
conflict was reported or not depending on descriptor order. Each document
now records its declaration on first decode, and every distinct media type
a later reference admits it under is checked against it.
* fix(oci): detach redacted Env names from their bindings
With include_env_values false, each retained Env name was a slice of the
whole NAME=value string, so a long value stayed alive while the config
fact budget charged only the name. Redacted names are now standalone
copies, and a heap regression test covers eight 0.9 MiB values.
* fix(oci): keep only string mediaType declarations for revisit checks
The revisit cache kept each decoded document's raw mediaType, so a layout
of many manifests with large object declarations held all of them for the
whole walk while no byte budget charged them. A non-string declaration is
rejected whatever it holds, so the cache now keeps null in its place and
still reports it as not a string on each new referencing media type.
* Address review feedback
* Address review feedback
* Address review feedback
* fix(oci): preserve layout evidence on malformed targets
* Address review feedback
* fix(oci): diagnose schema versions and charge annotation records
Indexes and manifests whose schemaVersion is omitted, not a number, or a
number other than 2 now get a malformed_blob_json finding and partial
coverage, while their entries, config and layers stay readable.
Index entry annotations now spend max_descriptor_bytes as each
{name, value} record is built, charged at its serialized size, so many
short or empty annotations can no longer retain far more than their text
was charged for.
* docs(oci): describe annotation record accounting for max_descriptor_bytes
* Address review feedback
* fix(oci): wire summary delivery, parameter budget limits, and single-pass annotation parsing
---------
Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Matt Van Horn <mvanhorn@MacBook-Pro-10.local>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
|
||
|
|
aad296795c |
fix(session): settle snapshot, shutdown, and cleanup-retry races (#14757)
* fix(session): settle snapshot, shutdown, and cleanup-retry races - Invalidate the analysis snapshot only when an external mutation retires a bound engine. Without a target there is no analysis to retire, and the lingering flag made the next open discard a snapshot staged meanwhile. - Let a deferred MCP server's close cancel in-flight runtime startup instead of waiting for it to finish before cleanup can run. - Keep a concurrently confirmed command cleanup owner confirmed when a peer retry's stale stop reports it incomplete. - Re-check provider registry closing after every wait so a selection is never admitted while a newer close is in progress. * fix(session): stop cleanup owners registered while a retry is in flight retryCleanup visits owners that appear during a stop await and returns success only when none remain pending. An incomplete stop still cannot replace an owner a concurrent retry has already confirmed. * fix(mcp): keep a failed deferred startup failed when close aborts cleanup The eager result classifies cancellation before its cleanup await. A close that aborts during that await no longer treats a nonzero startup result as a cancelled success. --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> |
||
|
|
7ffa72ee59 | test(cli): share command results across fresh and shared processes (#14718) | ||
|
|
20428dbc39 | test(mcp): share the listed-tool evidence caller (#14676) | ||
|
|
88fd8a9df0 |
test: drop detail requests the budget seed made redundant (#14615)
PR #14252 added explicit complete-detail requests across tests before the vitest REA_AGENT_RESULT_BUDGET_BYTES seed and the complete-Evidence harness existed. Restore the pre-#14252 form where the seed or the harness already delivers complete Evidence. Keep the requests that are load-bearing: delivery, summary and budget tests, tools whose omitted detail is summary, and callers that neither the seed nor the harness reaches (unwrapped SDK clients on servers with an explicit environment, and in-process CLIs). Those were found by running the touched files with the shipped budget lowered to its 4 KiB minimum. |
||
|
|
0bbdbeaedf | refactor(cli): share compiled runtime checks with the session worker (#14557) | ||
|
|
18aec2e763 | test(browser): reuse page and Evidence inspection fixtures (#14581) | ||
|
|
3bb225c564 | test(mcp): share the successful tool assertion (#14576) | ||
|
|
123b693f08 |
feat(delivery)!: bound default results by an agent result budget (#14252)
* feat(delivery)!: bound default results by an agent result budget Omitted detail now returns complete Evidence only when it fits the new delivery.agent_result_budget_bytes runtime setting (default 49152 compact JSON bytes, about 12k tokens at an estimated 4 bytes per token). Larger results are retained and delivered as the producer's summary with a limitation naming the budget and the recovery call; nothing is refused or truncated. inspect_analysis_view gains an evidence-json view that pages the exact JSON text of retained Evidence. The CLI applies the same budget and publishes the complete bundle with --evidence_output. inspect_managed_members type_names now also narrows member_refs and exported_types, and inspect-byte-entropy gains CLI evidence delivery. BREAKING CHANGE: An omitted detail no longer always returns complete Evidence inline on MCP or the CLI for tools with a detail selector (including inspect_managed_members, inspect_managed_artifact, inspect_byte_entropy, inspect_artifact, analyze_javascript_application, list_procedures, list_strings and the other operations listed in src/domain/agentBudgetOperations.ts). Over the budget they return the retained summary; pass detail complete (--detail complete) for complete inline delivery. inspect_managed_members type_names narrows member_refs and exported_types. Fixes #14172 Fixes #14180 Part of #14187 Part of #14156 * test(schemas): record advertised summaries for budgeted detail * fix(delivery): keep budgeted summaries canonical and carry delivery facts beside them Review fixes for the agent result budget: - Deliver the producer's own summary record, identical to detail summary, so its identity holds in summary consumers such as compare_artifacts. The budget, sizes, retention and the exact paging call travel as delivery facts: a second MCP text block and _meta, or a delivery field in CLI output. - Capture the caller's detail for application-validated tools too, so inspect_binary_layout and similar tools are budgeted. - Keep recovery facts when a budgeted summary itself exceeds the frame. - Size an omitted evidence-json limit by escaped UTF-8 bytes and never split a surrogate pair, even in a one-unit page. - Add the REA_AGENT_RESULT_BUDGET_BYTES launch seed; the shared test environment raises it for semantic tests, and budget tests clear it. - Align tool descriptions and verifiers that read complete Evidence. * fix(delivery): retain the budgeted summary like an explicit summary * fix(delivery): read the budget seed from the captured environment and count delivery facts in the frame - The agent result budget seed is read from the environment the server or CLI invocation captured: ToolResultDelivery takes it at construction, and a CLI invocation binds it in its publication context. The ambient process environment is no longer read. - The frame check reserves the bytes of the delivery block and _meta that are added after encoding, so a budgeted response cannot exceed the frame. - Conformance workflows that resend complete Evidence raise the budget through the shared inline-Evidence environment, as do the artifact and binary layout verifiers. * fix(delivery)!: request complete Evidence explicitly and never spill CLI overflow - Shared test and verifier environments no longer raise the agent result budget. Every test and verifier workflow that reads complete Evidence from a budgeted tool now requests it with detail complete or --detail complete, including the real-provider verifiers outside PR CI (Ghidra, Hopper, IDA, Kuna and client verifiers). Default delivery is exercised as shipped. - Budgeting applies only to tools with a detail selector, so every budgeted call has a complete opt-out. - CLI overflow without --evidence_output writes nothing; its delivery facts carry exact rerun argv for --detail complete and --evidence_output, omitted when the command declares sensitive values. * test(delivery): prove captured budget seeds with valid in-range values * test: state complete-detail requests once and fix codemod regressions - Add tests/support/completeDetail.ts with COMPLETE_DETAIL and completeArguments so tests that read complete Evidence request it in one place, keeping functions within max-lines-per-function without raising the limit. - Restore provider-client tests (GhidraClient, Hopper health): their callTool("name", ...) calls are bridge requests, not MCP tools, and take no detail. - Update the game-scale type inventory test for member_refs narrowing. * test: request complete Evidence in shared JavaScript analysis helpers and remaining CLI workflows * test: request complete Evidence by default in the shared test transports The shared MCP client helpers (createTestMcp, connectLocalToolsMcp and the CLI fixture's shared MCP session) and the CLI runners (the cli fixture and the shared CLI session) now apply one named default, completeEvidenceByDefault. A budgeted tool called with neither detail nor view gets detail complete; the CLI does the same with --detail complete, chosen by the command's tool contract. A budgeted operation that resolves to no contract fails loudly at load. Tests whose subject is delivery opt out with delivery "budgeted". This is a test-harness choice; production delivery is unchanged and the budget tests prove the default path. Per-call complete-detail edits are reverted in the 204 test files whose transports all apply the default. Explicit requests remain where a test drives its own SDK client, server, CLI instance or process, and where the detail choice is the test's subject. * test: resolve CLI complete-detail defaults from the CLI registry The Real Apple and browser verifiers read complete Evidence through artifactCliEvidence, which ran the compiled CLI without a detail choice and got the budgeted {summary, delivery} output. The helper now requests complete Evidence for commands that take --detail, read from the compiled CLI's own registry (scripts/lib/complete-evidence-cli.mjs). The test harness default had a sibling bug: it treated every cli-flagged budgeted contract as taking --detail, but only Evidence-delivery commands do (inspect-binary-layout does not). It now reads the source CLI registry too, and covers every command the CLI budgets. * test(verifiers): request complete Evidence at each verifier's SDK client and CLI argv The real-browser failure was the same missing normalized_result as the Apple one: browser-capture-metadata-budget-e2e reads analyze-web-bundle through artifactCliEvidence, fixed in the previous commit. The shared verifier module, scripts/lib/complete-evidence.mjs, now owns both transports: - completeEvidenceClient wraps each verifier's SDK Client once, so every callTool to a budgeted tool with neither detail nor view requests complete Evidence, whatever local call helper a verifier uses (86 clients, including the Ghidra, Hopper, IDA and Kuna verifiers' argument-less list_procedures and inspect_native_load_image calls). - completeEvidenceCliArguments covers the remaining verifier CLI argv that chose no detail, such as function, decompile, analyze and the Android and Apple commands. Commands and tools that are not budgeted are sent as written. * test(delivery): await async completeEvidenceCliArguments helper in boundary test * test(delivery): request complete detail in Electron CLI artifact format test * docs(delivery): document delivery.rerun as add-only argument arrays * test(schemas): record advertised summaries for the unified delivery budget Tool descriptions now name the agent result budget, and the evidence-json default page is derived from the 32 KiB default, which changes the advertised input digests of the 28 affected tools. Recorded from the Build package job's output. * test(delivery): pin the budget boundary and keep failures unbudgeted Main's retainedSummaryDelivery tests pinned the size decision at exactly 32,768 and 32,769 UTF-8 JSON bytes. Unifying that decision into budgetedSummaryBytes deleted them, and their port never landed, so the byte measurement went unchecked. Restore them against budgetedSummaryBytes at the configured budget and one byte over, for the default and a runtime budget, with ASCII, escaped and multibyte text, plus each condition of the decision. Off-by-one mutants (< for <=, a cap one byte short) fail six cases; measuring UTF-16 code units instead of UTF-8 bytes fails the multibyte cases. An MCP case pins that a target failure from a budgeted tool under the minimum budget is identical with detail omitted and complete, with no delivery facts. * test(verifiers): route literal CLI argv for budgeted commands through complete Evidence real-browser failed with "Scenario CLI did not report external disconnect ownership": runScenarioCli ran capture-browser-scenario without --detail, so an over-budget capture came back as its summary, which has no browser.cleanup. The earlier sweep counted these files as covered because their MCP clients were wrapped, but their CLI argv was not. Route the shared runScenarioCli helper (five callers), the local cli helpers in the module, source-map and script-export verifiers, and every other literal argv for a budgeted CLI command without --detail or --view (EVM interface, binary layout, packet capture, devicetree, DOM destinations, Ghidra relocation symbols, WABT cleanup, Termux browser) through completeEvidenceCliArguments. A sweep of scripts/ for budgeted command literals with --json and no detail selection now finds none. * fix(verifiers): leave clients without callTool unwrapped The native verifier cleanup test drives native-value-e2e with a connection double whose Client has only connect and close. completeEvidenceClient bound client.callTool unconditionally, so wrapping threw a TypeError before connect ran. That TypeError replaced the primary connection failure the test asserts is preserved, and all four fault cases failed in Test shard 5 and Portable tests. A client without callTool has no tool call to complete, so the helper now returns it unchanged. Locally all five fault modes of the fixture now exit 0. * fix(delivery): keep the catalog recorder on shipped helpers and expect view-implied summary The verifier sweep wrapped record-mcp-catalog.mjs in completeEvidenceClient, which lives in an unshipped helper. deferredRuntime copies only the package's shipped files plus the recorder, so the recorder failed to load (ERR_MODULE_NOT_FOUND) and its cleanup recorder never wrote. The recorder only lists tools and prompts, so the wrapper had no effect; it is removed. This branch makes a view with no --detail select summary delivery, as MCP does for a view. Three CLI cases still expected the old view refusal; with a view alone the missing input is now the summary bundle, so they expect evidence_output, and a view with --detail complete still refuses the view. * fix(delivery): request complete Evidence where callers need the whole result Budgeted delivery made four callers receive a summary they cannot use: - The GitHub Actions example uploads the analysis as a CI artifact, so it now asks for --detail complete; over budget it had saved a summary. - javascriptIntegrityPolicyCli spawns the CLI itself, outside the test harness default, and reads normalized_result; it now applies the same completeEvidenceCliArguments default. - nativeObservationViewsMcp builds its own client to prove complete observations overflow into a paging continuation; it now applies the harness default so each call asks for complete Evidence. - The CLI parity goldens are re-recorded for the --detail and --evidence_output options the budgeted commands now advertise. * fix(tests): give processes tests spawn the largest agent result budget About 90 tests spawn scripts/rea.mjs or a server directly, outside the harness default that asks for complete Evidence, and read analysis facts from the result. Over the default budget they received a summary instead; javascriptChildHandleOwnership failed this way. The Vitest environment now seeds REA_AGENT_RESULT_BUDGET_BYTES with the largest accepted value, so a spawned CLI or server delivers complete Evidence, as the in-process default does. Delivery tests keep their own budget: agentResultBudgetMcp builds its server without the seed, so its default-budget cases still exercise the shipped default. * fix(tests): give budgeted harness tests the shipped agent result budget The test environment seeds the largest agent result budget so spawned processes deliver complete Evidence. In-memory servers built by createApplicationMcpHarness (and connectGhidraMcp, which uses it) inherit process.env too, so a test that chose testDelivery "budgeted" kept the seed: the 600-row list_procedures case and the omitted-detail web page views returned complete Evidence instead of a summary. testDeliveryEnvironment now owns that choice: a budgeted test's server environment drops the seed and uses the shipped default. The application harness applies it to every server it builds. * fix(tests): expect view-implied summary delivery in the Playwright trace refusal A view with no --detail now selects summary delivery, so its refusal names the missing evidence_output bundle; --detail complete still refuses the view. The trace test still expected a view refusal in both cases. |
||
|
|
edca3783ca | test(fixtures): share byte digest calculations (#14564) | ||
|
|
41bdf03a98 | test(browser): share validated inspection comparisons (#14567) | ||
|
|
15e5b421bf | test(sessions): share fixture provider identity construction (#14545) | ||
|
|
1db5c70752 | test(lint): share Vitest rule tester setup (#14552) | ||
|
|
8835c18c47 | test(javascript): reuse semantic graph node and registry fixtures (#14550) | ||
|
|
e043558082 | test(cli): share rendered HTML text extraction (#14534) | ||
|
|
d11eba6295 | test(mcp): share address context capacity setup (#14542) | ||
|
+15 |
5b79ae5d62 |
fix(macho)!: report Mach-O read failures as target failures and delete MachoReadIssue (#14416)
* feat(errors)!: add the TargetFailure model, its projection table and conformance registry
Introduce one domain-owned TargetFailure value whose kind alone derives
the public code, category, retryability, recovery and details, for CLI
and MCP alike. Selected-file malformed and truncated refusals are the
first area on it: AnalysisMalformedTargetError is replaced by
AnalysisTargetFailureError, and ParseFailure's byte-structure variants
are TargetFailure variants rather than a parallel type.
The shared stableArtifactParserFailureCli loop is replaced by a
declarative registry (tests/support/targetFailure/readers/*.ts) and one
generated suite that runs every registered case through the CLI and MCP.
BREAKING CHANGE: selected-file malformed and truncated refusals add
details.failure_kind, and a truncated target's remediation now says to
re-acquire the complete file instead of choosing another target. Codes
are unchanged. Affected operations: every operation that refuses a
selected file's malformed or truncated bytes, including the ELF, PE,
Mach-O, DWARF, Go, Rust, BEAM, pyc, devicetree, Apple IPS, kernel
module, binary hardening, managed PE/CLI and IL2CPP readers.
* test(managed): name the target failure error in the merged status test
* docs(reference): name the error CSV instead of linking a non-page file
* fix(tests): expect the path reason for non-regular dyld inputs
#14225 refuses a non-regular dyld input as ArtifactReaderFailure("path");
dylibFileLifetime still expected "format" and fails on main's shard 9.
* fix(tests): expect io, invariant and path where #14225 reclassified
stableArtifact expected "format" for an impossible descriptor byte count
(now io) and an invalid chunk size (now InternalInvariantError);
directoryArtifactReaderOpen expected "format" for a non-file entry (now
path, the same change as #14238). All three fail on main.
* fix(errors)!: raise container reader byte faults as malformed or truncated targets
Delete the ambiguous `format` reason from ArtifactReaderFailure and
ArtifactOperationError. Each container reader now raises its owner's
fact once, through malformedArtifact / truncatedArtifact, with format,
offset, field and measured extents. Short reads inside a measured extent
are read-coverage integrity failures, path-kind refusals are `path`,
foreign or recovery-requiring inputs are `unsupported`, host tool output
is `io`, and REA defects are InternalInvariantError.
The trace, NTFS journal, release exposure, web capture, native macOS and
web artifact adapters project the reader's parsed facts as
AnalysisTargetFailureError instead of invalid_request. Inventory
malformed, truncated, unsupported and cancelled reasons take their code
from the TargetFailure projection table, so a truncated container is
unsupported_target with failure_kind "truncated" on both paths.
BREAKING CHANGE: inventory_artifact, inspect_artifact, extract_artifact,
analyze_javascript_application, inspect_desktop_application,
inspect_keyed_archive, inspect_asset_catalog, inspect_nuget_nupkg,
trace_dylib_resolution, trace_web_module_imports and
trace_web_source_location report damaged container bytes as
unsupported_target (details.reason "malformed" or "truncated", with
failure_kind and format) instead of artifact_operation_failed with
reason "format", and a truncated container as unsupported_target instead
of truncated. inspect_playwright_trace, inspect_ntfs_journal,
audit_release_exposure, the web capture inspection operations and the
caller-selected import and source maps report damaged selected bytes as
unsupported_target instead of invalid_request. The `format` reason no
longer appears in details.reason.
* test(artifacts): expect target failure codes in compiled CLI and MCP suites
* fix(errors)!: refuse malformed SQLite, pwntools and EVM inputs as target failures
The SQLite engine's `format` reason is renamed to `malformed` at its
owner (SQLITE_INSPECTION_REASONS), and its refusal becomes an
AnalysisTargetFailureError at the selected path with format "sqlite".
The pwntools and EVM worker replies keep their wire reason "format",
which their workers define, and the adapters translate it once into a
malformed target failure with the profile's format (elf, elf-core,
evm-bytecode) instead of an invalid_format argument issue. SQLite joins
the target-failure conformance registry.
BREAKING CHANGE: inspect_sqlite_database, inspect_binary_layout,
inspect_recorded_crash and inspect_evm_interface report a selected
file's malformed bytes as unsupported_target with details.failure_kind
"malformed", format_failure, format and path, instead of invalid_request
with an invalid_format issue on path.
* fix(errors): give the integrity kind a schema-valid code and list the reference page
artifact_integrity_mismatch's projection schema requires declared and
calculated digests, which a TargetFailure of kind integrity does not
carry, so the kind now projects artifact_operation_failed with category
integrity_mismatch. The model test validates every kind's projection
against analysisErrorProjectionSchema. The reference page joins the
documentation sidebar.
* fix(artifacts): report a short carrier read as a changed file and keep unsupported desktop probes local
A Bun or Node SEA short read inside a range already checked against the
measured size meant the file changed, not that it was truncated. The
carrier range reader and Bun's readExact now raise read-coverage
integrity for it, and keep 'outside the file' as the truncated case.
DesktopFileInspection records an unsupported managed-metadata probe as a
row issue again, so later file checks still run.
* test(errors): expect target failure facts in the pwntools and EVM reply suites
The literal-replacement scenario now reads the failure's detail instead
of an issues[] message, and a malformed reply wrapped by cleanup failure
reports category unsupported_target.
* test(errors): register PE DOS-signature and truncated IPS refusals and drop their per-command copies
The non-MZ PE imports and load-config cases (PE32/PE32+, ZZ and high-bit
signatures) and the truncated Apple IPS body move into the conformance
registry, which runs them through the CLI and MCP and now also checks
that a refusal leaves the selected file unchanged. The per-command tests
keep only their valid-image controls.
* test(sqlite): drop the malformed-database provider test the conformance registry covers
inspect_sqlite_database/not-a-database in the target-failure registry runs
the same non-SQLite bytes through the CLI and MCP, asserts the malformed
target facts and checks the selected file is unchanged.
* feat(errors)!: make failure_kind the identifier and derive code and retry from it
Apply the owner review on #14239 to the TargetFailure model:
- remove details.format_failure; failure_kind is the only identifier;
- give integrity, conflict and io their own codes
(target_integrity_mismatch, input_conflict, host_io_failed) and derive
inventory malformed, truncated and unsupported codes from the same table;
- add a retry hint (none, backoff, after_change) derived from the kind,
with io refined by its transient errno fact; retryable stays the
unchanged-retry flag and is true exactly for backoff;
- rename the limit-cut result code and category truncated to partial;
- drop cancelled and resource from the target kinds and spell
identifiers in American English (unrecognized);
- return a target failure a tool handler throws as a projected isError
result instead of letting the SDK flatten it to text.
BREAKING CHANGE: details.format_failure is removed (read
details.failure_kind). The truncated result code and category are now
partial. Target integrity failures report target_integrity_mismatch,
host read failures host_io_failed and disagreeing inputs input_conflict.
Inventory operations (inventory_artifact, inspect_artifact,
extract_artifact and the other inventory callers) report truncated
container bytes as unsupported_target. Every target failure carries a
top-level retry hint.
* test(sqlite): expect a malformed target for non-database bytes in the CLI suite
* fix(artifacts): keep changed-file short reads, invalid offsets and EOF declarations apart
PyInstaller reads inside the measured size, and .NET bundle manifest
refills, now raise read-coverage integrity on a zero-byte read instead of
truncated. A .NET bundle field and a Godot PCK directory entry that extend
past the file are truncated (with offset and extents) instead of
malformed. An absent or invalid ASAR packed offset is malformed; only a
valid range past the archive is truncated. The .NET manifest string
offset is reported in file coordinates.
* fix(pwntools): report a short ELF header as a truncated target
The layout and recorded-crash workers raise a distinct truncated reason
when the file ends inside the ELF identification or header, and the
decoder projects it as failure_kind truncated instead of inferring it
from the message.
* fix(errors)!: report managed coverage gaps and IL2CPP pair conflicts as target failures
Managed readers interpret an issue code once, in managedIssueTargetFailure:
a coverage gap is an unsupported target, every other rule violation is a
malformed target, and the inventory metadata status is derived from that
same fact. managedInspectionTargetFailure now returns only
AnalysisTargetFailureError.
An IL2CPP binary that parses but does not link to its metadata is a
conflict target failure that lists both inputs and blames neither, in
place of an invalid_request with two issue entries. Metadata version 108
is an unsupported target. The CLI spells each conflict input's field by
the command's option name.
BREAKING CHANGE: inspect_managed_artifact, inspect_managed_members,
inspect_managed_native_boundaries and the managed comparison operations
report unsupported metadata or signature forms as an
AnalysisTargetFailureError (failure_kind unsupported, format pe-cli,
field, offset) instead of a bare unsupported target. inspect_il2cpp_metadata
reports a binary/metadata pair that does not link as code input_conflict
with failure_kind conflict and details.inputs, instead of invalid_request
with details.issues, and metadata version 108 with failure_kind
unsupported.
* fix(artifacts): verify the carrier before blaming a short read on the bytes
The NTFS $MFT decoder, positional members (FIT, uImage, Bun, Deno) and
.NET bundle members now re-verify the source before reporting a short
stream as malformed, so a file that changed during the read reports the
change. The truncation site builds the model's measured extent.
* fix(errors)!: report inventory refusals as target failures of the selected path
An inventory, inspection or extraction refused damaged or unsupported
container bytes as an ArtifactOperationError whose reason repeated the
format owner's kind. It carried no path or retry hint, so the conformance
registry could not express container cases.
translateArtifactFailure now takes the selected path and returns the
reader's TargetFailure as an AnalysisTargetFailureError. The malformed,
truncated and unsupported reasons, their classification rows and their
presentation branch are deleted from ArtifactOperationError. Readers'
unsupported refusals carry their format facts through unsupportedArtifact.
Container cases move into the conformance registry, which now opens the
target first for session tools such as inspect_artifact.
BREAKING CHANGE: inventory_artifact, inspect_artifact, extract_artifact and
the bundle readers report a refused container as a target failure of
details.path with a top-level retry. details.reason is the owner's
description and details.detail is removed.
* docs(il2cpp): describe pair conflicts as input_conflict with both inputs
* docs(android): name unsupported_target for truncated boot image structures
* fix(errors)!: report a target that changed during the read as failure_kind changed
Inventory integrity failures whose check means the target moved under the
read (container, member and unpacked-entry identity, read coverage,
traversal coverage) now take the model's changed projection: code
artifact_changed, retry backoff and details.failure_kind changed. A
selected target that no longer matches the one the session admitted gets
its own admitted-identity check and keeps its reopen recovery.
BREAKING CHANGE: inventory_artifact, inspect_artifact, extract_artifact and
the other inventory operations report a target that changed during the
read as artifact_changed (retryable, failure_kind changed) instead of
artifact_operation_failed. Admission-identity refusals report
integrity_check admitted-identity instead of container-identity.
* test(artifacts): raise the cleanup fixture's decode refusal with its format facts
* fix(errors)!: report unsupported and unrecognized targets on the TargetFailure model
AnalysisUnsupportedTargetError carried a free-text reason and remediation
beside the TargetFailure model, so unsupported refusals had no format,
failure_kind or retry hint, and their recovery was prose written at each
producer.
The class is deleted. Producers raise unsupportedTarget or
unrecognizedTarget with the owner's format, and consumers read
targetFailureOfKind. The projection table renders the recovery and names
the operations the owner lists in related.operations. The foreign-bytes
identity loop moves into the conformance registry.
BREAKING CHANGE: unsupported and unrecognized targets report
failure_kind, format and retry. Their remediation comes from the
target-failure table; producer-written remediation sentences are folded
into details.reason or replaced by details.related_operations.
* test(artifacts): expect admitted-identity for selections replaced before admission
A selected source replaced before admission fails the admitted-identity check rather than container-identity since the changed/admitted split.
* test(go): name the fixture and result when an MZ carrier is not refused through MCP
* style: format the migrated target-failure tests
* test(errors): expect the PE readers' native-binary format label for foreign bytes
* fix(cli)!: spell a target failure's recovery with CLI commands and options
The target-failure recovery named MCP tools even when the CLI printed it,
and it could not name another provider. The projection table now renders
the owner's alternative operations and providers through an adapter
spelling: MCP by tool name and open_binary argument, the CLI by command
and --provider. The CLI output layer re-renders only the table's own text,
so appended guidance is kept.
BREAKING CHANGE: CLI target-failure remediation names commands (for
example `rea inspect-plist`) instead of MCP tool names, and errors gain
details.related_providers when the owner names a provider.
* test(verify): expect target failures for damaged ELF, core and EVM inputs in real-provider verifiers
The binary-layout, recorded-crash and EVM verifiers still expected invalid_input for malformed or truncated selected bytes. The pwntools and EVM adapters now report those as unsupported_target with failure_kind; a missing path remains invalid_input.
* test(web): expect the partial code for a refused source-map admission
The limit-cut code is partial; this Windows-lane test arrived from main with the old truncated spelling.
* fix(workers)!: name malformed worker replies by the model's kind (#14292)
* fix(workers)!: name malformed worker replies by the model's kind
The pwntools, EVM, UEFI LZMA, source-map and historical-capture workers
replied with reason "format" for bytes that break their format, a second
vocabulary for the TargetFailure kind. The workers and their reply schemas
now use "malformed" at the source, including the pwntools Python bridge
and its tests. pwndbg never sent "format", so its schema drops it.
The pwntools decoder maps the worker's malformed and truncated replies to
the target failure of the same kind in one branch.
BREAKING CHANGE: worker reply reason "format" is renamed "malformed" in
the pwntools, EVM, UEFI LZMA, source-map and capture decoder protocols.
* test(go): expect loader-equivalent PE header facts in the MZ diagnostics (#14293)
#14253 made the static PE readers read the optional header at its fixed
offsets and admit a declared directory count below 16, as the Windows
loader does. The Go MZ diagnostic fixtures still expected the older
refusals, so inspect_go_binary MCP and CLI diagnostics failed on main.
A short SizeOfOptionalHeader with an unknown magic at the fixed offset
is now an unsupported optional header, and a PE declaring one data
directory is admitted and keeps its build information, which the MCP
test now asserts.
* fix(tests): damage Deno PE resource framing the loader-equivalent reader reads
#14253 walks resource trees at their RVA whatever the directory Size
declares, so shrinking Size no longer made the 65,535-language table
malformed and the case reported the entry allowance instead. Point the
type directory's entry at a language directory outside the file-backed
resource bytes: its header cannot be read, which the reader reports as
malformed before counting rows against the allowance.
* test(go): check build information in a one-directory PE32 fixture (#14303)
* test(pe): distinguish unsupported DOS input from truncated input (#14302)
* ci: measure portable runner time for recorded selection predictions (#14304)
* ci: validate workflow anchors with actionlint 1.7.12 (#14298)
* ci: wait for static checks before broad PR test shards (#14299)
* ci: validate workflow anchors with actionlint 1.7.12
* ci: wait for static checks before broad PR test shards
* ci: record affected-test predictions above the live cutoff (#14300)
* ci: compare frozen selections with observed test failures (#14301)
* chore(deps): bump markdownify from 1.2.3 to 1.2.4 in /website (#14227)
Bumps [markdownify](https://github.com/matthewwithanm/python-markdownify) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/matthewwithanm/python-markdownify/releases)
- [Commits](https://github.com/matthewwithanm/python-markdownify/compare/1.2.3...1.2.4)
---
updated-dependencies:
- dependency-name: markdownify
dependency-version: 1.2.4
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* chore(deps): bump rcssmin from 1.2.2 to 1.3.0 in /website (#14229)
Bumps [rcssmin](https://github.com/ndparker/rcssmin) from 1.2.2 to 1.3.0.
- [Changelog](https://github.com/ndparker/rcssmin/blob/master/CHANGES)
- [Commits](https://github.com/ndparker/rcssmin/compare/1.2.2...1.3.0)
---
updated-dependencies:
- dependency-name: rcssmin
dependency-version: 1.3.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* fix(ci): retry recorded crash dependency acquisition without stale index cache (#14076)
Co-authored-by: ShuaixinHuang <ShuaixinHuang@users.noreply.github.com>
* ci: publish the portable build cache only for selected consumers (#14307)
* ci: run the verified actionlint release binary (#14309)
* chore(deps): bump pyyaml from 6.0.3 to 6.0.4 in /website (#14228)
Bumps [pyyaml](https://github.com/yaml/pyyaml) from 6.0.3 to 6.0.4.
- [Release notes](https://github.com/yaml/pyyaml/releases)
- [Changelog](https://github.com/yaml/pyyaml/blob/6.0.4/CHANGES)
- [Commits](https://github.com/yaml/pyyaml/compare/6.0.3...6.0.4)
---
updated-dependencies:
- dependency-name: pyyaml
dependency-version: 6.0.4
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* refactor(views): reuse invalid-view results and row selectors (#14314)
* refactor(domain): share record and graph parsing across input paths (#14321)
* ci: shallow-checkout the classifier for qualification runs (#14312)
* refactor(tests): consolidate repeated CLI capture and fixture construction (#14311)
* refactor(tests): consolidate repeated CLI capture and fixture construction
* test(cli): keep overlapping schema and help cases in their existing PR
* refactor(application): consolidate configuration and observation helpers (#14322)
* refactor(application): consolidate configuration and observation helpers
* refactor(config): leave optional launch parsers to their existing change
* refactor(tooling): share verifier fixture and lint helpers (#14318)
* refactor(tooling): share verifier fixture and lint helpers
* test(clients): retain tool messages in verifier model substitutes
* build(deps): bump write-file-atomic from 7.0.0 to 8.0.0 (#8134)
* perf(nuget): stream .nupkg ZIP over FileHandle instead of buffering full archive (#13835)
* perf(nuget): stream .nupkg ZIP over FileHandle instead of buffering full archive
Closes #13834
* fix(nuget): check artifact stability after format rejection
* refactor(kuna): extract KunaSingleFunctionCache from KunaSessionClient (#13863)
Closes #13862
* perf(har): reuse normalized Base64 for retained response bodies (#13847)
Co-authored-by: hhang <169027046+xu91102@users.noreply.github.com>
* refactor(application): migrate 7 standalone format services onto executeArtifactInspection (#13861)
Closes #13860
* refactor: prune 5 redundant single-call wrapper modules (#13807)
* refactor: prune 5 redundant single-call wrapper modules
* chore(ci): remove deleted providerEnvironment.ts from Stryker and CI scope configs
* fix(ci): retarget provider environment mutation coverage
* refactor(application): migrate 3 remaining artifact services onto executeArtifactInspection (#13867)
* refactor(rizin): extract RizinDebugEvidence from RizinDebugSessionManager (#13823)
* refactor(rizin): extract RizinDebugEvidence from RizinDebugSessionManager
* refactor(rizin): remove unused evidence imports
* fix(ci): follow extracted Rizin evidence in mutation checks
* docs: codify pagination, schema-flatness, DDIA, and flat-ownership guidance in tool-design docs and skills (#13865)
* docs: codify pagination, schema-flatness, DDIA, and flat-ownership guidance in tool-design docs and skills
Closes #13864
* docs: name the current provider operation runner
* feat(frida): add optional limit and offset paging to list_frida_processes (#13854)
* feat(frida): add optional limit and offset paging to list_frida_processes
Closes #13853
* fix(frida): stabilize paged process discovery
* docs(frida): scope paging claims to shipped discovery
* refactor(application): unify 5 pass-through analysis services into ProviderOperationService (#13856)
Closes #13855
* refactor(cli): extract contractCommandRunners from contractCommand (#13869)
* feat(tools): add optional limit and offset paging to find_xrefs_to_name (#13858)
* feat(tools): add optional limit and offset paging to find_xrefs_to_name
Closes #13857
* fix(tools): preserve xref discovery coverage in paged results
* feat(adb): add optional limit and offset paging to list_adb_features and list_adb_services (#13873)
* feat(adb): add optional limit and offset paging to list_adb_features and list_adb_services
* test(adb): verify feature and service paging guidance
* refactor(cli): extract contractCliSchemaProjection and contractCliDocumentDescription (#13871)
* fix(dwarf): reject PE long section names when PointerToSymbolTable is zero (#13889)
* perf(macho): streamline legacy rebase run marking (#13881)
* perf(erlang): stream BEAM IFF inspection over FileHandle (#13886)
* perf(erlang): stream BEAM IFF inspection over FileHandle
* fix(erlang): retain only decoded BEAM code headers
* refactor(kuna): extract KunaSessionEvidence from KunaSessionClient (#13879)
* refactor(kuna): extract KunaSessionEvidence from KunaSessionClient
* refactor(kuna): remove stale session evidence imports
* fix(objc): preserve class import reader failures (#13892)
* refactor(server): extract desktop build tool bindings (#13891)
* refactor(server): collapse inspect bindings and extract desktopBuildToolBindings
* fix(mcp): restore contract-checked inspect bindings
* fix(macho): preserve legacy bind stream bounds and target scope (#13874)
* fix(macho): preserve legacy bind stream bounds and target scope
* fix(macho): report unresolved legacy bind targets in coverage
* test(macho): consolidate legacy bind target coverage
* perf(pe): stream PE certificates over FileHandle (#13884)
* perf(pe): stream PE certificates over FileHandle
* fix(pe): share certificate table admission across readers
* perf(apple-ips): stream Mach-O join headers over FileHandle (#13894)
* perf(apple-ips): stream Mach-O join headers over FileHandle
* fix(apple-ips): retain only verified Mach-O joins
* perf(objc): streamline exact class identity projection (#13897)
* perf(pe): stream PE resource inspection over FileHandle (#13899)
* perf(pe): stream PE resource inspection over FileHandle
* fix(pe): bound streamed icon-group reads and restore lifetime coverage
* perf(swift): streamline symbol inventory classification (#13902)
* perf(apk-signature): stream APK signature inspection over FileHandle (#13877)
* perf(apk-signature): stream APK signature inspection over FileHandle
* fix(apk-signature): preserve bounded reads and file identity
* fix(apk-signature): handle deflate EOF and repair verifier bounds
* fix(apk-signature): recognize internal pipeline cancellation at EOF
* perf(release-exposure): stream PE CodeView/PDB inspection over FileHandle (#13896)
* perf(release-exposure): stream PE CodeView/PDB inspection over FileHandle
* fix(release-exposure): share and bound PE CodeView parsing
* refactor(server): simplify contractToolBindings types and handler dispatch (#13912)
* perf(macho): streamline slice selection diagnostics (#13905)
* fix(macho): preserve retained magic from valid FAT ranges (#13910)
* perf(pe): stream PE load-config inspection over FileHandle (#13901)
* perf(pe): stream PE load-config inspection over FileHandle
* fix(pe): admit empty section tables and batch TLS callback reads
* perf(elf): stream ELF note inspection over FileHandle (#13904)
* perf(elf): stream ELF note inspection over FileHandle
* fix(elf): validate full header extents and reuse aliased note reads
* fix(macho): keep header reads inside declared slices (#13913)
* perf(v8): stream V8 code cache inspection over FileHandle (#13907)
* fix(macho): correct encryption range VM mapping (#13918)
* perf(elf): stream kernel module inspection over FileHandle (#13917)
* perf(elf): stream kernel module inspection over FileHandle
* test(elf): exercise streamed kernel module reads and finalization
* refactor(providers): share offlineArtifactFailureDialect across offline providers (#13921)
* test(macho): consolidate fixed header and extent proofs (#13919)
* perf(macho): bound positional command string probes (#13925)
* refactor(server): replace server.close and onclose monkey-patching with lifecycle hooks (#13882)
* refactor(server): replace server.close and onclose monkey-patching with lifecycle hooks
* fix(mcp): keep deferred runtime cleanup out of protocol close
* test(mcp): verify materialized runtime hooks close once
* fix(cli): defer artifact AnalysisView loading until requested
* test(macho): consolidate native path framing proofs (#13926)
* perf(elf): stream ELF dependency inspection over FileHandle (#13915)
* perf(elf): stream ELF dependency inspection over FileHandle
* fix(elf): share dependency hash parsing and bound string reads
* perf(elf): reuse cached prefixes for short dependency names
* refactor(server): extract debugger and instrumentation tool bindings (#13909)
* refactor(server): extract debugger and instrumentation tool bindings
* test(server): track extracted debugger bindings in reverse tools coverage
* fix(cli): defer artifact AnalysisView loading until requested
(cherry picked from commit
|
||
|
|
5424e90b02 |
test(providers): share Java probe preparation cleanup (#14530)
* test(process): share Java probe preparation cleanup assertions * fix(ci): shard exact test specifications before execution |
||
|
|
4bcd0af58c |
test(diagnostics): share invalid inspection input assertions (#14501)
* test(diagnostics): share invalid inspection input assertions * test(diagnostics): keep the PE import fixture independently mergeable |
||
|
|
d0c51d1fa0 |
test(mcp): share isolated file inspection sessions (#14426)
* test(mcp): share isolated file inspection sessions * test(coverage): recognize file inspection test registrations * test(mcp): reuse file inspection clients in five suites (#14438) |
||
|
|
63d1ecac00 | test(registration): share the isolated child process environment (#14525) | ||
|
|
da1ba036c9 | test(providers): share process group and workspace cleanup assertions (#14487) | ||
|
|
efeac85e0f | test(mcp): share caller-owned in-memory handshakes (#14424) | ||
|
|
38bf511a50 |
fix(errors)!: report unsupported and unrecognized targets on the TargetFailure model (#14281)
* feat(errors)!: add the TargetFailure model, its projection table and conformance registry Introduce one domain-owned TargetFailure value whose kind alone derives the public code, category, retryability, recovery and details, for CLI and MCP alike. Selected-file malformed and truncated refusals are the first area on it: AnalysisMalformedTargetError is replaced by AnalysisTargetFailureError, and ParseFailure's byte-structure variants are TargetFailure variants rather than a parallel type. The shared stableArtifactParserFailureCli loop is replaced by a declarative registry (tests/support/targetFailure/readers/*.ts) and one generated suite that runs every registered case through the CLI and MCP. BREAKING CHANGE: selected-file malformed and truncated refusals add details.failure_kind, and a truncated target's remediation now says to re-acquire the complete file instead of choosing another target. Codes are unchanged. Affected operations: every operation that refuses a selected file's malformed or truncated bytes, including the ELF, PE, Mach-O, DWARF, Go, Rust, BEAM, pyc, devicetree, Apple IPS, kernel module, binary hardening, managed PE/CLI and IL2CPP readers. * test(managed): name the target failure error in the merged status test * docs(reference): name the error CSV instead of linking a non-page file * fix(tests): expect the path reason for non-regular dyld inputs #14225 refuses a non-regular dyld input as ArtifactReaderFailure("path"); dylibFileLifetime still expected "format" and fails on main's shard 9. * fix(tests): expect io, invariant and path where #14225 reclassified stableArtifact expected "format" for an impossible descriptor byte count (now io) and an invalid chunk size (now InternalInvariantError); directoryArtifactReaderOpen expected "format" for a non-file entry (now path, the same change as #14238). All three fail on main. * fix(errors)!: raise container reader byte faults as malformed or truncated targets Delete the ambiguous `format` reason from ArtifactReaderFailure and ArtifactOperationError. Each container reader now raises its owner's fact once, through malformedArtifact / truncatedArtifact, with format, offset, field and measured extents. Short reads inside a measured extent are read-coverage integrity failures, path-kind refusals are `path`, foreign or recovery-requiring inputs are `unsupported`, host tool output is `io`, and REA defects are InternalInvariantError. The trace, NTFS journal, release exposure, web capture, native macOS and web artifact adapters project the reader's parsed facts as AnalysisTargetFailureError instead of invalid_request. Inventory malformed, truncated, unsupported and cancelled reasons take their code from the TargetFailure projection table, so a truncated container is unsupported_target with failure_kind "truncated" on both paths. BREAKING CHANGE: inventory_artifact, inspect_artifact, extract_artifact, analyze_javascript_application, inspect_desktop_application, inspect_keyed_archive, inspect_asset_catalog, inspect_nuget_nupkg, trace_dylib_resolution, trace_web_module_imports and trace_web_source_location report damaged container bytes as unsupported_target (details.reason "malformed" or "truncated", with failure_kind and format) instead of artifact_operation_failed with reason "format", and a truncated container as unsupported_target instead of truncated. inspect_playwright_trace, inspect_ntfs_journal, audit_release_exposure, the web capture inspection operations and the caller-selected import and source maps report damaged selected bytes as unsupported_target instead of invalid_request. The `format` reason no longer appears in details.reason. * test(artifacts): expect target failure codes in compiled CLI and MCP suites * fix(errors)!: refuse malformed SQLite, pwntools and EVM inputs as target failures The SQLite engine's `format` reason is renamed to `malformed` at its owner (SQLITE_INSPECTION_REASONS), and its refusal becomes an AnalysisTargetFailureError at the selected path with format "sqlite". The pwntools and EVM worker replies keep their wire reason "format", which their workers define, and the adapters translate it once into a malformed target failure with the profile's format (elf, elf-core, evm-bytecode) instead of an invalid_format argument issue. SQLite joins the target-failure conformance registry. BREAKING CHANGE: inspect_sqlite_database, inspect_binary_layout, inspect_recorded_crash and inspect_evm_interface report a selected file's malformed bytes as unsupported_target with details.failure_kind "malformed", format_failure, format and path, instead of invalid_request with an invalid_format issue on path. * fix(errors): give the integrity kind a schema-valid code and list the reference page artifact_integrity_mismatch's projection schema requires declared and calculated digests, which a TargetFailure of kind integrity does not carry, so the kind now projects artifact_operation_failed with category integrity_mismatch. The model test validates every kind's projection against analysisErrorProjectionSchema. The reference page joins the documentation sidebar. * fix(artifacts): report a short carrier read as a changed file and keep unsupported desktop probes local A Bun or Node SEA short read inside a range already checked against the measured size meant the file changed, not that it was truncated. The carrier range reader and Bun's readExact now raise read-coverage integrity for it, and keep 'outside the file' as the truncated case. DesktopFileInspection records an unsupported managed-metadata probe as a row issue again, so later file checks still run. * test(errors): expect target failure facts in the pwntools and EVM reply suites The literal-replacement scenario now reads the failure's detail instead of an issues[] message, and a malformed reply wrapped by cleanup failure reports category unsupported_target. * test(errors): register PE DOS-signature and truncated IPS refusals and drop their per-command copies The non-MZ PE imports and load-config cases (PE32/PE32+, ZZ and high-bit signatures) and the truncated Apple IPS body move into the conformance registry, which runs them through the CLI and MCP and now also checks that a refusal leaves the selected file unchanged. The per-command tests keep only their valid-image controls. * test(sqlite): drop the malformed-database provider test the conformance registry covers inspect_sqlite_database/not-a-database in the target-failure registry runs the same non-SQLite bytes through the CLI and MCP, asserts the malformed target facts and checks the selected file is unchanged. * feat(errors)!: make failure_kind the identifier and derive code and retry from it Apply the owner review on #14239 to the TargetFailure model: - remove details.format_failure; failure_kind is the only identifier; - give integrity, conflict and io their own codes (target_integrity_mismatch, input_conflict, host_io_failed) and derive inventory malformed, truncated and unsupported codes from the same table; - add a retry hint (none, backoff, after_change) derived from the kind, with io refined by its transient errno fact; retryable stays the unchanged-retry flag and is true exactly for backoff; - rename the limit-cut result code and category truncated to partial; - drop cancelled and resource from the target kinds and spell identifiers in American English (unrecognized); - return a target failure a tool handler throws as a projected isError result instead of letting the SDK flatten it to text. BREAKING CHANGE: details.format_failure is removed (read details.failure_kind). The truncated result code and category are now partial. Target integrity failures report target_integrity_mismatch, host read failures host_io_failed and disagreeing inputs input_conflict. Inventory operations (inventory_artifact, inspect_artifact, extract_artifact and the other inventory callers) report truncated container bytes as unsupported_target. Every target failure carries a top-level retry hint. * test(sqlite): expect a malformed target for non-database bytes in the CLI suite * fix(artifacts): keep changed-file short reads, invalid offsets and EOF declarations apart PyInstaller reads inside the measured size, and .NET bundle manifest refills, now raise read-coverage integrity on a zero-byte read instead of truncated. A .NET bundle field and a Godot PCK directory entry that extend past the file are truncated (with offset and extents) instead of malformed. An absent or invalid ASAR packed offset is malformed; only a valid range past the archive is truncated. The .NET manifest string offset is reported in file coordinates. * fix(pwntools): report a short ELF header as a truncated target The layout and recorded-crash workers raise a distinct truncated reason when the file ends inside the ELF identification or header, and the decoder projects it as failure_kind truncated instead of inferring it from the message. * fix(errors)!: report managed coverage gaps and IL2CPP pair conflicts as target failures Managed readers interpret an issue code once, in managedIssueTargetFailure: a coverage gap is an unsupported target, every other rule violation is a malformed target, and the inventory metadata status is derived from that same fact. managedInspectionTargetFailure now returns only AnalysisTargetFailureError. An IL2CPP binary that parses but does not link to its metadata is a conflict target failure that lists both inputs and blames neither, in place of an invalid_request with two issue entries. Metadata version 108 is an unsupported target. The CLI spells each conflict input's field by the command's option name. BREAKING CHANGE: inspect_managed_artifact, inspect_managed_members, inspect_managed_native_boundaries and the managed comparison operations report unsupported metadata or signature forms as an AnalysisTargetFailureError (failure_kind unsupported, format pe-cli, field, offset) instead of a bare unsupported target. inspect_il2cpp_metadata reports a binary/metadata pair that does not link as code input_conflict with failure_kind conflict and details.inputs, instead of invalid_request with details.issues, and metadata version 108 with failure_kind unsupported. * fix(artifacts): verify the carrier before blaming a short read on the bytes The NTFS $MFT decoder, positional members (FIT, uImage, Bun, Deno) and .NET bundle members now re-verify the source before reporting a short stream as malformed, so a file that changed during the read reports the change. The truncation site builds the model's measured extent. * fix(errors)!: report inventory refusals as target failures of the selected path An inventory, inspection or extraction refused damaged or unsupported container bytes as an ArtifactOperationError whose reason repeated the format owner's kind. It carried no path or retry hint, so the conformance registry could not express container cases. translateArtifactFailure now takes the selected path and returns the reader's TargetFailure as an AnalysisTargetFailureError. The malformed, truncated and unsupported reasons, their classification rows and their presentation branch are deleted from ArtifactOperationError. Readers' unsupported refusals carry their format facts through unsupportedArtifact. Container cases move into the conformance registry, which now opens the target first for session tools such as inspect_artifact. BREAKING CHANGE: inventory_artifact, inspect_artifact, extract_artifact and the bundle readers report a refused container as a target failure of details.path with a top-level retry. details.reason is the owner's description and details.detail is removed. * docs(il2cpp): describe pair conflicts as input_conflict with both inputs * docs(android): name unsupported_target for truncated boot image structures * fix(errors)!: report a target that changed during the read as failure_kind changed Inventory integrity failures whose check means the target moved under the read (container, member and unpacked-entry identity, read coverage, traversal coverage) now take the model's changed projection: code artifact_changed, retry backoff and details.failure_kind changed. A selected target that no longer matches the one the session admitted gets its own admitted-identity check and keeps its reopen recovery. BREAKING CHANGE: inventory_artifact, inspect_artifact, extract_artifact and the other inventory operations report a target that changed during the read as artifact_changed (retryable, failure_kind changed) instead of artifact_operation_failed. Admission-identity refusals report integrity_check admitted-identity instead of container-identity. * test(artifacts): raise the cleanup fixture's decode refusal with its format facts * fix(errors)!: report unsupported and unrecognized targets on the TargetFailure model AnalysisUnsupportedTargetError carried a free-text reason and remediation beside the TargetFailure model, so unsupported refusals had no format, failure_kind or retry hint, and their recovery was prose written at each producer. The class is deleted. Producers raise unsupportedTarget or unrecognizedTarget with the owner's format, and consumers read targetFailureOfKind. The projection table renders the recovery and names the operations the owner lists in related.operations. The foreign-bytes identity loop moves into the conformance registry. BREAKING CHANGE: unsupported and unrecognized targets report failure_kind, format and retry. Their remediation comes from the target-failure table; producer-written remediation sentences are folded into details.reason or replaced by details.related_operations. * test(artifacts): expect admitted-identity for selections replaced before admission A selected source replaced before admission fails the admitted-identity check rather than container-identity since the changed/admitted split. * test(go): name the fixture and result when an MZ carrier is not refused through MCP * style: format the migrated target-failure tests * test(errors): expect the PE readers' native-binary format label for foreign bytes * test(verify): expect target failures for damaged ELF, core and EVM inputs in real-provider verifiers The binary-layout, recorded-crash and EVM verifiers still expected invalid_input for malformed or truncated selected bytes. The pwntools and EVM adapters now report those as unsupported_target with failure_kind; a missing path remains invalid_input. * test(web): expect the partial code for a refused source-map admission The limit-cut code is partial; this Windows-lane test arrived from main with the old truncated spelling. * fix(artifacts): keep refusal facts on DMG verdicts and the selected bundle path hdiutil's "image not recognized" verdict raised the unsupported reason without the owner's facts, so the inventory translation treated it as a reader defect. It now carries an unsupported dmg target failure, and the reader-failure constructor requires facts for every target reason. A bundle resource refusal names the caller's selected bundle path rather than its resolved target. The real-provider verifiers and the Android, source-location acceptance tests expect the model's target-failure categories and codes. * test(errors): assert unsupported refusals' kind and format, and align verifiers and the Electron guide * test(errors): check the MCP target failure as the text clients receive The stdio transport removes the private structured carrier from every isError result, so the conformance suite asserted a field that never reaches clients and failed every case. The projected diagnostic is checked from the JSON text instead. * test(errors): raise main's new unsupported-target fixtures through the model * test(artifacts): expect artifact_changed when selected bytes change after inventory Bundle resources replaced after open and unselected JavaScript sources rewritten after inventory now fail a change check, so they report artifact_changed with retry backoff rather than artifact_operation_failed. * fix(errors): report a session digest mismatch as admitted-identity The digest the session admitted does not change when the same request is repeated, so targetDigestChangedFailure was inviting a backoff retry that fails the same way. It now names admitted-identity, which stays artifact_operation_failed and not retryable, and tells the caller to reopen. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(artifacts): classify unused PyInstaller compressed input as layout zlib stops at the first complete stream, so a declared span that arrives intact but is not fully consumed is trailing junk or a second stream, not a file that changed. A source that ends before that span stays read-coverage. The cached-carrier test replaces the file with a different size so a shared timestamp cannot hide the rewrite. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(applications): expect unsupported_target for a damaged trace stream A trace member whose CRC fails is a malformed zip target. The partial Evidence assertion now checks that code, failure_kind and format. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(artifacts): assert Android refusal kinds and drop the SEA registry case details.reason is the owner's description, so the boot-image refusals assert failure_kind and format. A malformed SEA blob inside an ELF stays an outer-format inventory with a recognition limitation, which the Node SEA reader tests already cover, so it is not an inspect_artifact refusal. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(artifacts): pass the selected path into translated target failures translateArtifactFailure names the caller-selected path on a format refusal. Directory inspection and a retained artifact scope both know that path and now supply it. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(artifacts): charge global pax records against the tar metadata budget Repeated pax global headers were copied into one map without a charge, so each header could stay inside the extended-header allowance while the map grew without a bound. The retained metadata budget is charged for the merged map's keys, values and entries before that map is allocated. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(dylib): expect admitted-identity when the opened target is replaced The session keeps the digest it admitted, so replacing the executable and repeating trace_dylib_resolution is not a retryable container change. Co-authored-by: morluto <morluto@users.noreply.github.com> * style: format the inventory path translation and conformance suite * fix(artifacts): keep the unsupported-target migration in files the inventory merge replaced * test(errors): expect target failures for ZIP inventory refusals and input_conflict for an unlinked IL2CPP pair * test(artifacts): expect a malformed target failure for an ISO 9660 directory cycle * test(web): expect a malformed target failure on the captured source path * test(artifacts): expect a malformed ZIP target failure for a corrupt Zstandard member * test(javascript): read the owner's input facts from details.reason and recovery from the projection * test(iso9660): assert the malformed target failure fields details.reason is the owner's description. The compiled CLI refusal is identified by failure_kind and format. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(errors): assert selection and unsupported view fields A desktop root that is not a directory is a selection failure, so the CLI reports invalid_request. An analysis view the parent cannot supply is unsupported evidence; the tests read failure_kind, format, field and related_operations. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(errors): keep binary plist UID facts on unsupported targets Pass the reader's UnsupportedBinaryPlistUidError failure through instead of rebuilding a bplist refusal that drops field and undecodedContent. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(errors): keep oversized binary plist UID facts on keyed archives Assert the reader projects format, field, and undecoded content from the parser failure instead of a rebuilt bplist refusal. Co-authored-by: morluto <morluto@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: morluto <morluto@users.noreply.github.com> |
||
|
|
c214fc44a8 |
fix(errors)!: report inventory refusals as target failures of the selected path (#14277)
* feat(errors)!: add the TargetFailure model, its projection table and conformance registry Introduce one domain-owned TargetFailure value whose kind alone derives the public code, category, retryability, recovery and details, for CLI and MCP alike. Selected-file malformed and truncated refusals are the first area on it: AnalysisMalformedTargetError is replaced by AnalysisTargetFailureError, and ParseFailure's byte-structure variants are TargetFailure variants rather than a parallel type. The shared stableArtifactParserFailureCli loop is replaced by a declarative registry (tests/support/targetFailure/readers/*.ts) and one generated suite that runs every registered case through the CLI and MCP. BREAKING CHANGE: selected-file malformed and truncated refusals add details.failure_kind, and a truncated target's remediation now says to re-acquire the complete file instead of choosing another target. Codes are unchanged. Affected operations: every operation that refuses a selected file's malformed or truncated bytes, including the ELF, PE, Mach-O, DWARF, Go, Rust, BEAM, pyc, devicetree, Apple IPS, kernel module, binary hardening, managed PE/CLI and IL2CPP readers. * test(managed): name the target failure error in the merged status test * docs(reference): name the error CSV instead of linking a non-page file * fix(tests): expect the path reason for non-regular dyld inputs #14225 refuses a non-regular dyld input as ArtifactReaderFailure("path"); dylibFileLifetime still expected "format" and fails on main's shard 9. * fix(tests): expect io, invariant and path where #14225 reclassified stableArtifact expected "format" for an impossible descriptor byte count (now io) and an invalid chunk size (now InternalInvariantError); directoryArtifactReaderOpen expected "format" for a non-file entry (now path, the same change as #14238). All three fail on main. * fix(errors)!: raise container reader byte faults as malformed or truncated targets Delete the ambiguous `format` reason from ArtifactReaderFailure and ArtifactOperationError. Each container reader now raises its owner's fact once, through malformedArtifact / truncatedArtifact, with format, offset, field and measured extents. Short reads inside a measured extent are read-coverage integrity failures, path-kind refusals are `path`, foreign or recovery-requiring inputs are `unsupported`, host tool output is `io`, and REA defects are InternalInvariantError. The trace, NTFS journal, release exposure, web capture, native macOS and web artifact adapters project the reader's parsed facts as AnalysisTargetFailureError instead of invalid_request. Inventory malformed, truncated, unsupported and cancelled reasons take their code from the TargetFailure projection table, so a truncated container is unsupported_target with failure_kind "truncated" on both paths. BREAKING CHANGE: inventory_artifact, inspect_artifact, extract_artifact, analyze_javascript_application, inspect_desktop_application, inspect_keyed_archive, inspect_asset_catalog, inspect_nuget_nupkg, trace_dylib_resolution, trace_web_module_imports and trace_web_source_location report damaged container bytes as unsupported_target (details.reason "malformed" or "truncated", with failure_kind and format) instead of artifact_operation_failed with reason "format", and a truncated container as unsupported_target instead of truncated. inspect_playwright_trace, inspect_ntfs_journal, audit_release_exposure, the web capture inspection operations and the caller-selected import and source maps report damaged selected bytes as unsupported_target instead of invalid_request. The `format` reason no longer appears in details.reason. * test(artifacts): expect target failure codes in compiled CLI and MCP suites * fix(errors)!: refuse malformed SQLite, pwntools and EVM inputs as target failures The SQLite engine's `format` reason is renamed to `malformed` at its owner (SQLITE_INSPECTION_REASONS), and its refusal becomes an AnalysisTargetFailureError at the selected path with format "sqlite". The pwntools and EVM worker replies keep their wire reason "format", which their workers define, and the adapters translate it once into a malformed target failure with the profile's format (elf, elf-core, evm-bytecode) instead of an invalid_format argument issue. SQLite joins the target-failure conformance registry. BREAKING CHANGE: inspect_sqlite_database, inspect_binary_layout, inspect_recorded_crash and inspect_evm_interface report a selected file's malformed bytes as unsupported_target with details.failure_kind "malformed", format_failure, format and path, instead of invalid_request with an invalid_format issue on path. * fix(errors): give the integrity kind a schema-valid code and list the reference page artifact_integrity_mismatch's projection schema requires declared and calculated digests, which a TargetFailure of kind integrity does not carry, so the kind now projects artifact_operation_failed with category integrity_mismatch. The model test validates every kind's projection against analysisErrorProjectionSchema. The reference page joins the documentation sidebar. * fix(artifacts): report a short carrier read as a changed file and keep unsupported desktop probes local A Bun or Node SEA short read inside a range already checked against the measured size meant the file changed, not that it was truncated. The carrier range reader and Bun's readExact now raise read-coverage integrity for it, and keep 'outside the file' as the truncated case. DesktopFileInspection records an unsupported managed-metadata probe as a row issue again, so later file checks still run. * test(errors): expect target failure facts in the pwntools and EVM reply suites The literal-replacement scenario now reads the failure's detail instead of an issues[] message, and a malformed reply wrapped by cleanup failure reports category unsupported_target. * test(errors): register PE DOS-signature and truncated IPS refusals and drop their per-command copies The non-MZ PE imports and load-config cases (PE32/PE32+, ZZ and high-bit signatures) and the truncated Apple IPS body move into the conformance registry, which runs them through the CLI and MCP and now also checks that a refusal leaves the selected file unchanged. The per-command tests keep only their valid-image controls. * test(sqlite): drop the malformed-database provider test the conformance registry covers inspect_sqlite_database/not-a-database in the target-failure registry runs the same non-SQLite bytes through the CLI and MCP, asserts the malformed target facts and checks the selected file is unchanged. * feat(errors)!: make failure_kind the identifier and derive code and retry from it Apply the owner review on #14239 to the TargetFailure model: - remove details.format_failure; failure_kind is the only identifier; - give integrity, conflict and io their own codes (target_integrity_mismatch, input_conflict, host_io_failed) and derive inventory malformed, truncated and unsupported codes from the same table; - add a retry hint (none, backoff, after_change) derived from the kind, with io refined by its transient errno fact; retryable stays the unchanged-retry flag and is true exactly for backoff; - rename the limit-cut result code and category truncated to partial; - drop cancelled and resource from the target kinds and spell identifiers in American English (unrecognized); - return a target failure a tool handler throws as a projected isError result instead of letting the SDK flatten it to text. BREAKING CHANGE: details.format_failure is removed (read details.failure_kind). The truncated result code and category are now partial. Target integrity failures report target_integrity_mismatch, host read failures host_io_failed and disagreeing inputs input_conflict. Inventory operations (inventory_artifact, inspect_artifact, extract_artifact and the other inventory callers) report truncated container bytes as unsupported_target. Every target failure carries a top-level retry hint. * test(sqlite): expect a malformed target for non-database bytes in the CLI suite * fix(artifacts): keep changed-file short reads, invalid offsets and EOF declarations apart PyInstaller reads inside the measured size, and .NET bundle manifest refills, now raise read-coverage integrity on a zero-byte read instead of truncated. A .NET bundle field and a Godot PCK directory entry that extend past the file are truncated (with offset and extents) instead of malformed. An absent or invalid ASAR packed offset is malformed; only a valid range past the archive is truncated. The .NET manifest string offset is reported in file coordinates. * fix(pwntools): report a short ELF header as a truncated target The layout and recorded-crash workers raise a distinct truncated reason when the file ends inside the ELF identification or header, and the decoder projects it as failure_kind truncated instead of inferring it from the message. * fix(errors)!: report managed coverage gaps and IL2CPP pair conflicts as target failures Managed readers interpret an issue code once, in managedIssueTargetFailure: a coverage gap is an unsupported target, every other rule violation is a malformed target, and the inventory metadata status is derived from that same fact. managedInspectionTargetFailure now returns only AnalysisTargetFailureError. An IL2CPP binary that parses but does not link to its metadata is a conflict target failure that lists both inputs and blames neither, in place of an invalid_request with two issue entries. Metadata version 108 is an unsupported target. The CLI spells each conflict input's field by the command's option name. BREAKING CHANGE: inspect_managed_artifact, inspect_managed_members, inspect_managed_native_boundaries and the managed comparison operations report unsupported metadata or signature forms as an AnalysisTargetFailureError (failure_kind unsupported, format pe-cli, field, offset) instead of a bare unsupported target. inspect_il2cpp_metadata reports a binary/metadata pair that does not link as code input_conflict with failure_kind conflict and details.inputs, instead of invalid_request with details.issues, and metadata version 108 with failure_kind unsupported. * fix(artifacts): verify the carrier before blaming a short read on the bytes The NTFS $MFT decoder, positional members (FIT, uImage, Bun, Deno) and .NET bundle members now re-verify the source before reporting a short stream as malformed, so a file that changed during the read reports the change. The truncation site builds the model's measured extent. * fix(errors)!: report inventory refusals as target failures of the selected path An inventory, inspection or extraction refused damaged or unsupported container bytes as an ArtifactOperationError whose reason repeated the format owner's kind. It carried no path or retry hint, so the conformance registry could not express container cases. translateArtifactFailure now takes the selected path and returns the reader's TargetFailure as an AnalysisTargetFailureError. The malformed, truncated and unsupported reasons, their classification rows and their presentation branch are deleted from ArtifactOperationError. Readers' unsupported refusals carry their format facts through unsupportedArtifact. Container cases move into the conformance registry, which now opens the target first for session tools such as inspect_artifact. BREAKING CHANGE: inventory_artifact, inspect_artifact, extract_artifact and the bundle readers report a refused container as a target failure of details.path with a top-level retry. details.reason is the owner's description and details.detail is removed. * docs(il2cpp): describe pair conflicts as input_conflict with both inputs * docs(android): name unsupported_target for truncated boot image structures * fix(errors)!: report a target that changed during the read as failure_kind changed Inventory integrity failures whose check means the target moved under the read (container, member and unpacked-entry identity, read coverage, traversal coverage) now take the model's changed projection: code artifact_changed, retry backoff and details.failure_kind changed. A selected target that no longer matches the one the session admitted gets its own admitted-identity check and keeps its reopen recovery. BREAKING CHANGE: inventory_artifact, inspect_artifact, extract_artifact and the other inventory operations report a target that changed during the read as artifact_changed (retryable, failure_kind changed) instead of artifact_operation_failed. Admission-identity refusals report integrity_check admitted-identity instead of container-identity. * test(artifacts): raise the cleanup fixture's decode refusal with its format facts * test(artifacts): expect admitted-identity for selections replaced before admission A selected source replaced before admission fails the admitted-identity check rather than container-identity since the changed/admitted split. * test(go): name the fixture and result when an MZ carrier is not refused through MCP * test(verify): expect target failures for damaged ELF, core and EVM inputs in real-provider verifiers The binary-layout, recorded-crash and EVM verifiers still expected invalid_input for malformed or truncated selected bytes. The pwntools and EVM adapters now report those as unsupported_target with failure_kind; a missing path remains invalid_input. * test(web): expect the partial code for a refused source-map admission The limit-cut code is partial; this Windows-lane test arrived from main with the old truncated spelling. * fix(artifacts): keep refusal facts on DMG verdicts and the selected bundle path hdiutil's "image not recognized" verdict raised the unsupported reason without the owner's facts, so the inventory translation treated it as a reader defect. It now carries an unsupported dmg target failure, and the reader-failure constructor requires facts for every target reason. A bundle resource refusal names the caller's selected bundle path rather than its resolved target. The real-provider verifiers and the Android, source-location acceptance tests expect the model's target-failure categories and codes. * test(errors): check the MCP target failure as the text clients receive The stdio transport removes the private structured carrier from every isError result, so the conformance suite asserted a field that never reaches clients and failed every case. The projected diagnostic is checked from the JSON text instead. * test(artifacts): expect artifact_changed when selected bytes change after inventory Bundle resources replaced after open and unselected JavaScript sources rewritten after inventory now fail a change check, so they report artifact_changed with retry backoff rather than artifact_operation_failed. * fix(errors): report a session digest mismatch as admitted-identity The digest the session admitted does not change when the same request is repeated, so targetDigestChangedFailure was inviting a backoff retry that fails the same way. It now names admitted-identity, which stays artifact_operation_failed and not retryable, and tells the caller to reopen. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(artifacts): classify unused PyInstaller compressed input as layout zlib stops at the first complete stream, so a declared span that arrives intact but is not fully consumed is trailing junk or a second stream, not a file that changed. A source that ends before that span stays read-coverage. The cached-carrier test replaces the file with a different size so a shared timestamp cannot hide the rewrite. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(applications): expect unsupported_target for a damaged trace stream A trace member whose CRC fails is a malformed zip target. The partial Evidence assertion now checks that code, failure_kind and format. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(artifacts): assert Android refusal kinds and drop the SEA registry case details.reason is the owner's description, so the boot-image refusals assert failure_kind and format. A malformed SEA blob inside an ELF stays an outer-format inventory with a recognition limitation, which the Node SEA reader tests already cover, so it is not an inspect_artifact refusal. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(artifacts): pass the selected path into translated target failures translateArtifactFailure names the caller-selected path on a format refusal. Directory inspection and a retained artifact scope both know that path and now supply it. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(dylib): expect admitted-identity when the opened target is replaced The session keeps the digest it admitted, so replacing the executable and repeating trace_dylib_resolution is not a retryable container change. Co-authored-by: morluto <morluto@users.noreply.github.com> * style: format the inventory path translation and conformance suite * test(errors): expect target failures for ZIP inventory refusals and input_conflict for an unlinked IL2CPP pair * test(web): expect a malformed target failure on the captured source path * test(artifacts): expect a malformed ZIP target failure for a corrupt Zstandard member --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: morluto <morluto@users.noreply.github.com> |
||
|
|
a61ff39c9a |
fix(errors)!: refuse malformed SQLite, pwntools and EVM inputs as target failures (#14268)
* feat(errors)!: add the TargetFailure model, its projection table and conformance registry Introduce one domain-owned TargetFailure value whose kind alone derives the public code, category, retryability, recovery and details, for CLI and MCP alike. Selected-file malformed and truncated refusals are the first area on it: AnalysisMalformedTargetError is replaced by AnalysisTargetFailureError, and ParseFailure's byte-structure variants are TargetFailure variants rather than a parallel type. The shared stableArtifactParserFailureCli loop is replaced by a declarative registry (tests/support/targetFailure/readers/*.ts) and one generated suite that runs every registered case through the CLI and MCP. BREAKING CHANGE: selected-file malformed and truncated refusals add details.failure_kind, and a truncated target's remediation now says to re-acquire the complete file instead of choosing another target. Codes are unchanged. Affected operations: every operation that refuses a selected file's malformed or truncated bytes, including the ELF, PE, Mach-O, DWARF, Go, Rust, BEAM, pyc, devicetree, Apple IPS, kernel module, binary hardening, managed PE/CLI and IL2CPP readers. * test(managed): name the target failure error in the merged status test * docs(reference): name the error CSV instead of linking a non-page file * fix(tests): expect the path reason for non-regular dyld inputs #14225 refuses a non-regular dyld input as ArtifactReaderFailure("path"); dylibFileLifetime still expected "format" and fails on main's shard 9. * fix(tests): expect io, invariant and path where #14225 reclassified stableArtifact expected "format" for an impossible descriptor byte count (now io) and an invalid chunk size (now InternalInvariantError); directoryArtifactReaderOpen expected "format" for a non-file entry (now path, the same change as #14238). All three fail on main. * fix(errors)!: raise container reader byte faults as malformed or truncated targets Delete the ambiguous `format` reason from ArtifactReaderFailure and ArtifactOperationError. Each container reader now raises its owner's fact once, through malformedArtifact / truncatedArtifact, with format, offset, field and measured extents. Short reads inside a measured extent are read-coverage integrity failures, path-kind refusals are `path`, foreign or recovery-requiring inputs are `unsupported`, host tool output is `io`, and REA defects are InternalInvariantError. The trace, NTFS journal, release exposure, web capture, native macOS and web artifact adapters project the reader's parsed facts as AnalysisTargetFailureError instead of invalid_request. Inventory malformed, truncated, unsupported and cancelled reasons take their code from the TargetFailure projection table, so a truncated container is unsupported_target with failure_kind "truncated" on both paths. BREAKING CHANGE: inventory_artifact, inspect_artifact, extract_artifact, analyze_javascript_application, inspect_desktop_application, inspect_keyed_archive, inspect_asset_catalog, inspect_nuget_nupkg, trace_dylib_resolution, trace_web_module_imports and trace_web_source_location report damaged container bytes as unsupported_target (details.reason "malformed" or "truncated", with failure_kind and format) instead of artifact_operation_failed with reason "format", and a truncated container as unsupported_target instead of truncated. inspect_playwright_trace, inspect_ntfs_journal, audit_release_exposure, the web capture inspection operations and the caller-selected import and source maps report damaged selected bytes as unsupported_target instead of invalid_request. The `format` reason no longer appears in details.reason. * test(artifacts): expect target failure codes in compiled CLI and MCP suites * fix(errors)!: refuse malformed SQLite, pwntools and EVM inputs as target failures The SQLite engine's `format` reason is renamed to `malformed` at its owner (SQLITE_INSPECTION_REASONS), and its refusal becomes an AnalysisTargetFailureError at the selected path with format "sqlite". The pwntools and EVM worker replies keep their wire reason "format", which their workers define, and the adapters translate it once into a malformed target failure with the profile's format (elf, elf-core, evm-bytecode) instead of an invalid_format argument issue. SQLite joins the target-failure conformance registry. BREAKING CHANGE: inspect_sqlite_database, inspect_binary_layout, inspect_recorded_crash and inspect_evm_interface report a selected file's malformed bytes as unsupported_target with details.failure_kind "malformed", format_failure, format and path, instead of invalid_request with an invalid_format issue on path. * fix(errors): give the integrity kind a schema-valid code and list the reference page artifact_integrity_mismatch's projection schema requires declared and calculated digests, which a TargetFailure of kind integrity does not carry, so the kind now projects artifact_operation_failed with category integrity_mismatch. The model test validates every kind's projection against analysisErrorProjectionSchema. The reference page joins the documentation sidebar. * fix(artifacts): report a short carrier read as a changed file and keep unsupported desktop probes local A Bun or Node SEA short read inside a range already checked against the measured size meant the file changed, not that it was truncated. The carrier range reader and Bun's readExact now raise read-coverage integrity for it, and keep 'outside the file' as the truncated case. DesktopFileInspection records an unsupported managed-metadata probe as a row issue again, so later file checks still run. * test(errors): expect target failure facts in the pwntools and EVM reply suites The literal-replacement scenario now reads the failure's detail instead of an issues[] message, and a malformed reply wrapped by cleanup failure reports category unsupported_target. * test(errors): register PE DOS-signature and truncated IPS refusals and drop their per-command copies The non-MZ PE imports and load-config cases (PE32/PE32+, ZZ and high-bit signatures) and the truncated Apple IPS body move into the conformance registry, which runs them through the CLI and MCP and now also checks that a refusal leaves the selected file unchanged. The per-command tests keep only their valid-image controls. * test(sqlite): drop the malformed-database provider test the conformance registry covers inspect_sqlite_database/not-a-database in the target-failure registry runs the same non-SQLite bytes through the CLI and MCP, asserts the malformed target facts and checks the selected file is unchanged. * feat(errors)!: make failure_kind the identifier and derive code and retry from it Apply the owner review on #14239 to the TargetFailure model: - remove details.format_failure; failure_kind is the only identifier; - give integrity, conflict and io their own codes (target_integrity_mismatch, input_conflict, host_io_failed) and derive inventory malformed, truncated and unsupported codes from the same table; - add a retry hint (none, backoff, after_change) derived from the kind, with io refined by its transient errno fact; retryable stays the unchanged-retry flag and is true exactly for backoff; - rename the limit-cut result code and category truncated to partial; - drop cancelled and resource from the target kinds and spell identifiers in American English (unrecognized); - return a target failure a tool handler throws as a projected isError result instead of letting the SDK flatten it to text. BREAKING CHANGE: details.format_failure is removed (read details.failure_kind). The truncated result code and category are now partial. Target integrity failures report target_integrity_mismatch, host read failures host_io_failed and disagreeing inputs input_conflict. Inventory operations (inventory_artifact, inspect_artifact, extract_artifact and the other inventory callers) report truncated container bytes as unsupported_target. Every target failure carries a top-level retry hint. * test(sqlite): expect a malformed target for non-database bytes in the CLI suite * fix(artifacts): keep changed-file short reads, invalid offsets and EOF declarations apart PyInstaller reads inside the measured size, and .NET bundle manifest refills, now raise read-coverage integrity on a zero-byte read instead of truncated. A .NET bundle field and a Godot PCK directory entry that extend past the file are truncated (with offset and extents) instead of malformed. An absent or invalid ASAR packed offset is malformed; only a valid range past the archive is truncated. The .NET manifest string offset is reported in file coordinates. * fix(pwntools): report a short ELF header as a truncated target The layout and recorded-crash workers raise a distinct truncated reason when the file ends inside the ELF identification or header, and the decoder projects it as failure_kind truncated instead of inferring it from the message. * fix(artifacts): verify the carrier before blaming a short read on the bytes The NTFS $MFT decoder, positional members (FIT, uImage, Bun, Deno) and .NET bundle members now re-verify the source before reporting a short stream as malformed, so a file that changed during the read reports the change. The truncation site builds the model's measured extent. * docs(android): name unsupported_target for truncated boot image structures * fix(errors)!: report a target that changed during the read as failure_kind changed Inventory integrity failures whose check means the target moved under the read (container, member and unpacked-entry identity, read coverage, traversal coverage) now take the model's changed projection: code artifact_changed, retry backoff and details.failure_kind changed. A selected target that no longer matches the one the session admitted gets its own admitted-identity check and keeps its reopen recovery. BREAKING CHANGE: inventory_artifact, inspect_artifact, extract_artifact and the other inventory operations report a target that changed during the read as artifact_changed (retryable, failure_kind changed) instead of artifact_operation_failed. Admission-identity refusals report integrity_check admitted-identity instead of container-identity. * test(artifacts): expect admitted-identity for selections replaced before admission A selected source replaced before admission fails the admitted-identity check rather than container-identity since the changed/admitted split. * test(go): name the fixture and result when an MZ carrier is not refused through MCP * test(verify): expect target failures for damaged ELF, core and EVM inputs in real-provider verifiers The binary-layout, recorded-crash and EVM verifiers still expected invalid_input for malformed or truncated selected bytes. The pwntools and EVM adapters now report those as unsupported_target with failure_kind; a missing path remains invalid_input. * test(web): expect the partial code for a refused source-map admission The limit-cut code is partial; this Windows-lane test arrived from main with the old truncated spelling. * test(errors): check the MCP target failure as the text clients receive The stdio transport removes the private structured carrier from every isError result, so the conformance suite asserted a field that never reaches clients and failed every case. The projected diagnostic is checked from the JSON text instead. * test(artifacts): expect artifact_changed when selected bytes change after inventory Bundle resources replaced after open and unselected JavaScript sources rewritten after inventory now fail a change check, so they report artifact_changed with retry backoff rather than artifact_operation_failed. * fix(errors): report a session digest mismatch as admitted-identity The digest the session admitted does not change when the same request is repeated, so targetDigestChangedFailure was inviting a backoff retry that fails the same way. It now names admitted-identity, which stays artifact_operation_failed and not retryable, and tells the caller to reopen. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(artifacts): classify unused PyInstaller compressed input as layout zlib stops at the first complete stream, so a declared span that arrives intact but is not fully consumed is trailing junk or a second stream, not a file that changed. A source that ends before that span stays read-coverage. The cached-carrier test replaces the file with a different size so a shared timestamp cannot hide the rewrite. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(applications): expect unsupported_target for a damaged trace stream A trace member whose CRC fails is a malformed zip target. The partial Evidence assertion now checks that code, failure_kind and format. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(dylib): expect admitted-identity when the opened target is replaced The session keeps the digest it admitted, so replacing the executable and repeating trace_dylib_resolution is not a retryable container change. Co-authored-by: morluto <morluto@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: morluto <morluto@users.noreply.github.com> |
||
|
|
40e9a3f1a1 | feat(errors)!: add the TargetFailure model, its projection table and conformance registry (#14247) | ||
|
|
26cb5b53ce |
fix(tests): give CI workflow fixtures a hermetic GitHub context
The CI script tests spread process.env into required.mjs and the other workflow scripts, so on a runner they inherited that job's own GITHUB_EVENT_NAME. Since #14383 added scheduled fast sweeps, a scheduled main run made every fixture take the sweep path, and seven tests in ciChangeScope and ciRequiredLanes failed with "Scheduled fast sweep requires the complete portable test suite". workflowFixtureEnvironment now owns the fixture environment: it drops the host's GITHUB_* and CI_* variables and applies the test's own, so each fixture states the workflow context it simulates. All fourteen spreads in the four CI suites use it. With GITHUB_EVENT_NAME=schedule the suites failed 7 of 511 before and pass 511 after; push and unset contexts pass. |
||
|
|
b016a09bfd | refactor(cli): share token window presentation and output capture (#14382) | ||
|
|
7fe9fc5ee9 | test(application): share late cancellation evidence checks (#14381) | ||
|
|
a85859e147 |
feat(pe): inspect x64 exception-directory function ranges (#14254)
* feat(pe): inspect x64 exception-directory function ranges Add inspect_pe_unwind_ranges, a provider-free reader of the PE32+ exception directory (.pdata). It reports each RUNTIME_FUNCTION's begin, end and unwind RVAs, whether the entry starts a function or is a chained fragment (UNW_FLAG_CHAININFO or an indirect unwind RVA), the chain's parent and primary entry, and empty, unsorted, overlapping, unmapped or unresolvable entries as explicit issues. Counts cover every entry while kind, offset and limit select the page. It reads headers through the shared PE image owner without changing its admission. Failures use the existing PE failure projection. Refs #14181 * chore(pe): record the unwind-ranges advertised schema and cursor skill * fix(pe): index chain parents, map the whole exception directory and keep high RVAs unsigned An unsorted table looked up every chain parent with a linear scan, and chain resolution did not yield, so a crafted table could stall the server. Parents are now found through one begin-RVA order and the pass yields to cancellation. The file-backed check covers every declared directory byte, including trailing bytes, and clearing the indirect bit keeps RVAs at or above 0x80000000 unsigned. * fix(pe): bound unwind reads and report unreadable codes, mismatched parents and unsorted overlaps Unwind data is visited in ascending RVA order, so the windowed reader moves forward and reads each region about once whatever the table order. A primary entry whose declared code array leaves the file-backed bytes is unknown (unwind_codes_unmapped), and its header facts are kept. A chain parent must match the whole RUNTIME_FUNCTION; an entry with the same begin but another end or unwind RVA is chain_parent_mismatch. Order and overlap are checked separately. The guide moves under docs/guides/native, and its route is unchanged. * fix(pe): index whole RUNTIME_FUNCTION records for chain parents Entries sharing a begin RVA were scanned for every parent lookup. The table is now ordered once by (begin, end, unwind), and a parent is a binary search for the exact record, with a second search for a begin mismatch. * test(pe): register the unwind-ranges provider lifecycle coverage The provider lifecycle registry needs one entry per provider id. Add rea-pe-unwind-ranges with its public CLI/MCP workflow and a typed resource and cancellation failure test. * test(cli): record inspect-pe-unwind-ranges in the completion goldens * fix(pe): keep a verified unwind report through cleanup failure and check the directory before its allowance A report completed before final close failed was replaced by the file hash. The provider now records the verified report and the shared PE failure projection retains it, as the ELF readers do. The entry allowance now applies only after the directory is shown file-backed, so an oversized count that leaves the file is a malformed target. * chore(pe): register the exception-directory entry allowance as a pending fixed ceiling |
||
|
|
721b25e20d |
feat(rizin)!: record which tool and version answered execute_rizin_command (#7487)
* refactor(process): share executable lookup with provider commands Process capture owned the only spawn-equivalent PATH lookup, wrapped in scenario-specific errors. Move the lookup into src/process as a result type, so a provider command can resolve an executable once, hash it and then run that same file. Process capture maps the result to its existing errors unchanged. * feat(rizin): record which tool and version answered execute_rizin_command execute_rizin_command recorded version null and labelled any executable selected by REA_RIZIN_COMMAND as Rizin, although radare2 also accepts REA's argument list. Before the first command for each executable digest, resolve the selected executable through PATH, hash it, run it with -v and read its banner; the command then runs the same file. The Evidence provider records the tool name and version, and the parameters record the resolved executable path, its SHA-256 and the banner line. A tool other than Rizin still runs, with a limitation; a failed, timed out or unrecognized probe leaves the version unknown. Each digest's reading, including a failure, is reused for the life of the process, and concurrent first calls share one probe within the caller's command_timeout_ms budget. A caller that stops waiting cancels the probe only when no other caller needs it. A probe whose process cleanup is incomplete stays retained for retry. * fix(rizin): probe per call and reuse only completed probes Sharing an in-flight version probe between callers let a joining call outlive its own command_timeout_ms and inherit another caller's cancellation, and the cache was keyed by digest alone, so byte-identical launchers in different directories shared one reading. Remove the sharing: each call runs its own probe under its own deadline and cancellation. Reuse only completed probes (a banner, a non-zero exit or a timeout), keyed by the resolved launch path and its SHA-256. The executable lookup now honours the call's deadline and cancellation, so a stalled PATH entry cannot hang a call or close(). A failed probe records its exit status and bounded stdout and stderr in provider_version_probe, and a cancelled probe keeps its captured output on the error. * fix(rizin): never let a later probe failure replace a successful reading Concurrent first calls can each probe the same launch path and digest. When one probe printed a banner and another later timed out or exited non-zero, the failure overwrote the cached reading, so every later call reported an unknown version for the life of the server. Route the cache write through one rule: a failure never replaces a successful reading, and a success replaces an earlier failure. Each call still reports its own probe's outcome. * docs(rizin): state what the executable digest and version observe The guide said the command "runs the same file" as the version probe. REA runs the same resolved path; the recorded SHA-256, tool and version describe the file there when REA checked it. Say so, with the limit the guide already states for artifact digests: they cannot prove the exact bytes executed if the file changes before the launch. * test(rizin): pin the banner a real Rizin 0.9.1 printed Homebrew's Rizin 0.9.1 prints `rizin 0.9.1 @ darwin-arm-64, package: 0.9.1_2 (Homebrew)`, with a package suffix after the platform. The identity test now uses that banner, so a parser that expects the line to end at the platform fails; the other tests keep the plain form. The test name and the probe comment now say REA runs the path it hashed and reuses a completed probe per launch path and digest, as the guide says since |
||
|
|
5e56bd0a23 |
fix(ghidra)!: load ESP-IDF flash code in Ghidra's default address space (#8464)
* fix(ghidra)!: load ESP-IDF flash code in Ghidra's default address space ESP-IDF's linker script reserves the addresses of .flash.text with the NOBITS section .flash_rodata_dummy. Ghidra 12.1.4's ELF loader gives the default address space to the later section, so .flash.text lands in an overlay that its DWARF import, call-frame processing and default-space references do not reach. Flash functions lose their DWARF signatures, locals and no-return flags, each gets a one-byte shadow function in the reservation, and pseudocode runs past calls such as esp_restart(). The ELF reader now records allocated ranges that an executable section shares with another section, through one section-table visitor that the RISC-V ISA reader also uses. When a NOBITS section starts with one executable section and covers it, the RISC-V lanes commit both sections to the analysis profile. ReaGhidraPrepareElfLoad.java then gives the code the default address space before auto-analysis and keeps the reservation as an uninitialized overlay; bytes, file offsets, symbols, functions and entry points are kept. The session reports the outcome, and any memory map that differs from the committed plan is refused. Images without such an overlap keep their analysis profiles byte for byte. BREAKING CHANGE: RISC-V images with this layout, such as ESP-IDF ESP32-C6, H2 and H21 builds, report flash code at its ELF address (0x42...) instead of .flash.text:0x42..., and their analysis profiles change. RISC-V images with any other section overlap that involves executable code are now refused with the overlapping sections named. These include ESP-IDF v5.5.2 ESP32-C5 and C61 builds, whose second reservation, .ext_ram.dummy, also covers .flash.text. See docs/ghidra-riscv.md. * fix(ghidra): bound the overlap sweep and check the load preparation Domain: - Find section overlaps with one sort and sweep that stops at the second overlap involving executable code, and read the ISA and the overlap in one section-table pass. - Record the two sections that cause a refusal as witnesses. The Ghidra lane owns the refusal text and names them with their ranges. Ghidra lane: - Check the preparation report before the first lazily started analysis call, as for the calling-convention report. - The pre-analysis script removes the code's overlay entry points, checks that no symbol or reference remains in the old overlay range, and reports the counts of the result. Its report echoes the blocks it left, which the client compares with the committed sections. A failed move refuses and rethrows. Reservation labels mark no entry points. - Session limitations no longer state a planned move after a canonical outcome. Verification: - The ESP fixture defines ESP-IDF's absolute text bounds and the reservation's label. The lane checks their addresses, the entry points, file-offset uniqueness and snapshot replay, a reservation-first build, a pre-analysis refusal through analyzeHeadless and a truncated double-float section table. - Boundary tests cover the refusal witnesses, a 10,000-section table and an ELF64 table. * fix(ghidra): retarget references into the moved ESP-IDF flash code The move takes the references from the code's range but not the references into it. Besides the entry points, Ghidra 12.1.4's loader records one data reference from the .flash.text section header to the code, which the new post-condition refused in the RISC-V lane. Retarget plain memory references and entry points into the old range to the moved code; any other kind stays behind and is refused. Removing the reservation block keeps the references into its range, so the pinned symbols' entry points need no re-add. * fix(ghidra): move labels past the ESP-IDF flash code's end with it Ghidra 12.1.4 places a section-relative symbol at the section's end, such as ESP-IDF's _etext, in the code's overlay space one byte past the block. The move covers the block only, so the label stayed in the overlay and ended up in the reservation. Everything in the code's overlay space now follows the code: references are retargeted, labels outside the block are created again in the default space, and the post-condition checks the whole space. The script refuses when another block shares that space. The ESP fixture defines _etext, and the lane checks its address. * fix(ghidra): check prepared blocks by coordinates and address spaces The client compared the pre-script's echoed block names with the ELF section names, although section names are display only: an unnamed section's empty name never matches the name Ghidra gives its block, so that preparation was refused. It also accepted any reported address spaces. The check now compares addresses, sizes and the code's file offset, and requires moved code to go from an overlay into the program's default space while its reservation leaves it, and canonical code to stay there. An unnamed section is labelled by its index. The docs and the pre-script now state that a failure during the move may be refused without its reason, and that an entry mark on a reservation label stays at its default-space address. The docs give the llvm-objcopy route for the refused C5 and C61 builds. The lane checks that no other block maps any of the code's file bytes, and the overlap tests add the C5 and C61 section shape. * fix(ghidra): bound the sections the overlap check keeps The overlap check kept one record per allocated, non-empty section, and only the file size limited their number. NOBITS headers take no file bytes, so a crafted 1 GB ELF32 table holds about 27 million of them. The check now keeps at most 65,280 (SHN_LORESERVE, from which ELF counts sections through section zero) and reports the overlap as unavailable beyond that, which the RISC-V lanes refuse as they refuse a table that cannot be read. * fix(ghidra): check RISC-V handshake reports before any analysis call A RISC-V session that committed neither a calling-convention policy nor a load preparation started its bridge lazily on the first query other than `health`. An `elf_load_preparation` or calling-convention report that the profile did not commit was then never checked, and the query returned its result. Every RISC-V session now starts through the checked handshake, so such a report closes the session before any analysis call, whatever the first query is. A double-float session that reports a preparation, and one that reports a calling-convention policy, are now tested with `list_procedures`; both fail without the fix. Admission, profile parameters and profile digests do not change. If Ghidra exits during the first query of a double-float session, the error now tells the caller to reopen the session, as other checked sessions do. * fix(ghidra): skip analysis after a refused ELF load preparation A refused memory map only wrote the refusal, so headless Ghidra still ran seeds, auto-analysis and post-script analysis on a program that REA then discarded. The preparation now turns off headless auto-analysis when it refuses; later pre-scripts and the bridge still run, so the session reports the reason. The swap also renamed the reservation's overlay space to the section's raw name, so a reservation named like another address space, such as the RISC-V default space ram, or containing characters Ghidra rejects, failed after the move. The space now takes the name Ghidra's memory map derives for an overlay block: ':' and whitespace become '_', and a name in use gains .1, .2 and so on. verify:ghidra:riscv drops -noanalysis from the refusal run and checks that Ghidra analyzed nothing, and a seventh fixture names the reservation ram and checks that it moves into the overlay space ram.1. * test(ghidra): read the load preparation report before Ghidra's log suffix * test(ghidra): pin unchanged RISC-V profiles at main's revisions main's byte-search (#8840), data-type (#8602) and reference revisions change every Ghidra profile. With those revisions reversed, the old pins hold. * fix(ghidra): name the moved RISC-V guide in load-layout diagnostics The overlap refusal, the load-layout limitation and the bridge comments named docs/ghidra-riscv.md, which main moved to docs/providers/. * test(ghidra): check load-preparation facts instead of sentences The refusal, report-check and handshake tests compared whole messages. They now check the sections, coordinates, spaces and counts each message must state, and the handshake compares the session's limitations with ghidraRiscvLoadPreparationLimitations. Rewording the messages passes; dropping a count fails. * fix(ghidra): give the ESP-IDF load preparation unused temporary names The preparation created its temporary blocks as <name>.rea, so a disjoint section already named that refused an otherwise admitted image. It now takes the first unused <name>.rea[.N]. verify:ghidra:riscv gains an esp-edge-names fixture with such a section. * fix(ghidra): keep both final block names free during the ESP-IDF swap The code's temporary block could take the removed reservation's name, such as a reservation named <code>.rea, and the reservation's rename back then collided. The picker now skips both final names. verify:ghidra:riscv's esp-edge-names fixture names its reservation .flash.text.rea beside a disjoint .flash.text.rea.1. * test(ghidra): repin the overlap-free RISC-V digests for main's #8340 main's #8340 bumps call_relationship_coverage from v5 to v7, which changes every Ghidra profile digest. With the revision reverted in place, the old pins hold (79 of 79). * test(ghidra): repin unchanged RISC-V digests for main's value-flow budgets main's #9706 adds native_value_flow_projection to the shared analysis semantics, which changes the profiles of images without a section overlap. With that one revision removed, the previous pins hold (79 of 79). * fix(ghidra): inspect RISC-V PIE section overlaps and refuse an unverified PIE reservation Main admits RISC-V PIE, but this lane requires a section-overlap read that the resolver made only for ET_EXEC, so every PIE was refused. A PIE's section addresses are fixed offsets from its load base, so overlaps do not depend on the base: read them for ET_DYN too. The NOBITS reservation preparation is verified for ET_EXEC only, so a PIE that needs it is refused. Main's producer identity now digests the bridge sources, so the test that compared profile digests with main's is replaced by checking that images without an overlap commit no load preparation. * fix(ghidra): find an ESP-IDF reservation that Ghidra 12.2 marks executable Ghidra 12.2 gives each section block the permissions of the first PT_LOAD that contains its address, so a NOBITS reservation that shares the code's addresses comes out executable and the preparation refused every ESP-IDF image. Tell the reservation from the code by its missing bytes alone; the displaced reservation is still made non-executable. The PIE refusal test now uses the ELF64 lane, which admits PIE. * fix(verify): read the ESP-IDF fixtures' identity where main's #11416 moved it Evidence subjects and snapshot targets now carry their digest under identity, as the rest of the RISC-V verifier reads it. * docs(ghidra): describe the ESP-IDF load layout as verified on Ghidra 12.2 The real RISC-V lane now passes on Ghidra 12.2, whose ELF loader still puts the code in an overlay when its reservation follows it. Name 12.2 where the lane exercised that behaviour, and note that 12.2 can mark the reservation executable. Measurements of Ghidra APIs the lane did not re-check keep their 12.1.4 attribution. * docs(domain): align RISC-V section-overlap JSDoc with ET_DYN inspection --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> |
||
|
|
8730a1d49a | test(filesystem): share invalid file selection assertions (#14313) | ||
|
|
78149eeec9 |
refactor(tests): consolidate repeated CLI capture and fixture construction (#14311)
* refactor(tests): consolidate repeated CLI capture and fixture construction * test(cli): keep overlapping schema and help cases in their existing PR |
||
|
|
609b58b109 |
perf(debugger): stop repeating command results as raw_result (#14146)
* perf(debugger): stop repeating command results as raw_result GDB console/startup, Rizin debug, Cutter and reverse-engineering command Evidence set rawResult to a copy of result, contrary to the raw_result contract. Every interactive debugger reply therefore carried its records and output twice. Omit rawResult where no distinct provider representation exists; tests assert the same facts on normalized_result. Closes #14145 * test(debugger): assert command results on normalized_result in remaining suites The composition, CLI delivery, acceptance and MCP suites still read command output through raw_result, and one fixture built a parent Evidence record that repeated its result as raw_result. They now assert the same fields on normalized_result and that raw_result is null. |
||
|
|
4bbaf17512 |
refactor: centralize owned finalization and configuration failures (#14071)
* refactor(config): propagate typed configuration failures * refactor(lifecycle): centralize completion and cancellation * fix(config): preserve Hermes YAML edit refusal guidance |
||
|
|
71cea564fb | fix(v8): preserve verified code cache results and require exact payload reads (#14067) | ||
|
|
a5f735c67b | fix(devicetree): validate retained report ranges and coverage (#14066) | ||
|
|
4ff98b84fb | fix(python): validate marshal coverage and consolidate pyc tests (#14036) | ||
|
|
6848409879 | refactor(ports): unify 4 misplaced request ports into RequestAnalysisPort and deduplicate PcapAnalysisService (#13816) | ||
|
|
a4f9c2309b |
fix(elf): respect compressed note storage across inspectors (#13762)
* fix(elf): respect compressed note storage across inspectors * test(elf): preserve independent hardening note failures |
||
|
|
9d64f92f16 |
perf(entropy): count selected bytes once and honor admission cancellation (#13660)
* fix(entropy): stop after cancelled file admission and strengthen census proof * perf(entropy): count selected bytes once with a reusable histogram * test(entropy): align lifecycle coverage with current tests |
||
|
|
3c74128353 |
fix(flutter): distinguish Dart snapshot exports from local symbols (#13576)
* fix(flutter): distinguish Dart snapshot exports from local symbols * test(flutter): assert missing snapshot symbol facts |
||
|
|
3b6734bfae |
test(pe): consolidate certificate parsing and public error proofs (#13565)
* test(pe): consolidate certificate parsing and public error proofs * test(pe): keep lifecycle coverage linked to the BER proof |
||
|
|
07df0f1c04 |
fix(ci/tests): bound untyped oxlint threads and fail fast on terminal POSIX poll errors (#13447)
* fix(ci/tests): bound untyped oxlint threads and fail fast on terminal POSIX poll errors * style(tests): format POSIX observation polling * fix(ci): pass REA_OXLINT_THREADS and GITHUB_ACTIONS through Turbo lint and format |
||
|
|
7fc333ffa0 |
fix(elf): retain authenticated debug-link evidence on interruption (#13437)
* fix(elf): retain authenticated debug-link evidence on interruption * test(elf): refresh debug-link lifecycle coverage references |