mirror of
https://github.com/morluto/rea.git
synced 2026-11-29 18:06:46 +00:00
3970afecc6fc3a952e10ec0db4cc21fa6cb7a71d
102
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
3970afecc6 |
feat(artifacts): inventory Nintendo Switch NSO and NRO executables offline (#14655)
* feat(artifacts): inventory Nintendo Switch NSO and NRO executables offline Detection uses the bytes: NSO0 at the start of the file, or NRO0 at offset 0x10. Inventory records the module id, flags, and MOD0 offset, lists the text, rodata, and data segments, and for an NRO adds the ASET icon, NACP, and RomFS when that trailer is present. Compressed NSO segments are raw LZ4 blocks decoded under artifact_limits.expanded_bytes, with the stored size and the decoded size both reserved before allocation, and hash_status is match, mismatch, not-checked, or unavailable. Truncated, over-budget, and invalid-LZ4 entries stay listed while their bytes are refused, and a positional reader can stream those decoded bytes instead of the stored file range. * fix(artifacts): keep valid NRO assets when one ASET range is unsafe * docs: move the Switch executables guide under guides/firmware * Address review feedback * Address review feedback * fix(artifacts): unify Switch NSO budget admission and test deadlines - Remove the duplicate NSO decoded-only budget pre-check in #prepareNso so #admitStoredInput owns all compressed-segment admission and reports an accurate required_value covering both stored and decoded bytes. - Use testWaitDeadline() in SwitchExecutableArtifactReader.boundaries.test.ts instead of a hardcoded 2_000 ms timeout. - Reuse tests/fixtures/lz4LiteralBlock.ts in switchExecutable.fixture.ts. * test(domain): throw typed parse errors in Switch parser tests and fix doc formatting --------- 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> |
||
|
|
51b3671b08 |
feat(artifacts): inventory Nintendo DS ROM binaries, overlays and file tables offline (#14664)
* feat(artifacts): inventory Nintendo DS ROM binaries, overlays and file tables offline Recognition now claims a Nintendo DS ROM from the cartridge header: stored logo CRC 0xCF56, unit code 0, 2, or 3, an ARM9 offset after the header, and a matching logo-area or header CRC. Inspection records those header facts on the root and lists arm9.bin, arm7.bin, overlays/<cpu>/overlay_<id>.bin, FNT-named data/<path> files, and unnamed fat/<id>.bin files as stored byte ranges. A checksum mismatch, a partial table, or a range past the end of the file leaves coverage unknown. Secure-area encryption, compressed overlays, and NitroARC archives stay undecoded, and the format is registered for inventory, extraction, and the docs. * docs: move the Nintendo DS ROM guide under guides/firmware * Address review feedback * Address review feedback * Address review feedback * fix: Compare NDS entry addresses and overlay facts * fix(artifacts): bound NDS path expansion and enforce expanded_bytes * fix(artifacts): omit NDS format declaration for ordinary filesystem files --------- Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> |
||
|
|
04cb70c1a3 |
feat(firmware): inspect uClinux bFLT flat executables offline (#14663)
* feat(firmware): inspect uClinux bFLT flat executables offline The reader matches the bFLT magic on any filename, records the 64-byte big-endian header, and extracts text.bin (header included), data.bin, and relocations.bin while listing relocations as stored words. gzip and gzdata bodies inflate under artifact_limits.expanded_bytes; revision 2 is always stored, and its relocation words stay unchecked because their layout depends on a CPU the header never names. A missing magic or a header shorter than 64 bytes is the only refusal, other inconsistencies are limitations beside the remaining facts, files above 128 MiB are rejected, and the follow-up probe opens the text image as a raw binary with a caller-chosen architecture and entry. * Address review feedback * Address review feedback * fix(firmware): cap bFLT in-memory gzip inflation working memory --------- Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> |
||
|
|
47875ba073 |
fix(native)!: bound Android packed relocations with max_structure_bytes (#14788)
BREAKING CHANGE: Oversized Android APS2 packed relocation tables in inspect_native_initializers now project a memory/adjustable_budget refusal (boundary max_structure_bytes with details.limit) instead of capacity/fixed_ceiling (native-index-capacity). |
||
|
|
4edb2c08ee |
fix(artifacts): explain ASAR PE signed-after-packing mismatches (#14702)
* fix(artifacts): explain ASAR PE signed-after-packing mismatches When an unpacked PE companion fails ASAR integrity only because Authenticode was applied after packing, record a verifiable signing_explanation on the SHA-256 contradiction and error details instead of an opaque untrusted mismatch. Bytes stay observed-untrusted; any other mutation remains an unexplained contradiction. Fixes #7212 * fix(artifacts): address signed-after-packing Greptile review Catch ParseFailureError so unreadable PKCS#7 keeps the digest explanation, share WIN_CERTIFICATE structural walks, index signer lookups, charge optional reads to acquisition budgets with reported skips, preserve mismatch details through cleanup failures, and inherit the shared MCP test deadline. * fix(pe): walk WIN_CERTIFICATE entries lazily under max_entries Convert the certificate-table walker into a generator so inspection stops at the entry budget without materializing every range, and reconstruction can validate structure with constant memory. |
||
|
|
192177f0c9 |
feat(artifacts): inventory and expand Android sparse images offline (#13244)
* feat(artifacts): inventory and expand Android sparse images offline * chore(schemas): update artifact tool schema summaries for the sparse image limit * fix(artifacts): retire undrained sparse image streams on cancellation * fix(artifacts): keep large RAW reads in the sparse stream's owner A large RAW run was streamed through a nested readFileHandleChunks Readable, which could prefetch a descriptor read while the outer iterator was idle, so close or cancellation could retire the stream with that read still running. Read the run directly in the expansion iterator so every read is pending in the owner that cancellation waits on, and add held-read close and cancellation regressions. * fix(firmware): drop unused ANDROID_SPARSE_MAGIC_BYTES export * test(artifacts): release held sparse reads before restoring mocks Release the held RAW read and join the retiring close or cancellation in finally before restoring the read spy, so a failed assertion cannot leave reader.close() waiting on a read nobody will finish. Use awaitAcknowledgement for the held-read start barrier and drop the per-test five-second timeouts in favor of the shared test deadlines. * fix(lint): register sparse-image forwarded fixed ceiling Upstream main added the fixed-ceiling registry check. The sparse-image reader projects the parser's own named ceiling, so register it as forwarding like the boot-image reader. * Address review feedback * test(android-sparse): expect partial code for chunk budget refusal * test(android-sparse): expect partial code in MCP chunk budget refusal * fix(artifacts): keep the chunk_sz offset when a RAW chunk outgrows its header --------- Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: Matt Van Horn <mvanhorn@MacBook-Pro-10.local> |
||
|
|
a00511e88e |
fix(mcp): paginate tools/list under the FastMCP SSE limit (#9142)
* fix(mcp): paginate tools/list under the FastMCP SSE limit Unsloth's FastMCP client rejects the single tools/list event because the full 241-tool catalog serializes to about 4.2 MB, over its 1 MiB SSE cap, so every refresh fails. The MCP SDK returns the whole catalog with no nextCursor, and the server never handled the cursor at all. Page oversized listings at the transport seam, per the MCP cursor contract: pages stay under 896 KiB, cursors are bound to the catalog snapshot, and catalogs that fit are returned in one response as before. * fix(mcp): track pending tools/list requests in one map pendingToolListCursors already held every tools/list id, including requests without a cursor. Membership, cancellation, and cleanup now use that map. Cursor rejection tests assert JSON-RPC -32602, then a cursorless listing returns the complete current catalog. * fix(mcp): count one schema discovery per tools/list pagination The paged tools/list turns one logical discovery into several wire requests, which broke the artifact verifier probe's per-request counting and its duplicate injection assumed the target tool on the first page. Count one discovery per listTools call and inject the duplicate only on the page carrying the tool. * fix(mcp): bind tools/list cursors to full tool definitions A cursor digest now covers each advertised tool, so a schema change invalidates it. One tool larger than REA_MCP_TOOLS_LIST_PAGE_BYTES fails with a resource_constraint error instead of a successful page. * test(doctor): keep the configuration table within its line limit The page-budget refusal stays covered by the setting parser tests. * fix(mcp): honor the tools/list page budget on the stdio path and register the setting Register REA_MCP_TOOLS_LIST_PAGE_BYTES in the numeric limit registry and the limit inventory so the numeric limit check passes. Carry the parsed page budget from AppConfig into DeferredEvidenceMcpServer so the default stdio startup path honors the setting instead of always using the 917504-byte default. Harden the page budget parser tests to surface the parse error instead of returning early on failure. * fix(mcp): return a fitting final tools/list page and use the parsed page budget verifiedPage returns the remaining tools as one final page without a cursor when they fit, instead of failing a resumed listing whose first tool plus a cursor exceeds the budget. parseConfig builds the page budget from parseEnvironment's admitted number instead of re-parsing the raw environment, and the now-unused resolveMcpToolsListPageBudget helper is removed. * fix(mcp): use shared isRecord in tools/list pagination Static checks flagged the local record predicate in toolListPagination.ts: import the shared isRecord from src/domain/isRecord.ts instead. The numeric-limit registry test still expected 15 entries after the REA_MCP_TOOLS_LIST_PAGE_BYTES entry was added; bump it to 16. * test(mcp): page tools/list fixtures under explicit small budgets The compact-only presentation strips field descriptions before advertising, so the 80-tool catalog fits one page and the oversized tool fits too. Set explicit small page budgets against the advertised size. The parseConfig success test now throws the typed error before reading the value, per the test guide. * test(config): throw typed parse errors in tools/list budget test Greptile P2 on #9142: the budget test checked the selected parse via an inline toMatchObject on the Result, hiding the typed error on failure. Bind both parse results and throw their errors before asserting values, per the repo test guide. * fix(mcp): format tools/list pagination test to repo style oxfmt --check flagged src/server/toolListPagination.test.ts (the cursor-identity expectation was written expanded; oxfmt collapses the two-element array onto one line). No behavior change. * style(mcp): oxfmt the page-budget assertion The Greptile P2 fix re-wrapped the expect call past oxfmt's width; run the pinned formatter so Static checks stays green. * fix(mcp): use the shared sha256Hex helper for the tools/list catalog digest The architecture guards forbid a second one-shot SHA-256 hex digest; use the shared helper from src/kernel/sha256Hex instead. * fix(mcp): build the tools/list page-budget refusal through the shared owner helper The architecture guard counts hand-built AnalysisResourceConstraintError constructions; toolsListPageBudgetError() held the only new copy. The refusal cause is a page budget, not a parse limit, so parseLimitConstraint does not fit. Add toolsListPageBudgetConstraint() beside it in parseFailureAnalysisError.ts and build the refusal from the page-budget facts there; the produced error is unchanged. Also give the pagination test SDK client the shared schema validator from createMcpSchemaValidation, released with the client. * fix(server): adapt instructions call to the predicate API Main changed serverInstructions to take an advertisesTool predicate instead of a tool-family set, and RecordedMcpCatalog gained required toolFamilies and promptRequirements fields. The merge head no longer typechecked, failing Build package, Documentation and Static checks. Adapt the call site to main's own adapter shape and add the two empty fixture fields. * fix(mcp): restore main's tool-family scope in deferred startup The merge dropped the family scoping main added to the deferred startup path. A scoped stdio start advertised every recorded tool and saved the full catalog identity, so attachRuntime rejected the selected identity on first use. Restore the toolFamilies option, scoped capabilities/instructions/identity, and the shared helper through runDeferred and the deferred constructor. * fix(mcp): share page limit facts and stream catalog sizing --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Vincent Koc <vincentkoc@ieee.org> |
||
|
|
9cb0aa328b |
feat(cli): retain over-budget partial observations from failed CLI runs (#14693)
* feat(cli): retain over-budget partial observations from failed CLI runs When a failed CLI command carries an over-budget partial observation without --evidence_output, retain the complete partial Evidence in the private retained-Evidence cache instead of dropping it to a rerun-only fallback. - Pass the composed source closure into budgetFailurePartialEvidence so cited source records are written into the retained bundle alongside the partial observation. - Report the retained path, byte size, and record_sha256 under details.diagnostics.evidence_bundle, set details.partial_observation_delivery to retained: "cache-file" with a paging cursor, and keep all failure facts (code, message, failure_kind, retryable, remediation, limits, existing diagnostics) unchanged. - Honor --no-retain and REA_CLI_RETAINED_EVIDENCE_BYTES=0, fall back to retained: "not-retained" with rerun arguments and redacted retention_failure on uncommitted write errors, preserve the original failure and committed cache receipt on post-commit staging cleanup failures, and keep cancelled failures on the no-publication contract. - Document the behavior in docs/reference/limits-and-recovery.md and add boundary and CLI acceptance tests. Fixes #14618 * fix(cli): preserve pre-commit cleanup ownership and surviving oversized cache receipts Address two gaps in the shared retainOverBudgetEvidence path that affected both successful (deliverRetainedSummary) and failed (budgetFailurePartialEvidence) CLI retention: - Preserve pre-commit writer errors whose staging cleanup stayed incomplete (including exists failures with unfinished cleanup), reporting cleanup_incomplete and remaining resources via projectFailure on successes and via refusedPartialPublication (keeping execution_failure and complete inline partial_observation) on failures. - When removing an oversized retained cache bundle fails (fileRemains), carry the surviving file metadata through RetentionStop.remainingFile, record the complete receipt (path, bytes, record_sha256), and report retained: "cache-file" with its paging cursor and retention_failure instead of a not-retained fallback. - Simplify refusedPartialPublication back to a plain delivery value now that retainOverBudgetEvidence tracks the attempted cache path directly. - Add public CLI tests for both paths (success and failure) using evidencePublicationPreload.mjs and update docs/reference/limits-and-recovery.md. * fix(cli): key retained bundles by complete source closure * chore(format): format retained evidence publication * fix(cli): canonicalize retained bundle cache keys * test(cli): compare retained bundle bytes directly --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org> |
||
|
|
b33b8e8ce6 |
docs(browser): describe comparing retained captures
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
05e5c91526 |
fix(limits): apply producer.output_bytes within each producer's maximum (#14668)
* fix(limits): apply producer.output_bytes within each producer's maximum decode_android_resources and inspect_asset_catalog ignored the session output setting because their defaults and maxima differ from the shared 4 MiB default. An unset setting still uses 4 MiB and 64 MiB. An explicit runtime value or REA_PRODUCER_OUTPUT_BYTES supplies the omitted field and is clamped to each producer's maximum. A per-call value still wins. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(limits): show above-cap producer output settings are reduced A runtime override or REA_PRODUCER_OUTPUT_BYTES above a producer's maximum is enforced as that maximum. Apktool's capture budget and assetutil's refusal both report the reduced value. 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> |
||
|
|
155715942e |
fix(limits)!: budget Rust dependency parser ceilings per call (#14666)
* fix(limits)!: budget Rust dependency parser ceilings per call inspect_rust_binary refused a compressed .dep-v0 stream or its inflated JSON with one fixed parser allowance. Those ceilings are now the per-call parameters max_compressed_dependency_bytes (1 MiB), max_inflated_dependency_bytes (8 MiB) and max_dependency_inflate_ratio (64). A refusal is adjustable_budget and names the parameter that stopped the parse. Allocation before the consumed length is known uses the stored extent, including PE alignment padding. Omitted fields keep the previous defaults. BREAKING CHANGE: Rust dependency-parser refusals report details.limit for the binding parameter instead of a fixed_ceiling allowance. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(rust): admit dependency sections above the former ceilings A stored section larger than 1 MiB and 8 MiB is refused at those defaults and parsed once both budgets are raised. A stream that inflates more than 64 times is refused at the default ratio and parsed once the ratio is raised. 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> |
||
|
|
0eb19a395e |
fix(limits)!: let apktool and assetutil take producer_limits.output_bytes and type Android and process capture refusals (#14624)
* fix(limits)!: let apktool and assetutil take producer_limits.output_bytes and type Android and process capture refusals decode_android_resources and inspect_asset_catalog refused larger apktool or assetutil output with a fixed capture ceiling. Both now accept producer_limits.output_bytes (defaults 4 MiB and 64 MiB) and report details.limit for it. assetutil's budget covers each stream and the JSON retained across catalogs, capped at 128 MiB for the in-process decode. capture_process's retained-frame refusal reports details.limit for limits.output_bytes, and a JADX JVM heap failure is marked as measured exhaustion. The lipo field-retention allowance is reclassified as derived from the native command output capture, and the JADX external DEX representation allowance as protocol (a fraction of the bridge's local MCP frame). BREAKING CHANGE: apktool and assetutil output refusals report details.limit for producer_limits.output_bytes instead of a fixed_ceiling refusal. * test(apktool): decode raised output after the default refuses it, and check deadlines leave the output budget unchanged * fix(resources): keep a file-size refusal's observed size through failure rebuilds |
||
|
|
4c9dca63a0 |
feat(native)!: give the Go and Rust readers max_structure_bytes and Rust max_wasm_sections (#14661)
* feat(native)!: give the Go and Rust readers max_structure_bytes and Rust max_wasm_sections inspect_go_binary and inspect_rust_binary read the ELF directory and Mach-O load commands through the shared container reader with the fixed 16 MiB structural allowance. Both now accept max_structure_bytes, threaded through readBinaryContainerFromReader. inspect_rust_binary's fixed 65,536-section WebAssembly walk becomes max_wasm_sections (default 65,536, at most 16,777,216). Refusals report details.limit and the generated recovery. The Go budget refusals drop their authored prose and always report their limit, so a value at its maximum gets the generated narrowing advice. Part of #14235. BREAKING CHANGE: Go and Rust structural refusals and the WebAssembly section refusal report details.limit instead of a fixed_ceiling refusal. * chore: refresh the Go and Rust advertised schema summaries * test: keep the Rust section-walk admission check type-correct * refactor(native): own the max_structure_bytes refusal in the native domain The Go and Rust providers may not import src/native, so nativeStructureConstraint moves to src/domain/native/nativeStructureBudget.ts next to the limit it builds, and every provider imports it from there. * fix(native): report the effective Go structure budget and document max_wasm_sections The Go limitation text named a fixed 16 MiB structural bound after a caller could raise it; it now names the effective max_structure_bytes. The Rust guide and MCP boundary test describe max_wasm_sections as a per-call control, and the admission test requires a raised value to succeed. * fix(native): report the effective Go structure budget and Rust section control Go inspection limitations named a fixed 16 MiB structural bound after max_structure_bytes selected another value. The report now uses that effective budget, including the shared default when the field is omitted. Rust WebAssembly section refusals are an adjustable max_wasm_sections budget. The MCP expectation, the Rust guide, and the CLI and MCP checks follow that control, and a raised budget must admit the same module. * style(rust): format the section-walk CLI assertion oxfmt rejects the wrapped cast in the CLI recovery check. Static checks run format:check, which check:fast does not. 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> |
||
|
|
6ae722a660 |
feat(limits)!: register producer.output_bytes as the session default for bounded producer output (#14648)
* feat(limits): register producer.output_bytes as the session default for bounded producer output inspect_packet_capture, decode_signal_recording and inspect_signal_decoders share BOUNDED_PRODUCER_LIMITS, and an agent decoding several large captures or recordings raised producer_limits.output_bytes on every call. The registered setting producer.output_bytes (seed REA_PRODUCER_OUTPUT_BYTES, default 4 MiB) now supplies the omitted field. A per-call value wins, then the runtime override, then the seed, then the default. An output refusal reports the setting's limit with its parameter and source, so the generated recovery names both routes. * fix(limits): refuse an invalid producer output seed after retained cleanup, forward it through setup, and cover the seed |
||
|
|
0aca049128 |
feat(native)!: give the PE readers per-call text, entry and metadata budgets (#14659)
* feat(native)!: give the PE readers per-call text, entry and metadata budgets inspect_pe_imports refused at a fixed 16 MiB of retained names, inspect_pe_unwind_ranges at a fixed 2,097,152 exception-directory entries and inspect_pe_resources at a fixed 8 MiB result. They now accept max_text_bytes (default 16 MiB, at most 256 MiB), max_entries (default 2,097,152, at most 16,777,216) and max_metadata_bytes (default 8 MiB, at most 256 MiB). The DLL, function and TLS callback refusals report details.limit for max_dlls, max_functions and max_callbacks instead of authored recovery, and an unwind refusal reports the declared entry count as required_value. The shared PE failure projection no longer maps an unnamed BinaryResourceFailure to "The PE structural decoding allowance": no PE reader produces one, since PE header and section tables are bounded by the format. Part of #14234 and #14235. BREAKING CHANGE: the PE retained-text, exception-directory entry and resource metadata refusals report details.limit instead of a fixed_ceiling refusal. * fix(native): update PE advertised schema summaries, test types, and assert retry success * test: compare PE resource refusals across adapters with each adapter's control spelling * test: avoid shadowing the CLI fixture in the PE resources parity check |
||
|
|
4d3fa5a080 |
feat(native)!: give inspect_native_exports per-call inventory, text and structure budgets (#14658)
* feat(native)!: give inspect_native_exports per-call inventory, text and structure budgets The native export reader refused at a fixed 262,144-row inventory, a fixed 16 MiB retained-text allowance and the fixed 16 MiB structural allowance. It now accepts max_entries (rows and declared symbol counts; default 262,144, at most 4,194,304), max_text_bytes (default 16 MiB, at most 256 MiB) and max_structure_bytes, which now also bounds the ELF dynamic, symbol and version tables located through PT_DYNAMIC. The parser threads one NativeExportBudgets object through the ELF and PE paths and elfDynamicExportTables; the Android JNI reader keeps the defaults. Refusals report details.limit and the generated recovery. A declared table count is reported as required_value; the text budget stops at the first excess and reports none. Part of #14235. BREAKING CHANGE: export inventory and retained-text refusals report details.limit for max_entries or max_text_bytes instead of a fixed_ceiling refusal, and MAX_NATIVE_EXPORT_ROWS is renamed DEFAULT_NATIVE_EXPORT_ROWS. * chore: refresh the inspect_native_exports advertised schema summary * fix(native): omit lower-bound GNU hash required_value, decouple version work from max_entries, and update export recovery tests * test: expect the lower-bound marker on a stopped GNU hash chain walk * fix(native): cap ELF version traversal work and aggregate malformed version definition diagnostics |
||
|
|
31297470ef |
feat(artifacts): back archive member counts with the artifact.member_count setting (#14650)
* feat(artifacts): back archive member counts with the artifact.member_count setting Archive member, entry, module and asset counts are the reader limit an agent is most likely to raise repeatedly in one session. A new runtime setting, artifact.member_count (launch seed REA_ARTIFACT_MEMBER_COUNT, default 100,000), now supplies the default for artifact_limits bun.module_count, dotnet_bundle.entry_count, node_sea.asset_count and deno.vfs_entries. An explicit artifact_limits field still wins for that call. A refusal at one of those fields reports the setting's limit with the field as parameter and the value's source, so its recovery names the per-call field and update_analysis_settings (or the launch seed on the CLI). When a non-default session value applies, Evidence reports the resolved effective_limits. * test(artifacts): cover the artifact.member_count session route over stdio MCP update_analysis_settings at 1 refuses a two-entry .NET bundle with the setting, source runtime and both recovery routes; an explicit artifact_limits field wins over the session value; raising the setting to 2 admits the same bundle. * fix(artifacts): resolve caller member counts before the session seed When a call selects every field artifact.member_count backs, the session value and its launch seed are no longer read, so an invalid REA_ARTIFACT_MEMBER_COUNT cannot block an explicit per-call recovery; a request-sourced refusal still names the setting. The setting now lists inventory_artifact, which it also applies to. * fix(config): own the artifact.member_count seed outside the runtime settings module Resolving the seed through launchAnalysisSetting made runtimeAnalysisSettings import the launch schema map, which imports modules that import runtimeAnalysisSettings; the cycle left the bridge reply schema uninitialized in some load orders. The seed now has its own owner, src/config/artifactMemberCount.ts, like the pwntools input seed, and the definition names its environment variable literally as the numeric-limits guard requires. |
||
|
|
1badb6a8ae |
fix(native)!: report details.limit for remaining native reader budgets and make BEAM table rows adjustable (#14631)
* fix(native)!: report details.limit for native reader per-call budgets Devicetree, Windows shortcut, kernel build config, firmware staging and byte-entropy refusals of caller-selected budgets named their control only in remediation prose. Each now sets details.limit from a domain-owned budget object that also builds the schema (src/domain/parameterBudget.ts), so the reported range is the one the next call accepts. inspect_devicetree's fixed 32 MiB decoded representation allowance becomes the per-call max_decoded_bytes (default 32 MiB, 1 KiB to 256 MiB); its refusal reports boundary max_decoded_bytes instead of decoded_bytes. The pwntools allocation failure declares measuredExhaustion, the firmware inherited RLIMIT_FSIZE refusal declares measuredExhaustion, and the LLDB combined-result ceiling is a registered representation bound. Part of #14234 and #14235. BREAKING CHANGE: inspect_devicetree's decoded-representation refusal reports reported_limits.boundary "max_decoded_bytes" with details.limit, instead of "decoded_bytes". * fix(native): keep FIT decoded-budget boundary, LLDB narrowing and entropy length range exact The FIT reader compared the renamed devicetree limit against decoded_bytes, so a decoded-budget refusal became capacity; it now checks max_decoded_bytes, with a test. The LLDB representation ceiling keeps a short name and carries its recovery as narrowing. The byte-entropy length maximum is the window the selected block_size admits. * fix(cli): describe inspect-devicetree --max-decoded-bytes * refactor(native): let the generated adjustable-budget recovery name the native reader controls With #14625 the refusal owns per-call recovery, so the devicetree, Windows shortcut, kernel build config, firmware staging and byte-entropy refusals drop their authored sentences. inspect_byte_entropy reports the smallest admitting block_size as required_value. * fix(native)!: report details.limit for remaining native reader budgets and make BEAM table rows adjustable inspect_elf_dependencies, inspect_elf_unwind_ranges, inspect_apple_ips, inspect_dwarf_units, inspect_native_initializers and inspect_pe_resources named their per-call budgets only in remediation prose. Each now reports details.limit from a domain-owned budget object that also builds the schema. The unwind per-page symbol-name text refusal names the page size `limit`, the control that admits it. The fixed 65,536-row BEAM table ceiling becomes the per-call max_table_rows (default 65,536, at most 1,048,576). The plist nesting allowance is reclassified as a representation bound (MAX_JSON_DEPTH less the report envelope). GPU and APK input refusals that named their fixed allowances only in prose now declare them, registered as pending #14235. Part of #14234 and #14235. BREAKING CHANGE: a BEAM table-row refusal reports details.limit for max_table_rows instead of a fixed_ceiling refusal. * fix(native): keep naming the dependency and BEAM row controls in recovery * refactor(native): let the generated adjustable-budget recovery name the remaining native controls With #14625 the refusal owns per-call recovery, so the ELF dependency, ELF unwind, Apple IPS, DWARF, initializer, PE resource and BEAM refusals drop their authored sentences. BEAM reports the complete row and atom counts as required_value. The unwind per-page text allowance is a registered fixed allowance whose narrowing names a smaller limit, because a larger page would not admit it. * style: format the PE resources provider test * refactor(native): keep one owner of the IPS budget bounds and document the unwind text allowance |
||
|
|
49187f1ab3 |
fix(limits): omit required_value when PE/native read budgets know only a lower bound (#14645)
The reads counted before a read-budget refusal are a lower bound: later reads depend on structures not yet decoded, so retrying at that value can refuse again. Keep the bound in reported_limits.required_read_bytes and report no required_value, which promises the smallest admitting value. |
||
|
|
50d13f9f08 |
fix(native)!: report details.limit for native reader per-call budgets (#14622)
* fix(native)!: report details.limit for native reader per-call budgets Devicetree, Windows shortcut, kernel build config, firmware staging and byte-entropy refusals of caller-selected budgets named their control only in remediation prose. Each now sets details.limit from a domain-owned budget object that also builds the schema (src/domain/parameterBudget.ts), so the reported range is the one the next call accepts. inspect_devicetree's fixed 32 MiB decoded representation allowance becomes the per-call max_decoded_bytes (default 32 MiB, 1 KiB to 256 MiB); its refusal reports boundary max_decoded_bytes instead of decoded_bytes. The pwntools allocation failure declares measuredExhaustion, the firmware inherited RLIMIT_FSIZE refusal declares measuredExhaustion, and the LLDB combined-result ceiling is a registered representation bound. Part of #14234 and #14235. BREAKING CHANGE: inspect_devicetree's decoded-representation refusal reports reported_limits.boundary "max_decoded_bytes" with details.limit, instead of "decoded_bytes". * fix(native): keep FIT decoded-budget boundary, LLDB narrowing and entropy length range exact The FIT reader compared the renamed devicetree limit against decoded_bytes, so a decoded-budget refusal became capacity; it now checks max_decoded_bytes, with a test. The LLDB representation ceiling keeps a short name and carries its recovery as narrowing. The byte-entropy length maximum is the window the selected block_size admits. * fix(cli): describe inspect-devicetree --max-decoded-bytes * refactor(native): let the generated adjustable-budget recovery name the native reader controls With #14625 the refusal owns per-call recovery, so the devicetree, Windows shortcut, kernel build config, firmware staging and byte-entropy refusals drop their authored sentences. inspect_byte_entropy reports the smallest admitting block_size as required_value. |
||
|
|
a5c71e8c88 |
fix(limits)!: let inspect_sqlite_database take producer_limits.input_bytes and type SQLite, Kuna and web-bundle refusals (#14627)
* fix(limits)!: let inspect_sqlite_database take producer_limits.input_bytes and type SQLite, Kuna and web-bundle refusals The SQLite snapshot refused a database and WAL above a fixed 256 MiB. The copy streams to private disk, so inspect_sqlite_database now accepts producer_limits.input_bytes (default 256 MiB) and reports details.limit for it. Refusals that carried recovery only in prose are typed: SQLite's result-column limit and the 16 MiB value/statement/reply allowance as fixed ceilings, occupied SQLite slots and live Kuna and web-bundle heap headroom as measured exhaustion, and the Kuna cache capacity as the REA_KUNA_CACHE_MAX_BYTES environment control. The SQLite worker diagnostic capture is reclassified as protocol. BREAKING CHANGE: the SQLite snapshot refusal reports details.limit for producer_limits.input_bytes, and the SQLite column and reply refusals carry a fixed_ceiling refusal in place of their authored remediation. * fix(sqlite): keep producer_limits in Evidence parameters and report the effective input bound |
||
|
|
78cb7172a6 |
feat(limits)!: report the value a per-call limit needs and derive its recovery (#14625)
* feat(limits)!: report the value a per-call limit needs and derive its recovery A per-call parameter limit (`control_kind: "parameter"`) now carries an optional `required_value`, and its refusal projects the typed `adjustable_budget` under `details.refusal` with `control`, `default_value` and `required_value`. The refusal owns the recovery: "Pass a larger <parameter> on the next <operation> call (at least N; range a..b), then retry", or a narrower request when the control is at or below the need's maximum. The CLI renders the step with the command's flag and command. ELF notes and debug-link, pcap producer limits, PE/native read budgets and WASM artifact paths drop their duplicate authored recovery and report the measured need where they compute it. BREAKING CHANGE: per-call parameter refusals gain `details.refusal`, and their `remediation.action` wording changes to the generated form. * feat(limits): offer the session setting beside a setting-backed per-call limit The adjustable_budget recovery is now rendered from its details.refusal facts alone (which gain `source` for settings), so the CLI parses those facts and re-renders the recovery with its flag and command instead of matching display text; authored recovery is never rewritten. A per-call control backed by a registered setting names both routes: the next call, then the setting through update_analysis_settings, or its launch environment variable for a one-invocation caller. Per-call-only controls keep one route. inspect_wasm_artifact reports the larger of its oversized selection counts as required_value, so one retry admits both fields. * refactor(limits): render refusal recovery once in the delivering adapter's spelling Refusal recovery is rendered at projection in the spelling of the adapter that delivers it: MCP names the contract field and tool; a CLI command binds its own spelling (flag or JSON-option path, rea <command>, launch environment route) around its run. Authored recovery never reaches the renderer, so nothing distinguishes it by text. The CLI no longer re-parses details.refusal or rewrites the generated sentence; the prefix-matching rewrite and its fact schema are removed. * test: expect the typed refusal for Flutter APK and NTFS per-call limits Per-call parameter limits now carry details.refusal; these tests landed on main asserting its absence. |
||
|
|
e540cbdafd |
feat(native)!: give the native structural decoding allowance a per-call max_structure_bytes (#14626)
* feat(native)!: give the native structural decoding allowance a per-call max_structure_bytes The 16 MiB structural budget on native header, section, load-command and ELF dynamic-directory table reads, and on decoded section names, was a fixed ceiling with no override. inspect_elf_unwind_ranges, inspect_kernel_module, inspect_elf_debug_link, inspect_dwarf_units, inspect_binary_hardening and inspect_native_initializers now accept max_structure_bytes (64 bytes to 512 MiB, default 16 MiB) and report details.limit when it stops them. binaryContainer owns the default, the limit name and the failure (nativeStructureFailure); the directory readers take a NativeDirectoryBudgets object in place of the positional decoded-name budget, and Mach-O, the ELF dynamic directory and the ELF pointer relocation pass take the same budget. Other allowances that shared the "structure" limit name now carry their own: the PE per-name decode, the retained DWARF section bound (derived from the admitted image), and the hardening table-entry count. The ELF dependency provider's structural projection was unreachable and is removed. Part of #14235. BREAKING CHANGE: refusals at the structural budget report reported_limits.boundary "max_structure_bytes" instead of "structure". * fix(native): apply max_structure_bytes to the ELF hardening dynamic table and scope its help inspect_binary_hardening read PT_DYNAMIC under its entry count only, so a sectionless ELF could exceed the selected max_structure_bytes; the dynamic table is now checked first. The shared help no longer names tables a reader does not bound, and the limits reference states hardening's Mach-O and PE coverage. The initializer CLI recovery test asserts a parsed successful report. * fix(native): refuse a partial ELF hardening dynamic table as malformed before its budget |
||
|
|
3dae567185 |
feat(artifacts)!: give Deno, wxapkg and tar readers artifact_limits controls (#14620)
* feat(artifacts)!: give Deno, wxapkg and tar readers artifact_limits controls Deno compile, wxapkg and tar readers refused large ordinary inputs at fixed allowances with no recovery. Their admission budgets are now per-call artifact_limits.deno, .wxapkg and .tar fields with today's values as defaults, and each refusal reports details.reader_limit. artifact_limits.expanded_bytes now also applies to Deno and wxapkg. The shared artifact path registry names its owning group's path_parts and path_nodes controls instead of a fixed fallback. audit_release_exposure max_file_bytes keeps its 256 MiB default but is no longer capped there; its refusal reports details.limit. The Deno VFS recursion depth is registered as a representation bound and the wxapkg member-I/O allowance as derived from expanded_bytes. BREAKING CHANGE: artifactReaderLimitsSchema now requires deno, wxapkg and tar groups, so saved Evidence whose effective_limits predates them fails validation and must be re-inspected. A release-exposure refusal at max_file_bytes reports details.limit instead of a fixed_ceiling refusal. * fix(artifacts): keep Deno indexed paths representable and omit undercounted retained size artifact_limits.deno.path_parts now has a minimum of 2: indexed fallbacks live under a reserved top-level namespace directory, so a one-part selection could only refuse the whole inspection. The retained-bytes refusal no longer reports a required value, because the bounded byte count stops at the allowance and understates it. |
||
|
|
33e4e07dd0 |
fix(limits)!: report packet and signal producer budgets as details.limit and page discovery at its record budget (#14621)
* fix(limits)!: report packet and signal producer budgets as details.limit and page discovery at its record budget Owned packet and signal producers (inspect_packet_capture, inspect_packet_fields, decode_signal_recording, inspect_signal_decoders) refused an exhausted producer_limits.input_bytes, output_bytes or command_timeout_ms with the control named only in remediation prose. ArtifactAnalysisResources now takes the selected input budget as an AnalysisParameterLimit and the command's selected and default budgets, so each refusal carries details.limit. Packet-field and sigrok decoder discovery refused a page whose records exceeded a fixed representation budget. The budget now ends the page early with has_more and output_window.record_budget_reached, so the rest is retrieved from offset + returned instead of being refused. BREAKING CHANGE: discovery output_window gains record_budget_reached, a page can return fewer than limit records, and discovery no longer refuses at the record or line budget. * test(verify): expect record_budget_reached in real discovery pages |
||
|
|
2bb554e8b0 |
feat(cli)!: keep over-budget CLI results recoverable by default (#14610)
* feat(cli)!: keep over-budget CLI results recoverable by default An over-budget CLI result without --evidence_output now saves its complete Evidence to a private retained-Evidence cache under the user cache directory and returns the summary with the file's path, size and digest, so it pages with inspect-analysis-view without a rerun. Files are named by the complete record's Evidence ID, created exclusively as 0600 by the Evidence bundle writer in a 0700 directory the user owns, reused by repeat runs and never overwritten. Each retention removes records unused for 7 days, then the least recently used over delivery.cli_retained_evidence_bytes (REA_CLI_RETAINED_EVIDENCE_BYTES, default 256 MiB). --no-retain or a 0 setting writes nothing; a record that cannot be kept falls back to the rerun arguments with the reason. Fixes #14594 BREAKING CHANGE: An over-budget CLI result without --evidence_output is now saved to REA's private retained-Evidence cache and reported as {summary, evidence_bundle, delivery} with delivery.retained cache-file, instead of writing nothing. Pass --no-retain, or set REA_CLI_RETAINED_EVIDENCE_BYTES=0, to write nothing as before. * fix(cli): key retained Evidence by its content and keep its owner's facts Review fixes for default CLI retention: - Name files by the SHA-256 of the complete record's exact JSON, since the Evidence ID leaves out caller paths; report it as evidence_bundle.sha256. - Remove a bundle that outgrows the cache after the write. - Renew a record's age when inspect-analysis-view reads it. - Re-check a record's use time before evicting it. - Never use a cache whose path holds a value marked sensitive, and redact retention failure reasons. - Report a save that committed but then failed with its receipt and cleanup owner, as --evidence_output does. - Request source records whenever the cache may receive a bundle. - Refresh the advertised-schema summaries for the new setting. * fix(cli): withdraw the receipt of a bundle the cache discards A bundle that outgrew the cache was removed after the writer had already recorded its publication receipt, so output recovery could name a missing file. Retention now withdraws that receipt whenever it keeps nothing, unless the file committed and its failure is reported. * fix(cli): retain publication receipt when removing an oversized retained bundle fails |
||
|
|
73d6092687 |
feat(delivery)!: budget the partial observation carried by failure results (#14607)
* feat(delivery)!: budget the partial observation carried by failure results A failure's details.partial_observation, the complete Evidence of work that finished before it, now gets the agent result budget's one decision with the budget the rest of the failure leaves. The failure's own facts are never budgeted. When it does not fit, it is replaced by its summary, and details.partial_observation_delivery carries the delivery facts. MCP retains the complete partial Evidence in the session and pages it with the evidence-json cursor; the CLI publishes it to --evidence_output, or names the rerun arguments without one. Fixes #14595 BREAKING CHANGE: When a failure's details.partial_observation does not fit delivery.agent_result_budget_bytes beside the failure's own facts and the caller omitted detail, MCP and the CLI deliver its summary record instead of the complete Evidence, with details.partial_observation_delivery naming where the complete record is. Pass detail complete (--detail complete) for it inline. * fix(delivery): keep a budgeted partial's link and paging call on every path The compact retry for an oversized error encoded with the whole frame budget, so the resource link appended after it could exceed the checked frame; every encoding now reserves the link's bytes. A bundle that committed before its staging cleanup failed delivered the partial's summary without partial_observation_delivery; the refusal now carries the same delivery facts as a successful publication. |
||
|
|
fa65e51a24 |
feat(mcp): link retained Evidence from over-budget summaries (#14603)
* feat(mcp): link retained Evidence from over-budget summaries
An over-budget MCP result now also carries a resource_link to the
complete record its summary replaced. The rea://evidence/{evidence_id}
template reads any record the session retains as its exact JSON, the
same text the evidence-json cursor pages. The cursor stays the recovery
every client can follow.
An ID the session does not retain is not found (-32602). A record too
large for one response gets no link, and a read of it is refused with
the cursor (-32600). The link is named complete-evidence so Claude Code,
which renders it as one line, spends about 67 tokens on it.
Part of #14187
* fix(mcp): offer an Evidence link only when one read can deliver it
The link offer compared the record's unescaped JSON bytes with the frame,
while the read measured the escaped text inside its result, so a linked
record could refuse its own read. The read also never checked REA's
single-string limit, so a frame budget raised above it could let a read
reach the SDK serializer. Both now use retainedEvidenceReadFits, which
bounds the escaped read's UTF-8 bytes and UTF-16 length.
|
||
|
|
f7641050c7 |
feat(views)!: page byte-entropy blocks and runs; budget xrefs and nupkg delivery (#14599)
inspect_byte_entropy's retained summary now lists the first 64 runs in
offset order beside the ten longest, and inspect_analysis_view gains
view {kind: "byte-entropy", collection: "blocks" | "runs", offset, limit},
which pages the retained series by index with a coverage cursor. The
summary's run list is page zero of that view, so both read one selection.
xrefs and inspect_nuget_nupkg gain the delivery detail selector and join
the agent result budget, reusing their existing summary projections and,
for xrefs, native-observation pages.
BREAKING CHANGE: xrefs and inspect_nuget_nupkg with detail omitted now
return their retained summary when complete Evidence exceeds
delivery.agent_result_budget_bytes in a session that can page it. Pass
detail "complete" (CLI --detail complete) for complete inline delivery.
|
||
|
|
c58de7f77e |
fix(mcp): rank multi-word discover_tools queries by matched terms (#14584)
* fix(mcp): rank multi-word discover_tools queries by matched terms * docs(mcp): align discover_tools docs and strengthen ranking tests |
||
|
|
62ae33320a |
fix(views): bound the evidence-json serialization cache (#14588)
* fix(views): bound the evidence-json serialization cache Paging a retained record with the evidence-json view cached its whole chunked serialization in a WeakMap for as long as the parent stayed retained, even for a one-unit page. Nothing counted those copies, so paging many large retained records could exhaust server memory despite successful retention admission. The cache now keeps whole serializations least recently used first, within 16 Mi code units in total. A record that does not fit, and a mutable inline parent, is paged by one streaming pass over jsonParts that keeps only the parts around the requested window, so memory stays bounded by the page. Both paths return identical text and coverage. The limit inventory now links to the agent result budget section instead of repeating its delivery contract. * fix(views): hold cached evidence-json records weakly and test the cache bounds Review on #14588: the module-wide Map kept cached Evidence alive after its ledger released it, and the cache limits were untested. EvidenceJsonSerializationCache now owns the cache. Records are keys of a WeakMap, least-recently-used order is a Set of entries that reach their record only through a WeakRef, and a FinalizationRegistry returns a collected record's code units. The cache therefore never extends a record's lifetime, and its total stays within the configured code units. projectEvidenceJsonView takes the cache, defaulting to the shared one, so tests can size it. New cases cover a retained record that overflows the cache during its scan (pages before and after the overflow match, nothing is cached, and the scan keeps only the window's parts) and LRU eviction across three records. * fix(views): use Budget.chargeEvicting and unregister evicted FinalizationRegistry entries |
||
|
|
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. |
||
|
|
b7f662bd19 |
fix(errors)!: keep only changed reader integrity checks retryable
readerIntegrityFailure turned every reader integrity failure into AnalysisArtifactChangedError, so a session target that no longer matched its admitted digest (admitted-identity) and other non-change checks were reported as artifact_changed with retryable true, though an unchanged retry fails the same comparison every time. It now consults integrityCheckMeansChanged, the owner of that meaning: a changed check stays AnalysisArtifactChangedError, and any other check is an ArtifactOperationError with reason integrity, the reader's integrity_check and its userMessage as message and recovery. ArtifactOperationError's operation is widened to the public operation name so every reader can raise it, with the one classification owner. Sigrok's recording dialect used its own unconditional changed mapping; it now uses readerIntegrityFailure too, and also keeps the named check. Every artifact_changed projection now carries the changed kind's retry hint, not only the ArtifactOperationError producer. BREAKING CHANGE: inspect_plist, inspect_apk_signature, inspect_ntfs_journal, inspect_api_contract, audit_release_exposure, inspect_web_network_capture, inspect_playwright_trace, inspect_packet_capture, inspect_packet_fields, inspect_gpu_code_objects, inspect_model_artifact, inspect_native_dispatch_metadata, inspect_macho, list_architectures, inspect_sqlite_database, sigrok recording operations, Android mapping reads and the shared provider classifier report a non-change integrity check (for example admitted-identity) as artifact_operation_failed, category integrity_mismatch, retryable false, with details.reason "integrity" and details.integrity_check, instead of artifact_changed. artifact_changed errors from AnalysisArtifactChangedError now include retry "backoff". |
||
|
|
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> |
||
|
|
6f267022ed |
fix(errors)!: raise container reader byte faults as malformed or truncated targets (#14265)
* 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): 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): 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. * 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. * 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(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(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) | ||
|
|
56cf15566e |
feat(artifacts)!: inspect and compare directories by a content-addressed root digest (#14270)
* feat(artifacts)!: inspect and compare directories by a content-addressed root digest
inspect_artifact takes an optional path and inspects it without the open
session target; a directory is inventoried in place. compare_artifacts
accepts {kind:"path",path} on either side. open_binary is unchanged and
still refuses ordinary directories with directory_requires_file.
The inventory owner computes a versioned tree digest (rea-directory-tree
v1) from the walk it already performs: SHA-256 over length-prefixed
records of each member's NFC path, kind and content digest, sorted by
path bytes. Symlink targets are recorded and not followed; FIFOs,
sockets and devices are recorded by kind. A walk that a limit or an
unreadable member stops reports root_digest partial with no digest.
BREAKING CHANGE: subject.identity gains a directory kind
{kind:"directory",algorithm:"rea-directory-tree",version:1,sha256}. A
directory inventory's subject and root sha256 are its tree digest, and a
partial walk's subject is {kind:"unknown",reason:"not-observed"}.
inspect_artifact no longer requires an open target. Directory symlink
occurrences record link_target and compare by it.
* fix(artifacts): hash exact directory names and keep failed inspection cleanup retryable
- The tree digest encodes each member's exact stored name bytes instead
of an NFC path, so names that differ only in normalization stay two
members and swapping their contents changes the identity.
- A directory inspection whose readers cannot be released retains its
scope in the caller's lifetime (the MCP session, the CLI session or
the comparison's resource scope), so a later close retries it. The
one-shot session of a path-selected file is retained the same way.
- compare_artifacts keeps a completed left inventory as an argument
observation when the right side fails.
- A summary of a partial directory inventory, whose subject is unknown,
resolves to its exact parent and compares with unknown coverage.
- The directory identity reference is in the site navigation, and the
CLI boundary test passes the comparison command its environment.
* fix(evidence): treat complete directory identities as artifact subjects in claims and digest filters
verify_reconstruction required a file subject for every structural
source, so a structural-artifact claim over two complete directory
inventories stayed unknown even when compare_artifacts confirmed a
difference. Artifact claims now accept a file or directory identity;
function claims remain file-only.
get_evidence_bundle's target_sha256 filter compared only file subjects,
so a directory's returned tree digest matched no records. It now
matches the digest of a file or directory subject.
* fix(artifacts): resolve a selected directory against the caller's cwd
A relative directory selection such as "." reached the directory route
unresolved, so the subject's local_path was the relative spelling.
The directory route now uses the caller path owner, as target admission
does for files, and records the absolute path.
The CLI acceptance test that pinned "inspect-artifact ." to
directory_requires_file now expects the inventoried empty directory,
and the macOS bundle verifier asserts the .app directory's tree-digest
identity instead of a file format.
* fix(artifacts): address PR #14270 review findings on partial roots, CLI evidence delivery, cleanup retry, and tool effects
* fix(artifacts): collect linked source closure for comparison exports
* fix(artifacts): require matching root digest schemes before comparing root hashes
* fix(artifacts): compare stored directory filenames across normalization forms
|
||
|
|
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 |
||
|
|
225a19ae7a |
feat(artifacts): inventory and extract stored and gzip-compressed tar archives (#14245)
* feat(artifacts): inventory and extract stored and gzip-compressed tar archives Recognize POSIX ustar and GNU tar headers, plain or as the first block of a gzip member, as the new tar artifact format, so Linux release tarballs and Unity .unitypackage files inventory and extract like ZIP archives. The tar reader walks every header once, applying pax path, linkpath and size records, GNU long names and the ustar prefix. Regular files, directories and symlinks are occurrences with typeflag, mode, owner, mtime and link target; devices, FIFOs, hard links and sparse members are traversal omissions. Gzip members are read by forward decompression with an idle stream reused for in-order opens, and every decompressed byte is charged to artifact_limits.expanded_bytes. A later corrupt header, a truncated member or gzip stream, and non-zero bytes after the end marker keep the members read so far with unknown coverage and an explicit end_state; a first block with the ustar magic and a bad checksum is refused with that reason. Fixes #14177 * docs(compare): name tar-entry among the compared format metadata kinds * fix(tar): keep complete members and header facts across tar edge cases - Charge omitted devices, FIFOs and links to the retained-metadata allowance. - Probe a small gzip tar without verifying its trailer, and feed the final trailer to zlib separately so data before a bad CRC stays readable; queue decompressed output so a later failure cannot drop it. - Decode negative GNU base-256 numbers; only mtime may be negative. - Apply pending pax records only to the next member, never to extension headers, and let an empty pax value delete the keyword. - Push a member once its data is complete, then skip its padding. - Treat a cut-off zero block as truncation, not an end marker. - Stop with malformed partial coverage, not a refusal, when a later header declares an unsafe size. * fix(tar): charge gzip expansion as zlib produces it The decompressed-output queue charged the plaintext-work allowance only when the reader took a chunk, so bytes queued for an idle reader were not bounded by artifact_limits.expanded_bytes. Each chunk is now charged in the data handler before it is queued; an exhausted allowance stops the inflater, and the queued, already-charged bytes are served before the limit failure. * fix(tar): validate numeric pax records and probe gzip past its header fields - A pax size, uid, gid or mtime record that does not parse now stops the walk as malformed at that member, keeping earlier members, instead of silently falling back to the header field. - The gzip-wrapped tar probe skips the RFC 1952 FEXTRA, FNAME, FCOMMENT and FHCRC fields before applying its 2 KiB compressed-data bound, so a long name or comment no longer hides the archive. |
||
|
|
789ca04125 |
fix(pe)!: bound static readers by the bytes they read, not file size (#14262)
* fix(pe)!: share one loader-equivalent PE header owner across static readers Resources and certificates now admit headers through readPeImage, and resources map RVAs through the shared file-backed mapping. The owner reads the optional header at fixed offsets, caps data directories at 16, and lets a PE signature at e_lfanew override a DOS relocation table. Export, import, TLS and resource directories are read at their RVA whatever Size declares. Disregarded declarations are reported in header_anomalies. BREAKING CHANGE: import and delay-import walks continue to the null descriptor past a short directory Size instead of stopping with a malformed_entry issue, and inspect-pe-resources reports an unsupported optional-header magic as unsupported_target. * fix(pe): keep valid DOS relocation tables owning e_lfanew Only a relocation table that describes no DOS load module yields e_lfanew to a PE signature; update MZ/PE conformance to the shared owner. * fix(pe)!: bound static readers by the bytes they read, not file size max_file_bytes now counts the header prefix and every positional read of headers, directory tables and their referenced ranges. The identity pass that hashes the whole file is bounded only by a fixed whole-file ceiling: 4 GiB minus one byte for the PE-only readers, whose file offsets are 32-bit, and 512 MiB for hardening and exports. An exhausted allowance is a capacity refusal with a typed parameter details.limit. BREAKING CHANGE: max_file_bytes no longer refuses a large file whose reads fit; an exhausted read allowance reports resource capacity instead of file-size, and only a file above the fixed ceiling reports file-size. * fix(pe): walk resource trees within file-backed bytes and cite TLS reads The resource walk is bounded by the file-backed run from the directory RVA rather than its Size, and a Size that ends before the bytes walked is a directory_size_below_structure anomaly. The TLS result carries structure_location for the structure read past a short Size, and Evidence cites it. * test(pe): assert a refused read never reaches the descriptor * test(pe): use a resource cycle as damage now that a short Size is read * fix(pe): read resource trees past an oversized Size and keep damaged MZ headers malformed An oversized resource Size is reported without requiring its unused bytes to map. A Windows-header candidate is malformed when the DOS module is also invalid, and the guide states that a valid DOS relocation table owns e_lfanew. * feat(pe): report image_base and IAT slot VAs in static PE results (#14263) * feat(pe): report image_base and IAT slot VAs in static PE results Every static PE result reports the optional-header image_base once as a hex VA, and import rows add iat_va beside iat_rva so a slot goes straight to xrefs. Fields name their space as rva, va or file_offset; the new fields are optional so saved Evidence still parses, and the imports service rejects an iat_va that disagrees with image_base plus iat_rva. * fix(pe): document iat_va for rebased databases and test VA rejection iat_va is relative to the file's ImageBase; a rebased provider database needs its own base plus iat_rva. Cover the service rejection of a slot VA that disagrees with image_base plus iat_rva. * chore(pe): register the forwarded whole-file ceiling and shrink refusal baselines |
||
|
|
fd09e2b9a1 |
fix(limits)!: let inspect_pcap_capture take producer_limits for its snapshot and TShark output (#14280)
* fix(limits)!: let inspect_pcap_capture take producer_limits for its snapshot and TShark output inspect_pcap_capture kept private copies of the producer budgets that inspect_packet_capture already exposes. It now accepts producer_limits with input_bytes (the streamed capture snapshot, default 2 GiB) and output_bytes (each TShark JSON pass, default 8 MiB, at most the fixed 128 MiB decoded-JSON allowance). Refusals report details.limit for the parameter instead of a fixed ceiling. The decoded-JSON expansion and retained-fact allowances stay fixed because raising them needs a streaming decoder; the version and summary probe capture is reclassified as protocol. Part of #14237 BREAKING CHANGE: an inspect_pcap_capture refusal at the snapshot or TShark JSON budget reports details.limit for producer_limits.input_bytes or producer_limits.output_bytes and no longer carries details.refusal fixed_ceiling. * fix(limits): keep the DNS pass's producer limit and cover raised pcap budgets When only the DNS wire-identity pass exceeds producer_limits.output_bytes, the partial summary now records dns_identity_limit with the parameter, effective value, default and range. The pcap output budget is documented as combined stdout and stderr, as producer_limits.output_bytes is elsewhere. Acceptance covers TShark output above the old 8 MiB ceiling in both passes. |
||
|
|
59a799931c |
feat(delivery)!: size the default delivery of native inventories and traces
Whole-binary inventories returned complete Evidence unless the caller asked for a summary. On Debian 12 zstd, a stripped 1.2 MB ELF, the complete MCP results were 8.2 MB for list_names, 3.6 MB for trace_feature on "error", 1.0 MB for a regex string search and 504 KB for list_procedures. Claude Code moves results above about 25,000 tokens out of context. list_names, list_procedures, list_strings, search_procedures, search_strings, trace_feature and batch_decompile now declare a size-aware detail. When the caller omits it, Evidence up to 32 KiB of UTF-8 JSON is returned inline; larger Evidence is retained and its summary returned. A server that retains nothing still returns the complete Evidence. Explicit complete and summary are unchanged. Both delivery handlers share one decision, measured with the bounded JSON size helper, and a contract opts in by declaring the size-aware detail schema. BREAKING CHANGE: for these seven tools, an omitted detail on a result above 32 KiB now returns the retained summary instead of complete Evidence. Pass detail: "complete" to keep the previous shape. Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
6ab595cfd6 |
fix(limits)!: make the IL2CPP pointer index adjustable and require owned refusal limits (#14243)
* fix(limits): make the IL2CPP pointer index adjustable and name ELF note budgets in details.limit inspect_il2cpp_metadata accepts max_native_index_bytes (default 1 GiB, needs binary_path) for the estimated ELF virtual pointer index. The index refusal now carries its own limit name (virtual-pointer-index-bytes) and a details.limit naming the parameter, its effective value, default and range, instead of a fixed ceiling with no override. The binary file allowance and the loader's fixed capacities are unchanged. inspect_elf_notes and inspect_elf_debug_link refusals for max_file_bytes, the decoded section-name budget and max_entries now set details.limit. One domain-owned bounds object per operation feeds both the schema and the limit. Two guards keep new in-code refusal limits owned: - scripts/verify/fixed-ceilings.mjs (run by npm run lint) requires every fixedAllowanceOptions, fixedProducerInputAllowance, artifactFixedLimitFailure or inline fixedAllowance declaration to be listed in fixed-ceiling-registry.json with its class (format, protocol, representation, derived, forwarding, or pending with an issue) and reason, and fails on stale entries. - The untyped-budget-refusal architecture guard counts refusals whose only recovery is an authored remediationAction, with a shrink-only baseline. Fixes #14175 Part of #14234 BREAKING CHANGE: an inspect_il2cpp_metadata refusal at the ELF pointer index reports reported_limits.boundary "virtual-pointer-index-bytes" and details.limit for max_native_index_bytes, and no longer carries a details.refusal fixed_ceiling. * fix(limits): track IL2CPP's remaining fixed allowances with the native readers * fix(limits): run the authored-only refusal count from lint, where TypeScript is installed The architecture guards run before npm ci in CI and must stay dependency-free, so the AST-based count moves into fixed-ceilings.mjs with its own shrink-only baseline and --shrink-baselines. * fix(limits): register producer and native wrapper ceilings by the allowance they name fixedProducerInputAllowance names its allowance in its second argument, and fixedNativeAllowance forwards its first, so the guard now reads each helper's allowance argument and checks the callers of both. * fix(limits): delete the authored-only baseline when its last count is removed reconcileBaselineFile returns delete once no count remains, but the verifier ignored it and the next run read the file unconditionally, so --shrink-baselines could not finish. An absent baseline now reads as empty and shrinking removes the file. * fix(limits): record the advertised IL2CPP input schema with max_native_index_bytes |
||
|
|
78d2593a45 |
feat(artifacts): report declared DDS, GLB, KTX and KTX2 headers and regions (#14248)
* feat(artifacts): report declared DDS, GLB, KTX and KTX2 headers and regions Recognize DDS (including the DX10 extension), GLB, KTX 1.1 and KTX 2.0 by their header signatures and inventory them as containers. The root format metadata carries the declared header facts. Each declared byte region is a member that is hashed, classified and extractable: the DDS payload; GLB JSON and BIN chunks and BIN-stored images; KTX key/value data and mip levels; and KTX2 DFD, KVD, SGD and levels. Nothing is decoded. A DDS payload is checked against the size derived from its dimensions, mips, faces, layers and block size. Disagreeing extents are reported in extent_check with unknown coverage rather than refused, and regions past the end of the file are dropped, not clipped. Structural header faults refuse as malformed input with the format and offset. Part of #14155 * fix(gpu-assets): bound GLB chunks and keep unexamined regions unknown - Stop the GLB chunk walk at 1,024 chunks with unknown coverage. - Refuse a GLB chunk that crosses the declared length, or a chunk table that stops short of a physically present declared end, as malformed. - Report coverage unknown when GLB images were not all listed: past the image allowance, an unparsed JSON chunk, or an unresolved bufferView. - Leave the DDS payload size unknown when rows are padded to a declared pitch or more than 32 mip levels are declared, instead of deriving it from different dimensions. * fix(gpu-assets): report GLB images in URI-backed buffers as external Only buffers[0] without a uri is the GLB BIN chunk. An image whose bufferView sits in a buffer with a uri, or an image named by uri, is stored outside the file; it was counted as an unresolved image and made coverage unknown. Such images are now counted in external_images and leave coverage complete; only views that resolve to no buffer stay unknown. * fix(gpu-assets): report KTX2 level-index failures at file offsets The 64-bit level-index fields were read from a buffer that starts at file offset 80, but an unsafe value reported its index-relative position. The reader now takes the buffer's file base and reports base plus position, so every failure offset is a file offset. * fix(gpu-assets): count a GLB image as external only for a URI string An image or buffer whose uri is present but not a string, and an image with neither a uri nor a bufferView, were counted in external_images and left coverage complete without an established source. Only a URI string now marks a source external; other sources stay unresolved and keep coverage unknown. |
||
|
|
6d408c0480 |
fix(zip): account apksigner alignment padding before the APK Signing Block (#14232)
* fix(zip): account apksigner alignment padding before the APK Signing Block Signed release APKs pad the member region with zero bytes so the APK Signing Block starts on a 4 KiB boundary. The member-region account counted that pad as unaccounted bytes, so ZIP listing coverage was unknown for ordinary apksigner output. An all-zero range under 4 KiB that ends at a well-formed, 4 KiB-aligned signing block is now accounted as padding. A non-zero byte, an unaligned block or a zero run with no signing block stays unaccounted. Fixes #14178 * fix(zip): prefer the descriptor layout that leaves signing-block padding An empty member's zero sizes match both the 16-byte and the 24-byte data descriptor layouts. When the 24-byte layout is followed only by apksigner alignment padding, the first-match 16-byte choice left more than 4 KiB for the padding check, so valid padding stayed unaccounted. The descriptor search now also prefers a layout whose remainder is that padding. |
||
|
|
0a145c8423 |
fix(gpu)!: dispatch AMDGPU note metadata on the declared ELF ABI (#14244)
* fix(gpu)!: dispatch AMDGPU note metadata on the declared ELF ABI
inspect_gpu_code_objects read every AMDGPU ELF note under the HSA schema,
so a well-formed PAL-ABI code object was reported malformed ("no valid
kernel array") while the same object without metadata was unsupported.
The AMD ELF metadata owner now reads EI_OSABI once and selects the note
schema from it. HSA (64) keeps the existing kernel path. PAL (65) decodes
amdpal.pipelines into a new amd_pal_metadata object field during kernel
analysis: the version, and per pipeline its name, type, API, API shader
stages with their hardware mapping, and each hardware stage's entry point,
entry point symbol, SGPR/VGPR/AGPR counts, wavefront size, LDS and scratch
sizes. PAL register maps use unsigned integer keys, which the MessagePack
reader now admits for that schema only. Mesa3D (66) and unrecognized ABIs
are unsupported with their e_flags target and unexamined notes. Corrupt PAL
MessagePack or container shapes remain malformed.
BREAKING CHANGE: amd_target_metadata gains required os_abi and abi fields,
GPU objects gain a nullable amd_pal_metadata field, and PAL-ABI objects
report complete, partial or unsupported instead of malformed.
Fixes #14154
* chore(gpu): regenerate the inspect_gpu_code_objects advertised schema summary
The objects view fields selector derives from the GPU object schema, so the new amd_pal_metadata field changes the advertised input compact schema.
* fix(gpu): bound AMDGPU note expansion per code object and refuse binary maps
The decoded-value allowance is now shared across all of a code object's notes, so PAL pipeline facts expanded during discovery stay bounded. MessagePack binary values are no longer accepted as maps for PAL pipelines, stages or HSA kernel and argument rows.
|
||
|
|
ff2f9d9880 |
docs(reference): say that pwntools memory failures carry no producer limit (#14221)
Both the structured resource-limit reply and the reserved memory exit omit details.limit, because an allocation failure does not prove that producer_limits.address_space_bytes was exhausted. The reference promised the parameter limit for every pwntools budget failure. |
||
|
|
fc795dd260 |
fix(pwntools)!: report a per-call input ceiling as its producer_limits parameter (#14208)
* docs: correct, re-verify and prune getting-started, provider and reference pages Re-verify the macOS arm64 native decompiler build, the m68k lane and the RISC-V lane on Ghidra 12.2, check RISC-V language facts against the 12.2 SLEIGH sources, document the verify:ghidra demangler prerequisite, remove duplicated IDA and mcp add paragraphs, prune release-history narratives and the stale 6.4.0 registry checkpoint, clarify Godot carrier classification, correct the packet-summary and SQLite host rows, and say in the inspect-binary-layout CLI description that it is ELF-only on Linux x64. * docs(reference): add a canonical producer_limits section Derive the accepted fields and defaults per operation from the producer limit schemas and describe how an exhausted budget reports its per-call control. * docs(reference): split producer_limits defaults by operation and document the pwntools exceptions Field and decoder discovery reject input_bytes, and packet field search defaults output_bytes to 32 MiB. For pwntools, diagnostic_bytes bounds combined stdout and stderr while output_bytes bounds the reply file, and an oversized input reports the pwntools.max_input_bytes setting limit rather than the producer_limits parameter shape. * fix(pwntools)!: report a per-call input ceiling as its producer_limits parameter When producer_limits.input_bytes set the pwntools admission ceiling for a call, an oversized input reported the registered pwntools.max_input_bytes setting limit with update_mode "parameter" attached. Every other producer budget reports the parameter shape, and AGENTS.md asks for the limit of the control that stopped the work. Report producer_limits.input_bytes with applies_at "next_call" and, as its default, the ceiling that applies when the field is omitted. Setting, launch and built-in ceilings keep the setting shape. Remove the reference exception this made obsolete. BREAKING CHANGE: for a request-sourced pwntools input ceiling, details.limit is now a control_kind "parameter" limit instead of a setting limit carrying setting, source, update_mode and scope fields. |