mirror of
https://github.com/morluto/rea.git
synced 2026-11-29 09:56:23 +00:00
3a8a717b02edcd41b9dfbf64e82e5f7a761dfd8e
6571
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
3a8a717b02 |
feat(ghidra): set function signatures and define the types they use (#14859)
* feat(ghidra): set function signatures and define the types they use annotate_native_function accepts an optional C prototype, applied with USER_DEFINED source in the same transaction as the name and comments, verified by readback and rolled back with them on refusal. define_native_data_types stores caller-authored struct, union, enum and typedef definitions atomically under /rea_caller_defined and refuses existing names. inspect_native_data_type reports those types with source caller-defined, and annotation readback reports the applied prototype and its source. Refs #14831 * feat(ghidra): bound caller C text with launch controls and refuse unapplied constructs The lengths of a signature and of type declarations and the nesting depth of parentheses are launch-only REA_ controls with measured defaults, floors and maxima, written into the bridge's session descriptor. A refusal names the control, its effective value, source and range. The bridge tokenizes caller C before Ghidra's parser sees it and refuses what that parser accepts without applying: attributes, storage-class specifiers, variable declarations, directives other than #pragma pack, literals, function bodies, default arguments, unnamed enums and repeated member names. A type name that names different types is refused. When a function has no calling convention and the prototype names none, the compiler specification's default convention, which Ghidra already uses to assign the locked storage, is recorded, and annotation readback reports the convention. Refs #14831 * fix(ghidra): apply the signature bound to the caller's text The bridge appended the semicolon its parser needs before checking the length, so a prototype of exactly the admitted length was refused. The readback prototype is documented as reusable only when its function and type names are C identifiers. Refs #14831 * chore(mcp): refresh advertised schema summaries for Ghidra type edits Refs #14831 * fix(ghidra): bound caller C text per call and report dropped qualifiers Ghidra's C parser cannot be cancelled, so REA bounds the text it parses. The three launch-only environment controls left an agent that hit them with a restart as its only recovery. The two length bounds are now per-call parameters, signature_max_utf16 on annotate_native_function and declarations_max_utf16 on define_native_data_types, with the same defaults and measured maxima. A refusal reports details.limit with control_kind "parameter" and required_value, the text's length, so the generated recovery names the value to pass or asks for shorter text. The text fields no longer carry a schema maximum, so every over-length refusal is typed. Parenthesis nesting is a fixed ceiling of 8 levels, registered as a representation bound, because each level doubles parse time. The session descriptor no longer carries C parser limits, and the config module, environment entries and restart-only registry rows are removed. const and volatile are still applied without effect, because Ghidra's types have no representation for them. Both edits now return dropped_qualifiers with each qualifier's line and column, and for a signature its parameter index, null for the return type, instead of dropping them silently. * fix(ghidra): read caller C through one tokenizer and bound nesting per call The C admission scan tracked lines only at LF and read directives as raw lines matched by a regular expression, so a CR-only line break shifted dropped-qualifier positions and a trailing comment on #pragma pack was refused. One tokenizer now owns caller C positions, comments and literals: CR, LF and CRLF each end a line as in Ghidra's parser, and directives are admitted from its tokens, so comments read as whitespace there too. A block comment that would carry a directive onto another line is refused. Parenthesis nesting was a fixed ceiling justified by parse time, a resource limit. It is now the per-call parenthesis_max_depth (default 8, range 1..12) on both type-edit tools. The bridge measures the deepest nesting over the whole text and sends it, with a text's length, as the wire failure's required_value, so details.limit reports the bridge's own measurement instead of the adapter re-reading the request. The tokenizer also decides whether a prototype is terminated, so the parser sees the caller's text unchanged: no leading whitespace is stripped, and a trailing line comment no longer swallows the appended terminator. * fix(ghidra): parse caller C inside the edit's rollback and refuse parser diagnostics Ghidra's C parser writes the type database even with storeDataType false: a definition whose name matches an existing empty composite fills that type in place, in the parser's own nested transaction. Both type edits parsed before opening their transaction, so a refused definition, such as one conflicting with a DWARF placeholder, left that placeholder filled. Parsing, validation and storage now share the edit's one transaction, and parseCallerC refuses to run outside one. The parser also records diagnostics it cannot apply, such as a repeated enumerator it drops, and still reports success. Both edits now refuse any diagnostic with Ghidra's message, before anything is stored. The real-Ghidra verifier gains a phase with an ELF object whose DWARF declares an opaque struct, proving a refused definition leaves that empty composite unchanged, and refuses a repeated enumerator. * fix(ghidra): admit caller C from one audited table of tokens Ghidra drops Review kept finding one more construct Ghidra's C parser consumes without applying, because admission listed spellings piecemeal. The tokenizer now owns one table, audited against every token and production of Ghidra 12.2's C.jj and checked on Ghidra 12.2, in that grammar's own spellings: - Refused, because meaning is lost: __ptr32 and __ptr64 (stored as a native-width pointer), __near and __far, every attribute, declspec, __readableTo, alignas, packed and asm spelling, [[...]] attributes, storage and inline specifiers including __forceinline, __pragma and _Pragma, _Static_assert, Objective-C @ blocks (Ghidra skips their whole text), and backslashes. - Reported in dropped_qualifiers as pure qualifiers: every const and volatile spelling, restrict, __unaligned and __w64. #pragma pack is admitted only in the operand forms Ghidra applies as written with a decimal value; (0x1), (010), (show) and (pop, n) were ignored or read differently, and "# pragma" is a line marker Ghidra skips. An enum tag that neither the text nor the database defines made Ghidra invent an empty enum without a diagnostic; declarations now refuse it as they do an invented struct or union. Identifiers admit $, as C.jj's do, and the tokenizer reads numbers and [[ as single tokens. * fix(ghidra): bound caller type depth, admit only constant expressions Ghidra evaluates, refuse unmatched pack pops Recursion: the tokenizer's [[ lookahead re-entered next() for each "[", and the dependency walk recursed per pointer, array and member level. Both are iterative now. Ghidra 12.2's own data-type code recurses too: 1024 pointer or array levels resolve, 2048 exhaust the stack inside addDataType while its database lock is held, leaving the Program unable to save. Every parsed type's chain through pointers, arrays, typedefs and members, including existing database types, is now measured iteratively and refused beyond a fixed 256-level ceiling before Ghidra walks it. An unexpected StackOverflowError ends the session with a reason instead of being caught by the parser call, since Ghidra's lock may then be held. Constant expressions: Ghidra leaves names, casts, sizeof, floating and binary literals unevaluated and substitutes a default, so "MASK = FIRST << 4" was stored as 2, and it truncates values outside int. Enum values, array sizes and bit-field widths are admitted only as integer literals with arithmetic, shift, comparison, bitwise and logical operators, checked iteratively with C's rules to stay in int, including implicit enumerator values; anything else is refused at its position. Pragma pack: Ghidra ignores a bare (push), a pop with nothing pushed keeps the current packing, and a plain pop pops past labelled entries. The tokenizer tracks admitted pushes and admits a pop only when Ghidra's result matches C's. * fix(ghidra): admit constant expressions only as one literal, skip absent pointer targets, state the type-depth recovery truthfully Constant expressions: emulating C against Ghidra's own evaluator is an open-ended class of mismatches (comparisons, unsigned arithmetic such as ~0U >> 1 giving -1, names, casts, truncation). The evaluator is removed. Enum values, array sizes and bit-field widths are admitted only as one decimal or hex integer literal within int, optionally negated, without suffixes; anything else is refused at the first token that leaves that form, and the refusal says to write the computed value. Implicit enumerator values are still checked against int. Dependency walk: Ghidra's generic pointer has a null pointed-to type, and pushing it onto the ArrayDeque threw. Both the dependency and depth walks now take children from one cTypeChildren and skip an absent child. Type depth: the depth is measured over the whole chain before comparing it with the limit, so the refusal reports the depth it used, and it names the type from the parser's table rather than walking the type for a name. The recovery no longer suggests splitting into named types, which cannot help because depth counts through typedefs and existing types; it says only fewer nested levels do. * refactor(ghidra): refuse parentheses in definitions and keep parenthesis_max_depth on signatures only Under the literal-only rule for constant expressions, every parenthesis in a define_native_data_types text already ended in a refusal (function declarators, attributes, casts, sizeof, or a Ghidra diagnostic for a grouped declarator), so parenthesis_max_depth changed only which refusal a caller saw. A definition now refuses its first parenthesis at its position, and the parameter is removed from that tool's schema; it stays on annotate_native_function, whose prototype has a parameter list. * fix(ghidra): refuse distinct types that share one parser name Ghidra keeps struct tags, enum tags and typedefs in separate maps. Combining those maps dropped a typedef such as typedef int item when struct item was also defined, and the call still succeeded. Overlapping names are stored only when the definitions are equivalent, which keeps typedef struct s { ... } s as one struct. Any other overlap is refused with conflicting_type_definitions before the transaction stores anything. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(ghidra): roll back a composite the parser fills in place Ghidra's parser replaces an empty composite during parsing and returns that same object. A later same-path check would store the fill as unchanged. Record those empty composites before parsing and refuse if parsing fills one, so the open transaction restores them. A different layout of a non-empty caller type still conflicts and leaves the stored type in place. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(ghidra): close line comments at EOF and refuse overflowing pack values Ghidra's // skip token requires a line break, so a comment at the end of declarations or of an already-terminated signature was rejected. A newline is appended whenever the text ends in a line comment, before any semicolon added for an unterminated prototype. Integer.parseInt drops a pack operand outside a Java int and leaves the previous packing, so #pragma pack(2147483648) stored a natural layout. Decimal pack operands are admitted only when that parse succeeds. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(ghidra): assert the empty-composite refusal by code and readback Defining a struct over the DWARF placeholder fills that empty composite during parsing, so the refusal is data_type_conflict before the old name-conflict message. The verifier checks that code and that the placeholder still has no fields. 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> |
||
|
|
06fa8d0634 |
perf(ghidra): decompile upcoming export functions in parallel (#14847)
* fix(ghidra): reuse completed decompiles and decompile code outside functions * perf(ghidra): decompile upcoming export functions in parallel * fix(ghidra): say what the procedure inventory omits and how to reach it * fix(ghidra): say when a file offset maps to code outside every function A file-offset selector that mapped to disassembled code without a function failed with advice to choose an inventory procedure, which cannot name that code. The failure now states the fact and that procedure_pseudo_code can decompile it by the mapped analysis address. One predicate now decides that an address holds code outside every function for the address, file-offset and procedure_not_found paths, and the bridge imports UndefinedFunction and SoftReference like its other dependencies. * fix(ghidra): scope decompile read-ahead to the operation it prepares The bridge ran the read-ahead window in the generic serve loop, before the ping, analysis-incomplete and read-only checks and for any method that carried the field. It now runs only for procedure_pseudo_code, after those checks. The pool state sits with the other decompiler fields and its Ghidra types are imported. The export tests now cover consecutive windows, a limit that ends inside a window and a window whose first function sends no decompile request. The provider guide states that a function failing or timing out inside a window is attempted again by its own request, and how long the pool lives. * fix(ghidra): decompile code outside functions selected by file offset A file offset names the same location as its mapped analysis address, but an offset that mapped to code Ghidra disassembled without a function was refused while the address decompiled. The offset now resolves through the same on-the-fly UndefinedFunction path and limitation, and its selection reports the inferred entry as procedure_address. The refusal that sent the caller back to the address form is removed. * fix(ghidra): bound decompile read-ahead by the carrying request's deadline A request that carried a read-ahead window waited for every function in it, then decompiled its own function again when the window's attempt failed or timed out, so one configured deadline could elapse twice. That request now waits only within its own deadline, consumes the window's outcome for its function whatever it is, and cancels siblings still running once it has its result and the deadline has passed; they stay uncached for their own requests. The hint is advisory, so selectors past one window are now ignored instead of refusing the request. Pooled decompilers run on a private thread pool rather than resizing Ghidra's shared "Parallel Decompiler" pool, and are released after 30 seconds without a window. * test(ghidra): cover read-ahead deadline and hint clamp on real Ghidra The decompiler failure probe now injects a read-ahead window whose carrying function times out beside a sibling that never finishes. It checks that the request reports the timeout without decompiling again, waits only within its deadline, leaves the cancelled sibling uncached, uses REA's own thread pool, and that a longer hint is clamped to one window. The probe no longer ran against the current bridge: it used a removed three-argument Request constructor, expected the old timeout and failure wording, and injected decompilers that completed-result reuse never called. It now builds full requests, matches the current messages by prefix and clears reused results before each injection. * fix(ghidra): keep reused decompiles across reads without decompiler options A request that omits decompile_max_payload_mib now leaves the session's payload limit unchanged instead of resetting it to the Ghidra default, so an instruction or metadata read no longer discards completed decompiles. An explicit null still selects the installed default. Boundary limitations for a reused decompile of code outside every function now use the function the decompile widened, not a fresh entry-only UndefinedFunction. * docs(ghidra): state what an omitted decompiler payload option means * fix(decompile-all): plan read-ahead from the decision the export loop makes The read-ahead window decided which functions would be requested from journal history alone. A journaled write whose file was later deleted is requested again, and file problems spend the caller's limit, so a resume could prepare functions outside its limit while the ones it requested got no preparation. Each function is now decided once by the same check the loop uses. The window keeps those decisions for the loop, counts every attempt against the limit, and names only functions that will be decompiled. * test(ghidra): cover payload-option omission and reused undefined-function bodies * fix(decompile-all): start each read-ahead hint at the function that sends it A function the window named first could send no decompile request, for example when procedure_info classifies it as external, so the next request sent a hint headed by that function. A provider reads the head as the carrying request's own function, so the bridge could not keep that request's window result and might decompile it again. The request now takes the planned window from its own function on. |
||
|
|
f6a019a346 |
fix(rizin): terminate the owned debugger when cleanup cannot resynchronize (#10462)
* fix(rizin): terminate the owned debugger when cleanup cannot resynchronize
A Rizin debug command whose deadline expires while the target keeps running
leaves the debugger blocked with unread cleanup commands. Cleanup could not
observe its resynchronization marker, detach was never verified, and the
retained process outlived the MCP server with its target (issue #8779).
Detach results now carry an explicit `unavailable` declaration. Rizin returns
it when a bounded resynchronization probe (500 ms, inside the shared 1000 ms
detach budget) observes no marker. `stopOwnedDebuggerProcess` then terminates
the directly owned process and reports `stopped_inferior_unknown`, leaving the
inferior's disposition unknown instead of inferring it from a PID or path.
An observed marker followed by a refused detach still retains the cleanup
owner for retry, and a session whose output streams have not settled remains
retained. Rizin never signals the inferior, so its target may continue
running; timeout, cancellation and protocol-failure evidence name the
unverified detach and the unknown target state, as do the close contract,
the Rizin guide, and the runtime-observation skill.
Validation (rebased onto upstream/main at
|
||
|
|
f89480536d | perf(ci): run the Windows typecheck once per matrix (#14875) | ||
|
|
1aa301e149 |
fix(ghidra): cancel an active request without closing the session (#14857)
* fix(ghidra): cancel an active request without closing the session Cancelling the request Ghidra is working on closed the whole session, so the next call paid for a restore or a full re-import and session annotations were lost. The bridge now reads its connection on a second thread that only cancels the Ghidra TaskMonitor of the request a cancel frame names; requests still run one at a time. For an active read, REA writes that frame and waits up to two seconds for the request's reply. When it arrives, the call returns a cancellation and the session, its annotations and the queued requests stay. Edits are not interrupted, and a read that is not answered in time closes the session as before. Refs #14832, #8223, #5340 * feat(ghidra): bound the cancel grace with a launch control REA_GHIDRA_CANCEL_GRACE_MS replaces the fixed 2 s wait for the bridge to answer a cancelled read before the session is closed. Default 2000 ms, floor 100 ms, maximum 60000 ms. The value is parsed when REA starts and fixed for a session when its request queue is constructed. It is a restart-only launch control in the numeric limit registry, not a runtime analysis setting, so the MCP tool catalog is unchanged. The session limitation states the applied value and its source, and the failure of requests queued behind an expired grace names the control, value, source and range. An invalid value is reported by doctor and registration validation and refuses a Ghidra session. The hang_tools client cases inject the 100 ms floor instead of waiting out the default grace. * fix(ghidra): keep capability limitations from claiming the default cancel grace Capability descriptors are built once without a session, so they stated the 2000 ms default as the applied value even when REA_GHIDRA_CANCEL_GRACE_MS was set at launch. They now name the control and its default; session limitations still state the value applied. * refactor(ghidra): drop the redundant pre-decompile cancellation check DecompInterface.decompileFunction already returns a DISPOSED_ON_CANCEL result for a monitor cancelled before it starts, which the existing isCancelled() check reports as decompile_cancelled. * test(ghidra): expect session limitations from the session owner in MCP parity The parity check compared session Evidence with capability limitations. Since capability descriptors no longer state an applied cancel grace, the expectation is derived from ghidraSessionCommonLimitations with the grace this harness applies. |
||
|
|
e70ca8d02b | test(pyinstaller): reuse archive reader fixtures (#14879) | ||
|
|
f1ca91efd3 |
fix(tar): recognize gzip archives with long extra fields (#14861)
Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com> |
||
|
|
af5db9d4c8 |
fix(vsix): resolve the exact web extension entry point (#14862)
Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com> |
||
|
|
5865eeea93 |
fix(ci): preserve the 75-minute npm visibility deadline (#14761)
* fix(ci): preserve the 75-minute npm visibility deadline * test(ci): use ES2023-compatible registry deadline fixture * refactor(ci): keep the npm visibility deadline at the polling boundary --------- Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com> Co-authored-by: Kei Ito <angila-antonia-casey@dr.com> |
||
|
|
0a1531145c |
fix(deb): preserve Unicode separators in md5sums filenames (#14854)
Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com> |
||
|
|
eb47944003 |
perf(decompile-all): group durable writes per batch of functions (#14858)
* perf(decompile-all): group durable writes per batch of functions The export synced each function file and then the journal, one function at a time, so it spent about as long waiting on the disk as decompiling. Each file's bytes are now synced in staging while later functions are decompiled. A group of up to eight functions then publishes its files in visit order and appends its journal records with one write and one sync. A journal record is still written only after its file's content is synced and published. Cancellation and failures commit the pending group before they are reported. Files, journal records and their order, the index and counts are unchanged. A stopped process or host now leaves up to eight decompiled functions unrecorded instead of one; a resume decompiles them again and adopts files already in place. Addresses #14830 * fix(decompile-all): commit the pending group on a throw and after one second A provider adapter that threw inside a group dropped the functions already decompiled in it: their staged files were removed and no record was written, where each had been committed before the next was requested. The pending group is now committed before the throw propagates. A group is also committed by the first function that settles a second or more after the previous commit, so a slow provider is committed function by function instead of leaving up to eight long decompilations unrecorded. Adds the missing lifecycle regressions: a caller abort during a group's publication and during its journal append, a failed removal of a discarded staged file, and a resume beside staging left by a stopped run. * test(decompile-all): release the export a failed-discard test retains The test left its export's cleanup failing, so the directory lease stayed held by the test process. The lease is keyed by device and inode; where the filesystem reuses the removed directory's inode, the next test's export was refused as already running. The test now gives the export a resource scope, retries the retained cleanup once removal works, and resumes in the same directory, which also covers the cleanup retry. * fix(decompile-all): retain failures the group commit observed after a stop or throw A write failure that stops a group now keeps a later function's provider failure as a secondary failure, with its cleanup still attached. When a provider throws and the commit of earlier functions then fails, that commit failure is returned as primary and the throw is retained with it. The first provider failure before an independent retry now joins the group before the retry runs, so a retry that throws cannot drop it. * refactor(decompile-all): compose every export failure through one owner Group settlement now carries each entry's outcome: the first stop leads, entries after it are abandoned but keep any failure they observed, and a failed journal append leads those. One composeFailures helper retains later failures as secondary and keeps every cleanup they own, and the final publish/index/close composition uses it too, so an index failure that still owns cleanup is no longer dropped behind an earlier failure. A journal write failure also keeps a later invalid record as a secondary failure. |
||
|
|
807cd6366c |
fix(cli): enforce the retained Evidence cap on bundle reuse (#14838)
* fix(cli): apply the retained Evidence cache cap when reusing bundles * fix(cli): preserve earlier evidence receipts on rejected reuse --------- Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com> Co-authored-by: Vincent Koc <vincentkoc@ieee.org> |
||
|
|
4b56f617f8 |
fix(v8): report details.limit for V8 code cache per-call budgets (#14793)
Share max_file_bytes and max_strings schema bounds through a domain-owned V8_CODE_CACHE_BUDGETS table and attach details.limit to both inspect_v8_code_cache budget refusals (Refs #14234). Co-authored-by: Vincent Koc <vincentkoc@ieee.org> |
||
|
|
1a09a8ef46 |
fix(ci): bound packet capture prerequisite acquisition (#14716)
* fix(ci): bound packet capture prerequisite acquisition * test(ci): enforce packet capture prerequisite order --------- Co-authored-by: ShuaixinHuang <ShuaixinHuang@users.noreply.github.com> Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com> |
||
|
|
3eb030ccb4 |
fix(source-maps): report details.limit for source_map_limits refusals (#14797)
Share source_map_limits bounds through a domain-owned SOURCE_MAP_BUDGETS table and attach details.limit across local source-map read, decoder admission, codec reply, and memory/output limit refusals (Refs #14234). Co-authored-by: Vincent Koc <vincentkoc@ieee.org> |
||
|
|
cd744b1bfb | fix(ci): require complete path references for test coverage (#14819) | ||
|
|
c366df0bf0 |
fix(wasm): report details.limit for max_interface_bytes refusals (#14795)
Define WASM_INTERFACE_BYTE_BUDGET in src/domain/wasm/wasmInterface.ts so wasmInterfaceByteBudgetSchema and WasmInterfaceBudget share one owner, and attach details.limit to max_interface_bytes refusals (Refs #14234). Co-authored-by: Vincent Koc <vincentkoc@ieee.org> |
||
|
|
a1749f1b65 | test(providers): share placeholder Hopper project files (#14813) | ||
|
|
48adc9df0b |
fix(ci): fall back when a changed test fixture has no traced consumer (#14709)
* fix: deepen verified coverage for PR #14354 * test(ci): assert the selected fixture consumers --------- Co-authored-by: ShuaixinHuang <ShuaixinHuang@users.noreply.github.com> |
||
|
|
5c49ebcf10 | test(fixtures): use per-test cleanup in catalog suites (#14815) | ||
|
|
39d3dbaac5 | perf(ci): run architecture guards once in full qualification (#14812) | ||
|
|
58a33642f2 |
fix(api-contract): report details.limit for max_file_bytes and mark heap headroom exhaustion (#14798)
Share max_file_bytes bounds through API_CONTRACT_FILE_BYTES_BUDGET in src/domain/apiContract/apiContractQuery.ts, attach details.limit with required_value in ApiContractRead, mark V8 parser heap headroom refusals as measuredExhaustion, and drop all three entries from the untyped refusal baseline (Refs #14234). Co-authored-by: Vincent Koc <vincentkoc@ieee.org> |
||
|
|
7e01f1df85 |
fix(browser): bound armed timeline rows by the retained-event allowance (#14799)
* fix(browser): bound armed timeline rows by the retained-event allowance Armed timeline rows were appended with no byte budget. Pre-arm messages and document request identities already stop at the retained-event allowance. Count each armed row before keeping it. A row that does not fit fails the observation with payload_limit and does not return a shorter timeline. Event count has no separate ceiling. * chore(browser): format the timeline allowance check oxfmt --check rejects the wrapped comparison in TimelineCapture.#add. * fix(browser): give timeline retention a caller control Armed timeline rows use browser.timeline_retained_bytes. A call can pass timeline_retained_bytes. Request identities keep a separate counter. A row that does not fit returns payload_limit with details.limit, including a row admitted during terminal progress. * fix(browser): refresh advertised schemas for the timeline allowance The new setting and per-call field change the compact input hashes for observe_web_session, inspect_analysis_settings, and update_analysis_settings. * fix(browser): report measured timeline bytes without required_value Admission stops at the first row that does not fit, so later rows are unknown. measured_timeline_bytes records the rows already measured. The budget test waits until all four lifecycle events are delivered. |
||
|
|
a3a4771918 | test(fixtures): let each test clean up its own temporary directories (#14805) | ||
|
|
1c8b3b64e8 |
fix(cli): isolate a synchronous resource-closer throw (#14796)
* fix(cli): isolate a synchronous resource-closer throw closeCliResources invoked each closer while building the Promise.allSettled input. A closer that threw before returning a promise left that call, so later owners did not run. Start each closer on its own turn. A synchronous throw stays with that owner, and every other owner still settles. Closers stay registered, so a later close retries them. A failed registration can request process exit twice. The first request now owns shutdown. A second registration fail or host exit returns without starting another resource close or exit timer. * test(cli): exercise duplicate exit after rendering failure --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org> |
||
|
|
777832eff5 |
fix(browser): reject a file URL with a hostname (#14792)
* fix(browser): reject a file URL with a hostname A file URL names another host when its hostname is not empty. The navigation hook blocks that URL. An empty host stays allowed, including file://localhost, because the URL standard ignores that host. * test(browser): cover a blocked file-host redirect The file-host regression emits will-redirect for a remote file URL and a local file URL. Dropping the redirect check leaves preventDefault unset and fails the test. |
||
|
|
d002753ce7 | fix(analysis-view): omit absent fields from extraction rows (#14806) | ||
|
|
2a4c8ccfba |
fix(ci): clear stale static diagnostic context before recording (#14713)
* fix(ci): clear stale static diagnostic context before recording * test(ci): align inherited Mach-O assertion with main --------- Co-authored-by: ShuaixinHuang <ShuaixinHuang@users.noreply.github.com> Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com> |
||
|
|
dbbe334ec1 |
feat(artifacts): inventory macOS flat installer packages offline (#11377)
* feat(artifacts): inventory macOS flat installer packages offline * fix(artifacts): keep refused pkg members unavailable during inspection A XAR member whose decode failed or whose decoded size contradicted the TOC stayed a readable entry, so shared inspection reopened it, hit the same mismatch at stream flush and aborted the whole scan. Record those members and have open() report them as unavailable content, so the scan keeps the partial facts and the named refusal. * fix(artifacts): report out-of-range installKBytes as unknown The Distribution parser accepted any safe integer for a pkg-ref's installKBytes, but the report field is uint32. A value such as 4294967296 parsed fine and then failed schema validation, which rejected the whole inventory report. Bound the attribute to uint32 at parse time so an out-of-range value reads as unknown. * fix(artifacts): charge decoded pkg archive bytes against the shared budget The shared expansion budget charged each Scripts or Payload member by its stored XAR size, so several small gzip members could each decode toward the per-archive allowance while barely moving the total. Decode now stops at what remains of the shared budget, the decoded size is charged, and an archive that would exceed it is listed as not expanded. gunzipBounded also recognizes Node's ERR_BUFFER_TOO_LARGE, which is what maxOutputLength raises, so an oversize gzip member is reported as a limit rather than as invalid gzip data. * fix(artifacts): keep expanded pkg Scripts/Payload archives in inventory Expanding a gzip-cpio Scripts or Payload member deleted the stored XAR entry, so its heap offset, sizes and TOC checksums dropped out of inventory and extraction. Keep the stored occurrence at a sibling logical path (for example Payload.cpio.gz) with sourcePath still naming the XAR member, so it sits alongside the expanded children. * fix(artifacts): count pkg check scripts in UTF-8 bytes scriptLength returned the JavaScript string length, so non-ASCII installation-check and volume-check scripts reported the wrong byte count. Measure the selected text with Buffer.byteLength. * fix(artifacts): keep pkg FIFO and device members non-materializable A cpio member that is not a directory, symlink or regular file (FIFO, character or block device, socket) was inventoried as an empty regular file. Emit it as a metadata declaration with a limitation naming its type, keep its mode in format metadata, and refuse open() on it. * fix(artifacts): bound pkg member archived range before reading it Refuse a zlib-encoded XAR member whose archived heap range exceeds the compress bound of its decode allowance, and never read the range of an unsupported encoding, so a package-controlled archived length cannot reach a buffer allocation unbounded. * fix(artifacts): refuse installer XML with an unexpected root element Distribution must have an <installer-gui-script> root and PackageInfo a <pkg-info> root. Any other root is now a named malformed-input refusal instead of a product or component identity with null fields. * fix(artifacts): keep duplicate XAR TOC paths as distinct pkg entries Key XAR file entries by their TOC occurrence instead of their path, so a later record at the same path no longer overwrites the earlier one. Expanded Scripts/Payload member keys now derive from their archive key for the same reason. * fix(artifacts): cap streamed XAR inflate output before forwarding it maxOutputLength does not bound a zlib stream, so count emitted bytes in createBoundedXarInflate and fail before forwarding past the allowance. The member stream also fails as soon as decoded bytes pass the TOC extracted size instead of waiting for EOF. * fix(artifacts): read XAR TOC execute bits across owner, group and other The XAR TOC <mode> was tested only on its last octal digit, so a mode such as 0750 reported a non-executable entry. Parse the octal text and test (mode & 0o111) like the cpio path. * fix(artifacts): keep XAR TOC directories and link-only symlinks as pkg entries TOC records without a heap body were dropped from the inventory, so directories, symlinks declared only by <link>, and empty files vanished. They now become their own occurrences: directories stay non-openable, symlinks open as their declared target text, empty files open as zero bytes, and other record types are kept as non-materializable metadata. Installer document lookup only considers heap-backed records. The shared lifecycle cases open the first entry, so they now use the component package fixture, whose first TOC record is a heap-backed file. * fix(artifacts): record Scripts and Payload presence from the XAR TOC A listed Scripts or Payload archive is now present before expansion is attempted. When the shared budget skips it or the XAR read is refused, its compression is reported as "unread" instead of "absent". * fix(artifacts): keep pkg coverage unknown when content was refused Coverage was complete whenever no archive hit the shared expansion budget, even when a heap range, encoding, decode, cpio or pbzx refusal left content unread. Any refusal other than the header-version notice now keeps coverage unknown. * fix(artifacts): only treat the cpio archive limit as a shared budget stop A zero or oversize cpio namesize raises the name limit, whose maximum is 4096 bytes. When exactly 4096 bytes of shared budget remained, that limit was mistaken for the budget stop and the refusal was dropped. Match the limit name as well as its maximum. * fix(artifacts): keep cpio members read before a damaged tail A Scripts or Payload archive whose cpio stream ends or breaks after complete members used to discard all of them and report an empty inventory with false script flags. parseCpioOdcPrefix now returns the members read before the failure along with the failure itself, and the pkg reader keeps those members as entries while recording the refusal, so coverage stays unknown. A failure before any complete member is still a plain refusal. * fix(artifacts): keep an out-of-range XAR TOC mode unknown Parse <mode> once in the TOC reader. Octal text that does not fit a uint32 becomes null, so one bad entry no longer fails the inventory schema check for the whole package. * fix(artifacts): cancel paused memory-backed pkg members A retained member streamed into a paused consumer kept its output open after abort, because the in-memory source has no signal and the shared stream owner defers cancellation until production finishes. The member output now retires on abort while its final validation has not started. * Address review feedback * fix(artifacts): share one expansion allowance across XAR members * fix(artifacts): count XAR TOC nodes before building the DOM A small TOC could hold millions of ignored elements under the byte limits, and each became a DOM node before the file count ran. Parse the TOC through parseXmlDocumentWithinNodeLimit with a 256-per-file node allowance and report a capacity limit past it. * fix(artifacts): cancel a paused XAR decoder after its source retires A highly compressed zlib member can finish reading its archived range while the decoder is still paused on a slow consumer. The file source's abort listener is gone by then and ownArtifactStream deferred abort until production finished, so cancellation waited for the consumer to resume. Once the source closes, an abort now destroys a decoder that has not ended. The output's final validation only starts after the decoder ends, so it keeps failure precedence. * fix(artifacts): reset XAR reader state when preparation retries When one caller cancelled preparation and another retried it on the same reader, #prepare built fresh metadata but kept #entries and #refusedContent from the cancelled attempt. The retry then skipped members already refused without recording their refusals, so coverage could report complete while open() still refused the member. #prepare now clears both maps before it reads the package. * fix(artifacts): align macOS pkg reader with format failure API and zlib output limits * fix(artifacts): bound XAR TOC expanded paths, preserve valid TOC records, and populate symlink linkTarget * fix(pkg): enforce package-wide cpio caps, strict UTF-8 names, root Distribution, and stored size checks * fix(macos-pkg): bound package-wide installer metadata bytes and records * fix(macos-pkg): tie installer metadata budgets to artifact_limits.expanded_bytes Wire macOS flat package Distribution/PackageInfo byte, record, and XML-node allowances into artifact_limits.expanded_bytes via macosPkgMetadataBudget: - Preserve the 4 MiB total, 1 MiB per-document, 4,096-record, and 65,536-node defaults when artifact_limits.expanded_bytes is omitted so aliased-heap metadata bombs remain bounded. - Charge every Distribution and PackageInfo read (including aliased stored heap ranges) against the shared expanded_bytes budget alongside zlib XAR members and Scripts/Payload expansion. - Raise the byte allowances and scale record (1 per 1,024 bytes, min 4,096) and XML-node (16 per record) allowances when artifact_limits.expanded_bytes is set, and report effective limits with artifact_limits.expanded_bytes recovery on metadata limit refusals. - Also add qualcomm-mbn to PE_OVERLAY_LEADING_FORMATS to resolve the typecheck conflict introduced by merging origin/main. * fix(macos-pkg): strip repeated ./ prefixes and tie cpio limits to expanded_bytes - Normalize cpio member paths with withoutCurrentDirectoryPrefix (handling repeated leading ./ segments and archive-root entries such as ./. and ././) both when counting retained path bytes and when forming logical paths, preserving the recorded name in sourcePath. - Derive Scripts/Payload cpio archive-byte, member-count, and expanded path-byte allowances from artifact_limits.expanded_bytes via macosPkgCpioBudget (keeping 64 MiB / 4,096 members / 4 MiB defaults when omitted, removing hardcoded cpio clamps, and reporting effective limits with artifact_limits.expanded_bytes recovery). - Update docs/macos-pkg.md and docs/reference/limits-and-recovery.md and add regression tests. --------- 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> |
||
|
|
657c69abd6 |
test(filesystem): restore directory modes after permission-denial checks (#14751)
* test(filesystem): restore directory modes after permission-denial checks * test(filesystem): cover mode restoration on callback rejection |
||
|
|
0f5ab1e042 |
feat(artifacts): inspect Debian package control metadata and contents (#10689)
* feat(artifacts): inspect Debian package control metadata and contents * fix(deb): throw ParseFailureError and record the new tool's schema counts DebPackageFormatFailure now extends ParseFailureError, as the architecture guard requires of parser failure classes; its kind, partial and message are unchanged. The advertised-dialect baseline takes the counts the inspect_deb_package input schema adds ($schema in both profiles, and allOf, default, examples, the \/ escape, the unanchored path pattern and untyped nodes in the full profile). * docs(deb): say dpkg runs maintainer scripts, not dpkg-deb dpkg-deb only reads the archive; installing with dpkg is what runs the maintainer scripts. Correct the spec so the safety rationale names the right tool. * refactor(deb): project format failures through parseFailureAnalysisError The provider now maps DebPackageFormatFailure with the shared parseFailureAnalysisError instead of its own instanceof ladder, passing the partial ar/control/data observation as diagnostics. The helper takes that optional diagnostics argument. DebPackageCapacityFailure extends ParseFailureError<"limit"> with the resource and maximum as its limit, and the provider keeps its limit recovery. * test(deb): resolve inspect_deb_package from its contract family The CLI acceptance and MCP boundary tests now take the contract from DEB_PACKAGE_TOOL_CONTRACTS instead of the full catalog, as the testing guide asks of focused contract tests. * fix(deb): require debian-binary and a control file for complete coverage Coverage was complete with a missing or empty debian-binary, or a control.tar that held no control file. It now needs a known format version and the control file as well as the control and data members, and each gap adds a limitation. * fix(deb): count hardlinks in the md5sums path cross-check dpkg lists every name of a hardlinked file in md5sums, while tar stores the later names as hardlink entries. The cross-check inventory now takes hardlink paths as well as regular files, so those names are no longer counted missing. * fix(deb): decode xz only when its index declares a size within the limit The sync @napi-rs/lzma decoder takes no output bound, so a member whose index could not be read was decoded with no limit and checked only after allocation. decodeXz now refuses such a member, as truncated when the footer is missing and malformed otherwise, before calling the decoder. * fix(deb): leave the md5sums cross-check unknown when an input is unread md5sums that is not UTF-8 counted as zero listed paths, and a package with no data.tar counted as an empty inventory. The cross-check is now computed only when both were read; otherwise it stays null and a limitation says which input was missing. * fix(deb): refuse Version and Installed-Size values the output schema rejects A Version with an empty upstream part or Debian revision (1:, 1:-1, 1.0-) and an Installed-Size past the safe integer range reached DebControl and failed the output schema, so the service lost the report. The parser now records a malformed field issue and leaves the value null. * build(deb): declare src/deb as a provider module layer Main now requires every top-level src unit in UNIT_LAYERS. src/deb is a provider like src/sqlite, and its two type imports of application ports are recorded in the upward-import baseline the same way. The xz spy binding now accepts the string or bytes input XzApi.compressSync takes. * fix(deb): keep tar names and link targets as stored Read ustar name, prefix and linkname fields, and GNU long names, as NUL-terminated UTF-8 without trimming or rewriting backslashes, and keep spaces in md5sums paths. A name that is not UTF-8 is shown with U+FFFD replacements and counted in a limitation, since it may not match md5sums. * fix(deb): read control files from the control.tar root only Look up control, conffiles, md5sums and maintainer scripts by their normalized root path, so a nested subdir/control or subdir/postinst no longer stands in for the root file. * fix(deb): read PAX records by byte length PAX record lengths count bytes, so walk the extended header bytes and decode each record on its own. A UTF-8 path no longer swallows part of the next record. A path or linkpath record that is not UTF-8 is counted in the same not-UTF-8 limitation as ustar names. * fix(deb): keep unreadable relationship alternatives as issues Accept hyphenated architecture qualifiers such as kfreebsd-amd64, and have parseDebianRelationshipField return the alternatives it cannot read. parseControl records each as a malformed issue on its field, so the package reports partial coverage instead of dropping a dependency. * fix(deb): deliver the whole partial report on a refusal A Debian package refusal now carries the bounded partial report as diagnostics.partial, so control facts, relationships, maintainer-script facts, ar member offsets and file rows read before the failure reach CLI and MCP callers, not just member names and a count. * fix(deb): decode only the maintainer script interpreter line interpreterLine now finds the first newline in the script bytes and decodes only the #! line, so non-UTF-8 bytes later in the script, or a cut through a multi-byte character at byte 256, no longer hide a valid interpreter. * fix(deb): bound unreadable relationship diagnostics per field parseDebianRelationshipField now counts unreadable alternatives and keeps only the first, and parseControl records one issue per field with that count and the first term cut to 120 characters, so a field of many `|` separators no longer grows the report with its input. * test(deb): check parser guidance through its owning formatters Export undecodableTarNamesLimitation and unreadableRelationshipsDetail from the parser and assert delivered limitations and issue details through them, so wording edits change one place. * fix(deb): bound PAX header work before each tar entry Keep only the path and linkpath PAX keys the reader uses, set in place rather than copying an accumulated object per header, and refuse more than eight GNU long name/link or PAX headers before one entry as malformed, so a run of short PAX headers cannot stall the server. * fix(deb): apply PAX owner records to the following entry PAX uid, gid, uname and gname now override the fixed ustar fields, which can hold shortened or fallback values. A uid or gid that is not a safe decimal integer falls back to the fixed field. * fix(deb): keep GNU ar string tables as counted members A // string-table member is now kept in the ar inventory and counted against max_ar_members like any other member. As an unknown role it is listed in extra_member_names, so coverage reports partial. * fix(deb): honor PAX size records and escaped md5sums names - A PAX size record overrides the next entry's ustar size field. Reading and skipping by the header field reported an empty file and then parsed its data as a header, refusing a valid archive. - GNU md5sum writes a leading backslash and escapes names that contain a backslash, newline or carriage return. Those lines were dropped, so the cross-check counted listed files as missing; they are now read, and lines that are not digest lines are counted in a limitation. * fix(deb): bound relationship alternatives and read PAX headers faithfully - Count relationship alternatives across the control file before building any, refusing more than a fixed 65,536; a field of '|' separators within the control budget could build millions of report objects. - Refuse a PAX extended header whose record length is unreadable or runs past the member, instead of using the fields read so far. - Keep global (g) PAX values for every later entry and per-file (x) values for the next entry only; global values were cleared after the first file. * refactor(deb): drop an unused import * chore(mcp): drop the dialect baseline main retired in #10693 * fix(analysis-view): call completeWithinViewCoverage with main's single count Main dropped its redundant second argument; both arguments were the same count here. * test(mcp): record this PR's advertised-schema summary Add the advertised-schema summary for inspect_deb_package, generated with npm run verify:advertised-schemas -- --update-summary. * fix(deb): bound repeated global PAX text and accept xz stream padding A global PAX path, linkpath, uname or gname is copied into every later row, so each reuse is now charged to the member byte budget (max_data_bytes or max_control_bytes) and refused before the row is added. An empty global PAX value now deletes the earlier global override, so later entries read their header owner again. xzUncompressedSize and the footer check skip trailing zero Stream Padding in 4-byte groups before locating the footer, so valid padded xz members are no longer reported as truncated. * fix(deb): trim trailing tar path slashes with a backward scan The unanchored /\/+$/u retried from every slash, so a PAX path or md5sums name made of a long slash run and a final non-slash took quadratic time. logicalTarPath now trims trailing slashes with a linear charCodeAt scan from the end. * fix(deb): parse global PAX owner ids once per global record Global uid and gid values were run through paxId for every later entry, and the repeated-text budget skips numeric keys, so a long global owner value was rescanned once per row. Parse them when the global record is read and reuse the numbers. * refactor(deb): report coverage with the shared coverage status schema * refactor(deb): classify provider failures through classifyProviderFailure * fix(deb): bound resolved ar member names before copying them GNU ar /N references can repeat one string-table entry without charging its text to any budget, and every resolved name is copied into the report and its Evidence. Refuse a BSD or GNU long name above 4096 bytes before it is read or sliced, so repeated references cannot expand a small table into large report text. * test(deb): register the debPackage capability conformance case debPackage is declared in CAPABILITY_DECLARATIONS but had no entry in PROVIDER_CAPABILITY_CONFORMANCE, so the conformance suite failed for it. Name the existing Debian package CLI acceptance test as its case. * fix(deb): flag repeated control and data members as extra Only the first debian-binary, control.tar*, and data.tar* member is read. A later member with the same role was neither decoded nor listed, so a package with an empty first data.tar and a populated second one reported complete coverage. Repeated members now land in extra_member_names with a limitation, which keeps coverage partial. * refactor(deb): use the shared excerpt and error message owners The architecture guards from main count a hand-written ellipsis cut in the relationship issue detail and two inline error-to-message copies. Use ellipsisExcerpt and errorMessage instead. * refactor(deb): move DebPackagePort to src/ports/deb The provider imported its port from the application layer, which needed an upward allowance in the module-layer baseline. Put the port beside the other provider ports and drop the allowance. * fix(deb): record only caller-selected budgets in Evidence Omitted inspect_deb_package budgets no longer appear in Evidence parameters as if the caller set them; only supplied fields are kept. * fix(deb): report fixed reader allowances as limits The ar member name, tar extension header, and relationship alternatives allowances stop inspection without showing the input is invalid. Report them as `limit` parse failures (DebPackageAllowanceFailure) with the partial report attached, and project them as resource_constraint with a fixed-allowance recovery instead of invalid_request. * fix(deb): refuse GNU ar long name references outside the string table A `/<offset>` reference past the end of the `//` string table, or one that lands on an empty entry, resolved to an empty member name. The report then failed debPackageSchema and callers got AnalysisOutputError with no file identity or partial facts. Check the offset and the resolved name, and refuse as a malformed DebPackageFormatFailure that carries the partial report. * fix(deb): align ar members by stored size and require padding Advance past each ar member using the stored header size, so a BSD #1/N extended name with odd length keeps the next header aligned. Refuse an odd-sized member whose padding byte is missing at end of file instead of reporting complete coverage for a truncated container. * fix(deb): trim NUL-terminated header fields in linear time Trim fixed-width ar and tar header fields at the first NUL with indexOf instead of a NUL-to-end regex, which retried from every NUL when a continuation line followed a NUL run. Control-field decimal parsing no longer applies header NUL trimming. * fix(deb): skip the tar path prefix on GNU headers GNU tar headers use the 345-499 region for atime, ctime and sparse data, not a POSIX path prefix. Only join the prefix when the header carries the POSIX "ustar\0" magic. * docs(readme): drop duplicated target tables in five translations The fa, ko, th, zh-TW and zh guides carried the target table twice. Restore each to upstream and add the single Debian packages row. * fix(deb): report oversized Zstandard windows as a fixed allowance A valid control or data zstd member can request a decoder window above the fixed 128 MiB ceiling. Node raises ZSTD_error_frameParameter_windowTooLarge, which the parser reported as malformed. Map it to a DebPackageAllowanceFailure naming the new zstd_window_bytes allowance, matching ZipArtifactReader. * fix(package): bundle XZ decoder binaries for every plugin host The plugin archive is produced on Linux x64, where npm ci drops other platforms' optional packages. The packaging step only restored the PTY binaries, so Codex plugin installs on macOS and Windows had no @napi-rs/lzma binding and valid XZ packages failed as unsupported. Derive the platform packages from the locked runtime tree instead: every optional dependency of a runtime package that targets darwin/linux/win32 on x64/arm64 is restored at its locked path with a verified integrity, and the packed archive is checked for each one. * fix(deb): keep only applied PAX keys while reading records parsePax stored every record's key before PAX_KEYS filtered them, so one extended header of many short records with distinct keys grew an object property per record before any entry limit ran. Records whose key is not one this reader applies are now read and dropped, and parsePax is covered directly in DebPackageParser.test.ts. * Address review feedback * Trim deb822 lines with linear scans The trailing-whitespace alternative of the shared trim expression retried from every position of a long interior whitespace run, so a package Description could take quadratic time. Scan from each end instead and cover a long tab and space run in a test. * fix(deb): read only the first control paragraph parseControl used the first paragraph of the control file, but deb822Paragraphs built a map for every paragraph first. A control file of many small paragraphs could allocate millions of maps within the decompressed-size budget. deb822Paragraphs now takes a paragraph limit and yields string lines lazily, and parseControl stops after the first paragraph. * fix(deb): report unreadable tar modes as null A tar header whose mode field is not octal was reported as mode 0000, which invents a permission the archive never stated. Report the mode as null and add a malformed issue for the member, so coverage is partial. * fix(deb): refuse GNU sparse tar entries GNU PAX sparse headers (GNU.sparse.*) rename the following entry to a synthetic GNUSparseFile path and store only mapped segments, so reading it as a regular file reported the wrong name and size and could miss md5sums cross-checks. Old GNU sparse (S) entries can also carry extension blocks their size field does not count. Refuse both as an unsupported format instead of reporting wrong file facts. * refactor: use shared artifact inspection for Debian packages * fix(deb): report per-call budget refusals as parameter limits * Address review feedback * Address review feedback * fix(deb): bound xz decoding, inherit global PAX size, and redact Homepage URLs * fix(deb): bound xz index preflight memory and preserve typed cancellation with partial facts * fix(deb): bound nested relationship lists, align tar stored-body rule, and scope async parse * fix(deb): walk actual XZ block boundaries, scan control lines without arrays, and guard XZ close gate * refactor(deb): avoid throwaway filter arrays in DebPackageParser --------- Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> Co-authored-by: Matt Van Horn <mvanhorn@MacBook-Pro-10.local> |
||
|
|
14b4d1f7ad |
feat(firmware): inventory and extract UBI image volumes offline (#13333)
* feat(firmware): inventory and extract UBI image volumes offline * docs: name ubi-volume among compared format metadata kinds The artifact comparison contract lists every format metadata kind that compare_artifacts compares. ubi-volume now carries a declaration, so the contract names it beside the other members. * fix(firmware): keep UBI LEB ranges private to the reader entries() yielded copyArtifactEntry(entry), which spreads the private volume field by reference, so a caller could rewrite volume.ranges and change the bytes the next open() read. Yield only the public entry fields, and test that a returned entry carries no volume mapping. * fix(firmware): keep LEB source ranges in ubi-volume metadata Saved Evidence now records the lnum, PEB, image offset and length of each chosen LEB, so a reassembled volume can be traced to its image bytes. The image summary keeps counts. * fix(firmware): reject smaller UBI eraseblock sizes whose LEB padding is invalid A dynamic LEB with data_size 0 and data_pad equal to a smaller candidate LEB passed the size check, so a valid aligned image was refused as ambiguous. Require data_pad below the candidate LEB, as classifyUbiPeb and the volume table alignment rule already do. * fix(ubi): refuse a UBI# file shorter than its erase-counter header recognizeUbiImage recognized any 4 to 63 byte file starting with UBI# without a CRC or version to check, so open_binary accepted it as an archive and inventory labelled it a container. It now takes the file size and refuses a file that cannot hold the 64-byte header. A short prefix read from a longer file still defers to the reader. * fix(ubi): refuse a volume whose only surviving LEB copy failed its CRC When both competing PEBs for a LEB are wear-leveling copies and both fail their data CRC, the older failed copy still won and open() served bytes that had already failed verification. Mark that LEB unverified and refuse the volume with extract refusal unverified_copy, keeping its inventory. * fix(ubi): refuse an image whose EC headers disagree instead of skipping them Eraseblock discovery and both spacing checks skipped a valid erase-counter header whose image_seq or layout differed from PEB 0, treating it as absent. Alternating sequences or a conflicting second header then measured a multiple of the real eraseblock size and read the image, so a volume became an extractable empty or header-polluted volume. Any valid header now begins an eraseblock, and classifyUbiPeb and checkUbiPebs refuse the disagreement. * fix(ubi): rule out a smaller eraseblock size whose volume table is invalid The ambiguity check declared a smaller eraseblock size equally valid from erased header positions and LEB fit alone. With 128 KiB eraseblocks, data_offset 4096 and a volume of alignment 6144, data_pad is 4096, but a 64 KiB LEB would need data_pad 0, so that size cannot describe the image and a valid image was refused. The check now also requires a volume table copy to stay valid under the smaller geometry, and runs after the table copies are read. * fix(ubi): compare the volume ID in a UBI volume declaration The compared ubi-volume declaration left out the volume ID. A volume renumbered from ID 0 to ID 1 keeps its path and reconstructed bytes, so artifact comparison reported it unchanged even though consumers that address volumes by number now see a different volume. The declaration now includes the ID, and PEB placement stays out of it. * fix(ubi): refuse a volume with no mapped LEB when PEBs are corrupt When a volume's only data PEB had a bad EC or VID header CRC, classification dropped its mapping and reassembly read the absence of surviving headers as an empty volume: a static volume got used_ebs 0, a dynamic one zero LEBs, and both were served as extractable empty files. A corrupt PEB may have held that data, so a volume with no mapped LEB in an image with corrupt PEBs is now inventoried but refused as lost_lebs, with used_ebs null and a named limitation. An image without corrupt PEBs still reads an unmapped volume as empty. * fix(ubi): accept EC headers in static LEB data no smaller eraseblock holds A static volume holding a nested UBI image with the same EC layout puts valid EC headers on a smaller grid inside its payload. With 128 KiB eraseblocks, data_offset 4096 and full 126976-byte static LEBs, the spacing check and the smaller-grid scan refused such a header as a geometry conflict, though ubiSmallerPebSizeHoldsLebs already rules out every smaller size those LEBs would have to fit. Both scans now run their verdict after the PEBs and volume table copies are read, and set aside a header at a position only ruled-out sizes would begin at. A spacing conflict still takes precedence over later failures, and a header where a smaller size stays possible, as under dynamic LEBs, is still refused. * Address review feedback * Address review feedback * Address review feedback * Address review feedback * fix(ubi-image): carry parser limit facts through reader refusals parseFailure now passes the named parser limit and a typed parser fixedAllowance when it wraps a UBI limit refusal, so the 16 MiB eraseblock size ceiling and the 262,144-eraseblock count ceiling reach CLI and MCP with reported_limits and the fixed-ceiling recovery. * fix(ubi-image): ignore nested EC headers no eraseblock could begin at The second-header scan now skips headers inside the data the first PEB's own VID header declares, so a static LEB holding a nested UBI image no longer measures the eraseblock at the nested header. The spacing check now counts only headers at positions an eligible smaller eraseblock (dividing the measured size, larger than data_offset) would begin at, and after the LEBs are read only the sizes they still admit. A dynamic LEB holding a nested image of small eraseblocks parses the same in PEB 2 as in PEB 5. * fix(ubi-image): read only the first VID header within the eraseblock ceiling The eraseblock search read every byte from offset 0 through the first PEB's declared vid_hdr_offset to find its VID header. A CRC-valid EC header could declare an offset of 1 GiB and make the reader allocate a buffer that size before the eraseblock ceiling refused the image. ubiFirstVidHeaderOffset now admits the VID header only when it lies inside the file and the fixed eraseblock ceiling, and the reader reads just those 64 bytes. A header past the ceiling is never read, so the search reaches its bounded eraseblock-size refusal as before. * fix(ubi-image): skip EC headers whose offset cannot be the eraseblock size A dynamic VID header declares data_size 0, so a first PEB holding a nested UBI image only rules out the nested header at data_offset. The next nested header, 6144 bytes into a 128 KiB eraseblock, was taken as the eraseblock size and the valid 524288-byte image was refused as not a multiple of it. The second-header search now skips headers at offsets that do not divide the file size, since no eraseblock size could put them there. The first header at any offset is still kept for the refusal when no size fits. * fix(ubi-image): reject truncated dumps with misleading PEB headers * Address review feedback * Address review feedback * Address review feedback * Keep undersized UBI candidates provisional on valid VID extents A CRC-valid VID header whose data_pad and data_size do not fit a candidate LEB now records the eraseblock size it needs. A dividing candidate smaller than that stays retryable, with its image kept as the fallback, so a later candidate that holds every LEB in full is accepted. * Address review feedback * Address review feedback * Exercise the UBI PEB count ceiling in memory * fix: reject unrelated UBI header conflicts * fix: verify static UBI payloads before retrying geometry * fix: bound UBI static payload CRC work across PEB size candidates * fix: repair UBI integration after merging main * Address review feedback * fix: let cancellation retire paused UBI volume streams * test: synchronize paused UBI volume cancellation * fix: preserve UBI read failures during cancellation * perf(ubi): count PEB states and extractable volumes in one pass Replace the per-state .filter(...).length scans in assembleUbiImage and summarizeUbiImage with single loops, per docs/development/tool-design.md. * Address review feedback * fix(firmware): close UBI geometry ambiguity and corrupt-PEB tail gaps * fix(firmware): verify erased UBI PEB bodies and validate layout VID headers * fix(firmware): defer and cache UBI erased-body scans and deduplicate stream check helper * fix(firmware): eliminate quadratic UBI erased-range scans and cache dynamic copy CRCs * test(firmware): assert UBI erased-range coalescing, walk steps, and elapsed time * perf(ubi): cache EC header scan across block-size retries * fix(ubi): bound EC header scan cache and stream past cap --------- 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> |
||
|
|
47daa05a84 |
feat(pe): report the overlay appended after a PE image's last section (#13245)
* feat(pe): report the overlay appended after a PE image's last section * chore(schemas): add the inspect_pe_overlay schema summary * test(pe): expect the shared non-PE refusal message in MZ admission * test(cli): record completion goldens for inspect-pe-overlay * fix(pe): preserve overlay diagnostics and validate certificate spans Keep impossible security directory spans in measured overlay bytes and share bounded format recognition with inventory. Validate structured overlay facts in the domain while preserving provider diagnostics. * docs(pe): move the PE overlay guide under docs/guides * fix(pe): keep overlay format recognition within its probe * Address review feedback * fix(pe): keep header anomalies in the overlay report parsePeOverlay dropped pe_header_anomalies from readPeImage, so a SizeOfHeaders that ends before the section table reached the overlay report without its warning. Carry header_anomalies through the output contract and Evidence result, as the certificate, import and load config reports already do. * Address review feedback * fix(pe): report adjustable max_file_bytes budget and preserve omitted caller parameters in inspect_pe_overlay * fix(pe): preserve required_value on file-size limit and use executeArtifactInspection in PeOverlayService * chore(schemas): update inspect_pe_overlay advertised schema summary * fix(pe): include bflt in PE overlay leading formats * test(pe): import BINARY_DIAGNOSTICS_TOOL_CONTRACTS in PE overlay tests --------- Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> Co-authored-by: Matt Van Horn <mvanhorn@MacBook-Pro-10.local> |
||
|
|
2c89136469 |
feat(artifacts): inspect VS Code extension packages offline (#12469)
* feat(artifacts): inspect VS Code extension packages offline REA had no owner for a local .vsix ZIP. inspect_vsix_package and inspect-vsix-package now read extension.vsixmanifest and extension/package.json, report identity disagreements, engine range, activation events, a contributes summary, hashed native/wasm/executable members, and a ZIP inventory without installing the extension or contacting a marketplace. Missing or malformed manifests return the inventory with limitations. Invalid ZIP input fails without partial success. Signature files are reported present or absent and are not verified. * fix(vsix): bound vsixmanifest XML nodes before building the tree A compressed extension.vsixmanifest within the 16 MiB byte budget can still expand into millions of XML nodes. Count nodes as a stream first, as the Maven POM reader does, and refuse the manifest with an xml_nodes limit before parseXmlDocument allocates its document. * fix(vsix): report the vsixmanifest node ceiling as a fixed allowance The xml_nodes limit is a fixed parser ceiling, not a caller budget, so the provider fell through to a generic memory refusal that implied more memory could help. Map it through fixedAllowanceOptions as the Maven provider does and cover the public error from the provider. * refactor(vsix): classify provider failures through the shared owner VsixPackageProvider kept its own chain for cancellation, identity, path, selected-file and cleanup failures. It now supplies a dialect to classifyProviderFailure with only the package's own refusals: its parse ceilings and budget recovery, format failures, fixed reader allowances and the max_file_bytes refusal. The held snapshot still supplies the completed identity for a parser failure after the read. * fix(vsix): report an empty contributes key instead of failing the report A package.json with an empty contributes key produced a key with an empty name, which the contract refuses, so the whole inventory was rejected. The empty key is now left out of contributes.keys and reported as a limitation. * fix(vsix): charge member decoding to one package-wide budget Each hashed member was read with a fresh per-member budget, so a small compressed package with thousands of members could make the parser decode several GiB. Member reads now draw on one artifactExpansionBudgetBytes budget for the package; once it is spent, remaining members stay in the inventory without a digest and a limitation names the spent budget. * fix(vsix): resolve dot segments in package.json entry points packageJsonEntryPath stripped only one leading ./, so a main such as ./out/./extension.js named extension/out/./extension.js and was reported absent even when extension/out/extension.js existed. Entry points now resolve . and .. segments under extension/; a path that climbs out of extension/ keeps its unresolved form and matches no member. * fix(vsix): resolve entry points with the loader's lookup rules An extension-less main such as ./out/extension was looked up as a literal ZIP name and reported absent although Node resolves it to extension/out/extension.js. main now tries Node's CommonJS file and directory suffixes, browser tries the .js the web extension host adds, and the reported path is the member found. * fix(vsix): resolve a directory main through its own package.json Node's directory lookup reads the directory's package.json main before falling back to index files, so an entry like main: ./out with out/package.json naming ./start.js now resolves as present. * Address review feedback * fix(vsix): report interesting member sizes past 4 GiB A ZIP64 member can declare an uncompressed size above 0xffffffff while the compressed package stays under max_file_bytes. The parser skips hashing it and reports the declared size, but interesting_members[].bytes used the 32-bit uint schema, so the service rejected the whole report. The field now takes any nonnegative integer, matching contents[].uncompressed_size. * fix(vsix): report a malformed directory package.json instead of its index When main names a directory whose package.json is not a JSON object, Node's loader throws ERR_INVALID_PACKAGE_CONFIG rather than falling back to index.js. Keep that outcome distinct from a manifest with no usable main: mark the entry point absent and add a limitation naming the member. * fix(vsix): classify Java archives as nested archives A bundled .jar, .war or .ear is a ZIP, but the path classifier returned unknown for it, so it was never hashed or counted as a nested archive. * fix(vsix): match entry points by exact member case Resolve main and browser entry points against exact ZIP member names, as a case-sensitive file system would, and report a member that matches only when case is ignored as a limitation instead of marking the entry present. The directory package.json used to resolve a directory main is matched exactly too. * fix(vsix): keep directory-only intent for a trailing-slash main A main such as "./out/", ".", "..", or one ending in "/." or "/.." can only name a directory under Node's loader. Normalizing it to a bare path let a sibling file like extension/out.js match and report the entry as present. Carry a directory-only flag from the raw value and skip file candidates in the declared-path lookup and in the check that decides whether to read <main>/package.json. * fix(vsix): only blame case when the spelling differs The case-only entry point warning scanned index candidates even when a malformed directory package.json had already stopped the main lookup, so an exact extension/out/index.js could be reported as a case mismatch. Skip index candidates when the directory manifest is malformed, and skip any candidate whose member is spelled exactly as declared. * fix(vsix): stop main lookup at an over-budget directory package.json When main names a directory whose package.json exceeds max_manifest_bytes, its main is unknown, so falling back to index.* could report a file Node would not load. Treat the unread manifest like a malformed one: report main unresolved, add a limitation that says the index files were not used, and skip the index files in the case-only scan. * fix(vsix): resolve a main that normalizes to the package root A main of ".", "./" or "./out/.." normalized to "extension/", so the directory lookups searched "extension//package.json" and "extension//index.js" and reported a present index file as absent. Return "extension" for the root so those lookups name real members. * fix(vsix): stop main lookup at an unread directory package.json An encrypted or duplicated directory package.json left the directory main unresolved as "none", so lookup fell through to index files even though the unread manifest may name another file or be invalid. Mark it unread and stop the lookup, as the over-budget branch already does. * test(vsix): tag the decode-budget regression long-running The package-wide decode budget test passed a fixed 60-second deadline, which also turned off coverage and CI deadline scaling. Use the long-running tag the testing guide prescribes instead. * fix(vsix): leave unread dependency declarations unknown A missing, encrypted, or malformed manifest reported its extension dependencies and extension pack as empty lists, so a declaration on the other side showed up as a disagreement. Report the unread side as null and only flag a disagreement when both manifests were read. * fix(vsix): look up entry points by their literal text package.json main, browser, and a directory package.json main were trimmed before lookup. A ZIP member name can begin or end with whitespace and Node does not trim the specifier, so "./out/start.js " was reported absent or matched the different "out/start.js" member. Use the declared text as written; only an empty string names nothing. * fix(vsix): keep activation events literal before eager classification VS Code matches activation events as exact strings, so "* " and "onStartupFinished " are not startup activations. The parser read activationEvents through the whitespace-trimming ID helper, which turned those values into "*" and "onStartupFinished" and reported them as eager. Read activation events with a literal helper that drops only empty strings and exact duplicates, and cover the padded values next to their exact-name controls. * fix(vsix): keep mode-executable members inventoried when unread A member with no recognized suffix but Unix execute bits was only classified after its magic was read. When the hash budget, the package decode budget, encryption, or traversal skipped that read, it stayed unknown and fell out of interesting_members and the executable count. Unread mode-executable members now keep an inferred executable kind. * fix(vsix): count a singleton contributes.commands object VS Code accepts contributes.commands as one command object as well as an array. Normalize the singleton form before capping and counting so a package with one command reports commands_total 1 and the commands key count matches. * fix(vsix): keep contributed command identifiers literal VS Code registers and invokes a contributed command by its exact identifier, and the parser already keeps onCommand activation events literal. Commands went through the trimming text helper, so a declared "demo.run " was reported as "demo.run" next to an "onCommand:demo.run " event, giving two different identities for the same command. Keep the declared command text as written and report null only for an empty string. Titles are display text and stay trimmed. * fix(vsix): do not infer executables from symlink modes A Unix symlink entry carries 0o120777, so its permission bits made an unread link look like an executable helper. Only regular files, or entries with no recorded file type, now count toward mode-inferred executables. * style(vsix): apply oxfmt to manifest limit guard * fix(vsix): keep mode-executable kind when read bytes have no known magic A suffixless regular Unix member with execute bits but no recognized magic (for example a shell helper without a shebang) was listed as an executable only when the hash budget skipped its read. Raising the budget enough to hash it resolved the kind to unknown and dropped it from interesting_members and the executable count. Fall back to the mode-derived executable kind when the read bytes match no magic. * fix(vsix): charge failed member expansions to the package budget A member whose ZIP header understates its uncompressed size can decode its whole allowance before the bounded writer refuses it. That work was not charged to the package-wide decode budget, so every later failing member got the same allowance again. Charge the allowance on a max_member_bytes failure so later members see the spent budget. * fix(vsix): bound JSON values before parsing manifests Both package.json readers called JSON.parse after a byte-only check, so a 16 MiB manifest of many tiny values could allocate far more memory than its text. A one-pass countJsonValues scan now runs first: an extension/package.json holding more than 1,048,576 values is refused with a fixed json_values parser allowance, and an over-allowance directory package.json is left unread with a limitation, so its index files are not used. * Address review feedback * fix(vsix): treat absolute directory package.json main as outside the package Node resolves a directory package main with path.resolve(dir, main), so an absolute main names a host file, never a package member. Report it as no main so the lookup falls back to index.* or reports the entry absent. * fix(vsix): tag escaped entry points instead of matching them as members A package.json main or browser that climbs out of extension/ was kept as an ordinary member path string. A traversal ZIP member with the same name (extension/../outside.js) is in the inventory, so the lookup reported the entry point present even though that member is never extracted. packageJsonEntryPath now returns a tagged resolved/escaped value. Escaped entry points skip the member, directory manifest and case-only lookups and are reported with present: false. * fix(vsix): decode directory package.json as UTF-8 like Node Node reads a nested package.json as UTF-8 only. A UTF-16 manifest fails with ERR_INVALID_PACKAGE_CONFIG, so report it malformed instead of transcoding it and marking main present. * fix(vsix): keep directory package.json main inside the extension root A directory package.json main such as ../../outside.js could pop the extension segment and resolve to an archive-root member, which was then reported as the present main entry point. Treat any main that climbs out of extension/ as naming no main, so the lookup falls back to index.* or reports the entry absent. * fix(vsix): keep a root directory main from matching archive-root files A nested package.json main such as ".." in extension/out resolves to the extension root itself. Trying file suffixes on that path matched an archive-root extension.js, which sits outside the installed payload. Mark such a main directoryOnly and resolve it through extension/index.* only, as Node does. * fix(vsix): skip member reads once the package decode budget is spent A compressed member declaring zero uncompressed bytes passed the declared-size check even with no package allowance left, so its decoder still ran and produced output before the writer rejected it. The failure then charged zero, letting each later zero-declared member decompress again past the package ceiling. Skip the read and report the spent budget once nothing remains. * fix(vsix): keep declared API proposal names literal Read enabledApiProposals with the literal list reader used for activation events. VS Code matches proposal names exactly, so trimming whitespace or splitting on commas reported identifiers the package never declared and collapsed declarations that differ only in surrounding whitespace. * fix(vsix): select manifests by their exact member path Count ZIP members by exact logical path. A package holding only extension/Package.json no longer has it parsed as extension/package.json, and a case-only sibling no longer marks the real lowercase manifest as a duplicate and drops its facts. Names that differ only in case, and a manifest present only under another case, are reported as their own limitations. * fix(vsix): treat shared libraries as interesting members Bundled .dll, .so (including versioned .so.N names) and .dylib files without Unix execute bits were classified unknown, so their magic was never read and they were missing from interesting_members and the summary count. Classify these suffixes as executable so they are hashed and listed like .exe and .node members. * refactor(vsix): run inspection through the shared artifact runner VsixPackageService now delegates input parsing, the provider call, output checks, Evidence creation and late cancellation to executeArtifactInspection, as NugetNupkgService does, keeping only the VSIX-specific report checks. * feat(vsix): point first-contact inspection of a .vsix to the VSIX reader inspect_artifact now suggests inspect_vsix_package when a ZIP holds a root extension.vsixmanifest file. The non-ZIP refusal test follows main's unsupported_target classification for malformed target bytes. * fix(vsix): align artifact failures with main * fix(vsix): bound inspect_vsix_package output with shared detail/summary contract * Address review feedback * fix(vsix): bound summary text fields and report structured parameter limits * fix(vsix): omit required_value on early-stop parameter limits * refactor(vsix): count eager activation events without intermediate array --------- Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: Matt Van Horn <mvanhorn@MacBook-Pro-10.local> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> |
||
|
|
a140853e9f |
fix(elf): read eight-byte DT_HASH entries on 64-bit s390x and Alpha (#14630)
* fix(elf): read eight-byte DT_HASH entries on 64-bit s390x and Alpha On ELF64 s390x and Alpha every SysV hash entry (nbucket, nchain, buckets and chains) is eight bytes wide; binutils readelf and glibc read them that way and ld writes .hash with sh_entsize 8. The shared DT_HASH walker always read 32-bit words, so on a big-endian s390x table it took the high half of nbucket as the bucket count and the low half as nchain. On Debian wheezy's s390x libz.so.1.2.7 (nbucket 97, nchain 105) this made inspect-elf-dependencies report a false ".dynsym section declares 105 symbols, past the DT_HASH dynamic symbol count of 97" issue with partial coverage, and inspect-native-exports refuse the same library without section headers because DT_HASH (97) and DT_GNU_HASH (105) disagreed. The walker now takes the entry layout from e_machine, the ELF class and the byte order, and the dependency parser and both PT_DYNAMIC export paths pass it. * test(elf): cover eight-byte DT_HASH reads from a file handle The s390x and Alpha .hash fixture now declares sh_entsize 8 to match the entries it writes, and the sectionless export cases also run through parseNativeExportsFromHandle, including a wide header that crosses the end of its load mapping. --------- Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com> |
||
|
|
c536c67ee1 |
fix(cli): deliver an unretained non-idempotent result complete
When the retained-Evidence cache could not keep an over-budget result, the CLI delivered its summary with rerun arguments. Rerunning a non-idempotent operation does not reproduce it: an extraction that created its output root refuses the same root. Each CLI delivery now knows whether its contract is idempotent, and a non-idempotent result the cache does not keep is delivered complete. Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
7f07cab954 |
fix(analysis-view): bound extraction summary samples by bytes
The extraction summary sampled 16 rows of each list by count only. One integrity contradiction can carry tens of kilobytes of signer names, so a sample alone could exceed the agent result budget. Each sample now also stays within 4,096 serialized bytes; omitted counts the rest, which the collection still pages. Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
2b69ddd368 |
fix(android)!: page class-name search by default and name the next offset
search_android_classes returned every match when limit was omitted, and an empty query lists every class. On VLC's APK that was 15,310 names and 809,004 bytes of MCP content. A page that stopped early reported only coverage "partial", so a caller could not tell where the next page began. Omitted limit now returns at most 256 matches, and the result reports next_offset: the offset of the following page, or null when no match follows. JADX already stops once the page and one more match are found, so a filtered search still needs a single provider call. On the same APK the empty query now returns 256 names in 27,105 bytes of CLI JSON. BREAKING CHANGE: a search_android_classes call that omits limit returns at most 256 matches. Page with next_offset, or pass a larger limit. Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
981dd11ec4 |
feat(artifacts)!: budget extract_artifact delivery
extract_artifact returned every written file inline. Extracting VLC's APK through MCP returned 1,214,138 bytes of content, beside the same structured result, for a call whose files are already on disk. extract_artifact now takes detail and joins the agent result budget. Omitted, an extraction that fits delivery.agent_result_budget_bytes is inline and a larger one is retained behind its artifact-extraction summary; detail never reaches the provider. The CLI uses the shared Evidence delivery. The same APK now returns a 14,592-byte summary, and a lib/** page of its native libraries 12,472 bytes. BREAKING CHANGE: an extract_artifact call that omits detail on an extraction above the agent result budget now returns the retained summary. Pass detail: "complete" (--detail complete) for the previous shape. Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
0c59c2ed4e |
fix(maven): read Maven 4.1.0 model POMs (#14089)
inspect-maven-gradle-metadata accepted only the http://maven.apache.org/POM/4.0.0 namespace, so every Maven 4 POM in the 4.1.0 model namespace was refused as "not a Maven project POM". Classify a project root in any http://maven.apache.org/POM/ namespace as a POM, as Maven 4's DefaultModelXmlFactory does, and read the 4.0.0 and 4.1.0 models with the same rules. Other model namespaces are refused with a specific unsupported_target reason. A 4.1.0 model imports managed bom-typed rows and carries a limitation that Maven 4 parent and reactor coordinate inference was not applied. Co-authored-by: aadheel <250292080+aadheel@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com> |
||
|
|
a35bfb9098 |
fix(signals): report an unsupported host as a capability limit (#14127)
A non-Linux host threw a plain Error from the configuration phase, so the shared classifier produced a capability refusal whose recovery only described configuring REA_SIGROK_COMMAND on Linux. That repair can never succeed on the host that produced the refusal, and no fact said the host itself was the limit. Give the host check its own owner with a host-only reason and remediation, mirroring the packet-capture boundary, and keep the tool-path message for the REA_SIGROK_COMMAND branch. Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com> |
||
|
|
f3aecfa5ec |
fix(android): bound the JNI summary preview by bytes with its relations
Sixteen previewed bindings could still exceed the agent result budget: one static registration candidate can name hundreds of same-signature declarations, and previewing a binding pulled every one of them in. The preview now admits selected declaration IDs and bindings in order while they, with the candidates and declarations each adds, fit 16 KiB, and libraries while they fit 8 KiB, each at most 16 rows. Counts and pages still cover everything. VLC's summary is unchanged at 23,806 bytes. Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
52ae41a4a4 |
test(artifacts): read ASAR occurrence limitations from extracted file rows
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
bd3c265212 |
fix(artifacts): keep ZIP coverage on the byte account alone
zipListingCoverage decided complete coverage from an empty limitation list, so the reader-level ./ prefix note made a fully accounted ZIP report unknown coverage, and extraction then warned that its output was not a complete source copy. Coverage now follows the byte-accounting gaps; the prefix note is listed after them. Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
72ef5d20e0 |
fix(artifacts): note omitted ./ member prefixes once per ZIP or tar reader
The ZIP and tar readers each added one limitation per member whose leading ./ they omitted from its logical path, and each restated the prefix rule. "tar czf app.tgz -C dir ." prefixes every member, so a 297-file archive carried 297 such limitations. Every such occurrence already keeps its recorded name in source_path. Both readers now use one withoutCurrentDirectoryPrefix rule and report a single reader-level limitation counting the prefixed members. A Playwright trace whose member names were only prefixed now reports scoped rather than partial interpretation, and SAZ members keep their recorded path beside the logical path without a prefix limitation. Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
0a80c0bee2 |
fix(artifacts): keep each extracted file's limitations on that file
extract_artifact copied every selected occurrence's limitations into its own list, prefixed with the path. Extracting VLC's APK listed 862 limitations, 858 of them case-folding collisions between R8-shrunk resource names, and repeated them in the Evidence envelope. Each written file now carries its occurrence's limitations in artifacts[].limitations, absent when it has none, and the extraction's own list counts the files that carry them. The file digest and extraction ID are unchanged: they cover the written files, not their limitations. The same APK's extraction now lists 5 limitations. Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
b827326ef3 |
fix(android): preview 16 JNI bindings and libraries in the summary
The inspect_android_jni_bindings summary previewed 64 bindings with their declaration and candidate closure, and every selected library. That predates the agent result budget, and on VLC's APK the summary delivered when the report was over budget was 57,491 bytes, larger than the 32,768 byte budget it replaced. The summary now previews 16 bindings, their closure and 16 libraries, and reports library_coverage beside the existing declaration coverage. Counts still describe the full selection and every collection pages through the android-jni view. The same APK's summary is now 23,806 bytes. Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
8575dfe370 |
fix(hopper): refuse downloads redirected to another origin (#6700)
* fix(hopper): refuse downloads redirected to another origin * test(hopper): cover download redirect origins * Check redirect protocol before origin so downgrades keep non_https * style: apply oxfmt to HopperDownload.ts --------- Co-authored-by: Dextheking1 <Dextheking1@users.noreply.github.com> Co-authored-by: benjaminkincses <4175097+benjaminkincses@users.noreply.github.com> Co-authored-by: Ysopwnable <161784452+N0zoM1z0@users.noreply.github.com> |
||
|
|
b1e8aa8b19 |
fix(setup): run the macOS Hopper installer's tools from /usr/bin
The macOS Hopper installer ran hdiutil, codesign, ditto and open through REA's PATH. Its two codesign checks decide whether setup installs and opens the downloaded app, so a codesign earlier on PATH that exits 0 passed the publisher check, while the launch-time check of the same publisher already runs /usr/bin/codesign. The DMG reader and the bridge launcher likewise run /usr/bin/hdiutil and /usr/bin/open. The installer now runs each tool from its macOS system path, and the setup disclosure names the executable that runs. Tests: a boundary test puts stand-in codesign, hdiutil and open on PATH. Before this change the stand-in codesign made validBundle return verified; now no stand-in runs. The disclosure test expects /usr/bin/codesign. |
||
|
|
3e8f6a43a9 |
feat(artifacts): decode Android Verified Boot vbmeta images offline (#13239)
* feat(artifacts): decode Android Verified Boot vbmeta images offline
* fix(artifacts): locate vbmeta tail-length failures at their length fields
* fix(artifacts): make vbmeta admission budgets adjustable per call
* fix(firmware): refuse vbmeta fields too long to hex-encode
With raised descriptor_bytes and auxiliary_block_bytes limits, a valid
KERNEL_CMDLINE longer than half the host string bound passed the byte
limits, and toString("hex") then threw ERR_STRING_TOO_LONG, which
surfaced as an I/O error. Check the field against the host bound before
hex encoding and report a typed capacity failure with its own limit.
* fix(firmware): check vbmeta extents before admission budgets
A header whose declared blocks do not fit the file, or whose descriptor
range does not fit its auxiliary block, now reports truncation or a
malformed range instead of a limit a larger budget cannot repair. The
over-budget fixtures are now fully present so they still prove the limit.
* perf(firmware): count vbmeta descriptor tags in one pass and reuse readers
The summary counts every descriptor tag in a single loop instead of six
filtered arrays, and androidVbmeta reuses one BinaryReader per buffer.
The malformed-header refusal fixtures follow main's unsupported_target
classification for malformed target bytes.
* chore: regenerate advertised schema hash after merging main
* docs(android-vbmeta): name unsupported_target for structural refusals
Malformed vbmeta headers classify as unsupported_target, not
invalid_request, matching analysisErrorClassification and the refusal
fixtures.
* chore: regenerate advertised schema hashes after merging main
* chore: regenerate advertised schema hashes after merging main
* fix: restore Android vbmeta artifact reader after merging main
* test(artifacts): expect partial for the CLI vbmeta descriptor refusal
* feat(artifacts): preserve vbmeta descriptor bytes and partial refusals
Co-authored-by: iamcipherdev <268238676+iamcipherdev@users.noreply.github.com>
* fix(artifacts): use Buffer.equals in vbmeta tests and update advertised schema summaries
---------
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: Vincent Koc <vincentkoc@ieee.org>
Co-authored-by: iamcipherdev <268238676+iamcipherdev@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
|