mirror of
https://github.com/morluto/rea.git
synced 2026-12-06 14:59:05 +00:00
06d1cafd2ec6d1863d77fdcdc271a3cca4df2038
178
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e5004c11ea |
feat(managed): recover protobuf descriptors from .NET assemblies (#17287)
* feat(managed): describe the protobuf descriptor recovery report and its budget Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(managed): recover protobuf descriptors from generated Reflection classes Google.Protobuf's generated <File>Reflection classes build each FileDescriptorProto in a static constructor that concatenates string literals and passes them to System.Convert.FromBase64String. Read those literals from the CIL in order, decode each site and keep the results that parse as FileDescriptorProtos, byte for byte. A FileDescriptorSet lists them dependencies first, with the well-known protobuf files they import; other imports are named as missing. Literal characters count against max_descriptor_bytes before they are joined. Nothing is loaded or run. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(managed): report descriptor recovery refusals as parse failures A metadata representation budget stops the whole call as a named limit, including inside one static constructor; other managed reader refusals become malformed or unsupported input. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(managed): recover protobuf descriptors through an identity-checked provider The provider reads one bounded managed assembly. A refusal at max_descriptor_bytes, max_metadata_representation_bytes or max_snapshot_bytes names the control to raise. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(analysis): summarize retained protobuf descriptor recovery Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(managed): add the recover_protobuf_descriptors tool CLI recover-protobuf-descriptors and MCP recover_protobuf_descriptors return each embedded .proto file's package, imports, messages, enums and services, and a FileDescriptorSet for decoding captured payloads. Large reports return the retained per-file summary within the agent budget. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * test(managed): cover protobuf descriptor recovery through the service, MCP and CLI The protoc-style assembly fixture moves to tests/fixtures so the unit, MCP and CLI tests share it. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * docs(managed): describe protobuf descriptor recovery Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * docs(skill): route Google.Protobuf assemblies to recover_protobuf_descriptors Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * ci: scope protobuf descriptor recovery with the managed formats Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * chore(schemas): record the advertised recover_protobuf_descriptors catalog summary Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(managed): attribute, bound and account for every descriptor search - Static constructors are found among physical MethodDef rows and named by the shared ownership lookup, so a MethodPtr table cannot attribute a descriptor to the wrong type. - A FileDescriptorProto's wire form is walked along its schema first, and every nested message it would create is charged to the representation budget before protobuf-es decodes it. - A body whose CIL was not fully decoded, and malformed member lists, make coverage partial instead of looking searched. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * test(managed): build descriptor fixtures in protoc's String.Concat shapes The fixture's static constructor now joins its literals through String.Concat, as arguments or a string[], before calling FromBase64String with its real static byte[](string) signature; the managed PE fixture can name each MemberRef row. Tests cover both forms and the descriptor tree bound. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(analysis): sample missing imports in the protobuf descriptor summary Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * docs(managed): save the descriptor set from complete delivery and fail on null Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(managed): name the descriptor nesting limit instead of rejecting deep files The nesting cutoff is now the max_descriptor_depth control (100 by default, up to 1,000). A deeper descriptor stops the call with a named limit rather than being listed as not a descriptor, and protobuf-es decodes up to the same depth so it cannot refuse what the walk admitted. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * docs(managed): list the descriptor depth budget and record its schema Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> --------- Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
e1b66df5bc |
feat(native): recover UniFFI library interfaces from exports (#17215)
* feat(native): describe the UniFFI library report and its read budgets Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(native): recover UniFFI interfaces from a library's exports Group a library's UniFFI scaffolding exports by namespace: objects named by their free and clone functions with their constructors and methods, functions, callback interfaces and runtime helpers. The contract version and each item's checksum are read from function bodies that return only that constant (x86, x86-64 with or without endbr, arm64), and NAMESPACE and UDL_FILE metadata buffers are decoded. Nothing is called; a method that two object names could own is listed under the longer and counted. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(native): read UniFFI libraries through an identity-checked provider The provider reads one bounded PE or ELF file, maps its export addresses through the image's own declarations and decodes the UniFFI interface. A refusal at max_entries, max_text_bytes or max_file_bytes names the budget to raise. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(analysis): summarize retained UniFFI library reports Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * refactor(analysis): bound the UniFFI summary's namespaces with boundedList Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(native): add the inspect_uniffi_library tool CLI inspect-uniffi-library and MCP inspect_uniffi_library recover a UniFFI library's namespaces, objects, methods, functions, callback interfaces, contract version and checksums from its exports without loading it. Large reports return the retained per-namespace summary within the agent budget. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * docs(native): describe UniFFI interface recovery Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * docs(skill): route UniFFI libraries to inspect_uniffi_library Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * ci: scope the UniFFI reader with the native formats Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * chore(schemas): record the advertised inspect_uniffi_library catalog summary Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(native): keep UniFFI grouping linear and its omissions visible - Namespaces, metadata owners and object owners are found by looking up each underscore-delimited prefix of a name, instead of scanning every namespace or object for every export. - A body or metadata buffer reads the longest mapped prefix, so a constant that ends at its mapping's end is still decoded. - A metadata buffer that cannot be read or decoded is counted apart from kinds this reader does not decode, and makes coverage partial. - A partial export table carries its reasons into the report. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(native): expose max_structure_bytes for UniFFI library inspection The export reader's table-size limit is now a caller control, and its refusal names it, as inspect_native_exports does. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(cli): honour delivery options for inspect-uniffi-library Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * docs(native): list the UniFFI structure budget and record its schema Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(native): match UniFFI namespaces and owners with a prefix trie Namespaces, metadata owners and object owners are now found by walking the name once through a trie of the known words, from the positions where UniFFI spells them. The cost per name grows with its length, not with its underscore count squared or with the number of known words. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(native): index UniFFI prefixes by hash instead of a character trie A character trie allocated a node and a map for every distinct prefix, so long crafted export names could exhaust the heap before the report's text checks. The prefix index now keeps one entry per known word, keyed by two polynomial hashes, and walks each name once computing the hashes of its underscore-ended prefixes; only the longest matches are compared. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(native): map UniFFI reads through one index and check namespace shapes - Constant and metadata reads use one file-mapping index built with the image's zero-filled ranges, so each read is a lookup and an ambiguous address reads as unknown instead of as definite bytes. - The ELF container read honours max_structure_bytes, as the export read already did. - 32-bit x86 images, which the shared readers name 386, decode their constants. - A scaffolding symbol belongs to the longest namespace whose remainder has a scaffolding shape, so a namespace ending in _fn cannot take another namespace's functions. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(native): carry the export reader's issues into a partial UniFFI report A partial export table now reports its first issues by code and message, counting the rest, before falling back to its limitations. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(native): consider every shaped namespace match for UniFFI symbols The scaffolding shape after a namespace is now checked while the name is walked, so every span followed by _fn_ or _checksum_ is a candidate, not only the longest four matches; only the chosen word is compared. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> --------- Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
e5945805a4 |
feat(managed): inspect WPF BAML documents (#17167)
* feat(managed): generate WPF's known BAML type and property IDs BAML names WPF's own types, properties and strings by negative IDs. The table is generated from KnownTypes.cs and Baml2006KnownTypes.cs at a pinned dotnet/wpf commit, with the source digests recorded and the MIT license preserved. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(managed): describe the BAML document report and its read budgets Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(managed): decode BAML record streams into their element tree Read the BAML 0.96 records WPF's Baml2006Reader reads, without loading any type: the element tree with names, keys and code-behind connection IDs; property values with their converters, markup extensions and known binary serializers; dictionary keys and their static resources from the deferred key section; bindings and resource references. WPF's own types, properties and strings are named from the generated known-type table. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(analysis): summarize retained BAML documents Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(managed): read BAML files through an identity-checked provider The provider reads one bounded regular file and decodes it; a refusal at max_records, max_elements or max_file_bytes names the budget to raise. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(managed): add the inspect_baml tool CLI inspect-baml and MCP inspect_baml decode a WPF BAML document, such as a view extracted from <Assembly>.g.resources, without loading WPF or the document's assemblies. Large reports return the retained summary within the agent budget. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(artifacts): point .NET resource sets with BAML views at inspect_baml A resource set now proposes extraction, and inspect_baml when it holds .baml members. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * docs(managed): describe WPF BAML document inspection Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * docs(skill): route extracted BAML views to inspect_baml Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * ci: scope the BAML reader with the managed formats Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * build: expose the BAML provider and its identity as dotnet entry files Composition constructs the provider and the capability declarations name its identity, as they do for the managed static provider. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * refactor(managed): fold BAML coverage through the coverage accumulator Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * refactor(managed): refuse oversized BAML files through the shared parse-limit owner Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * chore(schemas): record the advertised inspect_baml catalog summary Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * build: fetch the pinned WPF sources for the BAML known-type table The generator now downloads KnownTypes.cs and Baml2006KnownTypes.cs at the pinned dotnet/wpf commit and checks their recorded digests, instead of reading a caller-supplied checkout, and runs as npm run generate:wpf-baml-known-types. The regenerated table is unchanged. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * test(managed): cover inspect-baml through the CLI and declare its conformance case Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(artifacts): recognise BAML documents and route them to inspect_baml A file that starts with the MSBAML FormatVersion header is a standalone baml artifact; inspect_artifact proposes inspect_baml for it, as it does for other formats a dedicated tool reads. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(managed): add a max_text_bytes budget for reported BAML text Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(managed): bound BAML expansion and validate its nesting and dictionaries - Every reported copy of a declared name counts against max_text_bytes, so repeated references to one long name cannot expand without bound. - The nearest open element is kept on its own stack, and a property or constructor scope must open directly inside an element. - Deferred content must fit its document and enclosing section; each dictionary key's value position must start a value element. - Bindings inside MultiBinding or PriorityBinding report the container's target property. - A test names WPF's known IDs by the literal numbers of the pinned source. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * docs(managed): describe BAML recognition and the text budget Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * chore(schemas): record the inspect_baml max_text_bytes input Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(managed): inherit BAML binding targets instead of walking ancestors Each element records the binding target it inherits, so a binding inside nested MultiBinding or PriorityBinding containers resolves its target in constant time. TemplateBinding and resource-extension elements now also charge their reported copies against max_text_bytes. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(managed): count declared BAML type and assembly names against the text budget Every declared type reports its assembly's name, so many types can repeat one long assembly name; those copies now count against max_text_bytes too. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> --------- Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
c2960db49f |
feat(artifacts): inventory resources embedded in .NET assemblies (#17105)
* refactor(managed): read ManifestResource rows and the CLI Resources directory separately Split a ManifestResource row's columns from its data, so a caller that holds only the metadata can list resources, and let the CLI header prefix report its Resources directory when it is read that far. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(artifacts): bound .NET assembly manifest resource admission Add the dotnet_assembly reader limit group: the resource count follows the session member count, and metadata bytes bound the CLI metadata read to list ManifestResource rows. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(artifacts): locate a managed image's metadata and Resources directory Read only the PE headers, section table and CLI header to find where a managed image keeps its metadata and embedded manifest resources, so recognition does not load the image. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(artifacts): list the manifest resources a .NET assembly embeds Add the dotnet-assembly reader. It reads the ManifestResource rows from the CLI metadata and lists each resource embedded in the Resources directory as its stored bytes. Linked resources are named in the root metadata, since their bytes live in other files. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(artifacts): open managed assemblies with embedded resources as containers A PE whose CLI header declares a Resources directory, and that carries no other package, now inventories as dotnet-assembly, so a WPF assembly's .g.resources can be extracted and inspected as a resource set. Managed inspection still leads its next probes; extraction follows. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * docs(managed): describe resources embedded in a .NET assembly Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * docs(skill): route assemblies with embedded resources to extraction Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * ci: scope the .NET assembly resource reader with the managed formats Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(artifacts): keep located managed directories inside the file A section can declare raw data past the end of the file. A metadata or Resources directory mapped there is now malformed at location, instead of failing the later exact read. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(artifacts): report invalid manifest resource rows once Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(artifacts): require a complete CLI header before locating managed directories Check the declared header size against the 72-byte header and the CLI directory, and that the whole header lies in the file, as the managed PE reader does. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * test(managed): build fixtures that embed several manifest resources Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(artifacts): inventory manifest resource names as flat keys Names such as `a` and `a/b` are distinct resources. Inventory keeps both, as it does for resource set names; extraction still refuses to write conflicting paths together. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(artifacts): add decode and retained-name controls for .NET assemblies Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(artifacts): bound assembly resource names and keep readable rows The metadata decode budget is now the group's representation_bytes control, so a refusal names a field the caller can raise. Every listed name counts against retained_name_bytes before output is built, since rows can share one stored name. A row whose name cannot be read is skipped and counted instead of refusing the whole assembly. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * docs(managed): list the .NET assembly reader controls Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * refactor(artifacts): pass the classified managed location to the assembly reader Classification carries the located metadata and Resources directory in a typed admission for the same descriptor, so the reader does not locate them again. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(artifacts): explain a damaged CLI Resources directory on extraction Extraction now refuses such a PE with the location's reason instead of reporting that the format has no reader. Inspection keeps the PE root, where managed inspection reports the CLI header. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(artifacts): require the CLI header's declared size inside the file Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> --------- Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
c07901b9c9 |
feat(artifacts): inventory and extract .NET resource sets (#17072)
* feat(managed): decode .NET resource set headers and values Parse the ResourceManager and RuntimeResourceSet headers of a .resources stream, its name table and each entry's type code and payload range, as System.Resources.ResourceReader lays them out. Fixed-size primitives get a decoded value; strings, byte arrays and streams are payload ranges; serialized user types are named from the type table and never decoded. The test fixture writes resource sets the way ResourceWriter does, and its output is byte-identical to .NET Framework 4.8 ResourceWriter for the same values. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(artifacts): bound .NET resource set admission Add the dotnet_resources reader limit group: the resource count follows the session member count, and the type count and header bytes bound what a reader holds before it reaches the data section. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(artifacts): read .NET resource sets as members Serve each named resource of a .resources stream as a member whose bytes are one range of the set: a string's UTF-8 bytes, a byte array's or stream's payload, or a primitive's stored bytes with its decoded value in the entry metadata. Serialized objects are listed by type name. Names that are not safe paths, malformed values, hash table damage and version 1 sets are reported as limitations. Entry heads are read through windows of the data section in offset order, so a large set costs few reads. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(artifacts): recognize .NET resource sets for inventory and extraction Claim a .resources stream by its 0xBEEFCACE magic and a usable ResourceManager header, open it as an archive target, and register the extractable dotnet-resources container so inspect_artifact, extract_artifact and inventory views reach its members. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * test(artifacts): cover .NET resource sets through the artifact provider Open a resource set as a target, inventory its members with value facts, extract payloads, and recover from a resource count limit. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * docs(managed): document .NET resource set inventory Describe how resource sets are recognized, what each member's bytes and metadata hold, which values stay unknown, extraction, and reader admission. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * docs(reference): list .NET resource set limits and compared metadata Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * docs(skill): route .NET resource sets to artifact inventory Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * refactor(managed): read resource set fields through BinaryReader Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * docs(skill): sync the Cursor plugin skill Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * test(artifacts): select the .NET resource count among explicit member counts Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * test(artifacts): resolve .NET resource limits from the member count setting Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(managed): reject negative type codes and show Local dates as UTC instants A version 2 type code decoded as a negative Int32 is malformed, so the entry is omitted instead of failing the metadata schema. DateTime.ToBinary stores a Local value's UTC instant, so it is shown with a Z suffix like a Utc value. Name records are read without decoding, so callers can bound decoded names. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(artifacts): bound retained .NET resource names Count every decoded name, including names several table entries share, against dotnet_resources.retained_name_bytes. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(artifacts): bound shared resource names and keep neighbors' data ranges Entry data ranges now come from every record with a data offset, so an entry whose name does not decode no longer extends its neighbor. Decoded names are charged against retained_name_bytes; a set that exceeds it keeps the members read before the limit. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(artifacts): inventory .NET resource names that collide as paths Resource names are flat keys, so a and a/b are distinct resources. Inventory lists both, as for PyInstaller, Bun and Deno members, and extraction still refuses to write colliding destinations together. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * docs(managed): describe resource name limits, flat keys and DateTime instants Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * refactor(managed): report resource set header failures through ParseFailureError The header parser now throws the shared parse failure with the format, offset and field: truncated with the available and required bytes, unsupported for a set version ResourceReader does not read, limit naming the exceeded artifact_limits.dotnet_resources field, and malformed otherwise. Name and value decoders take the caller's BinaryReader instead of allocating one per record, and the metadata schemas live in formatMetadata. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(artifacts): report the full retained name requirement in bytes The retained name refusal now names every reference's bytes, which are known before decoding, so retrying with that value succeeds, and both byte allowances report the bytes unit. The reader maps shared parse failures, grows its header read on truncation inside the set, and holds one reader per name section and data window. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * ci: select the Apple artifact lane for .NET resource set changes Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * docs(cli): show .NET resource set inventory and extraction Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * docs(skill): describe .NET resource set members for agents Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> --------- Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
7bdf9d47dd |
docs: rebuild the README around the website and real showcase images (#16929)
* docs: rebuild the README around the website and real showcase images Shorten the README to a hero, a short setup section and six showcase rows, each with an image built from a real capture of its case study. Move setup detail, the FAQ and updates to rea.tools, keep one Discord link, and remove unsourced community and star numbers. Rewrite all 26 translations to match. The in-page README link test now proves parsing by counting headings, since a README may have no in-page links. * docs: say the dinosaur speed grows while it is below 13 The recovered rule adds 0.001 only while the speed is below 13, so the speed ends just above 13 rather than stopping at it. Match the homepage wording in the README image, its alt text and all translations. |
||
|
|
33b2763423 |
feat(artifacts): inspect PlayStation PS-X EXE headers (#16251)
* feat(artifacts): inspect PlayStation PS-X EXE headers A file starting with the PS-X EXE magic is inventoried as psx-exe. Root metadata reports the initial PC and GP, the text, data and BSS ranges, the stack base and offset with the initial SP, the region marker and its licensed region, and whether the file length agrees with 0x800 plus the declared text size. header.bin and text.bin are stored ranges; text.bin carries its load address and holds only the bytes present. A file shorter or longer than the declared text, or a text size that is not a whole number of 2048-byte sectors, leaves coverage unknown with the offset involved. A file that ends inside the header is refused as truncated with the offset where it ends. Nothing is executed. * fix(artifacts): read PS-X EXE fields through BinaryReader and match regions exactly A region marker such as constructor matched an inherited property of the region table, so the metadata held a function and inventory failed when it was cloned. Regions now come from a Map. Header words are read through BinaryReader instead of a local decoder. The fixture writes literal offsets with distinct non-zero values, including data and a stack offset, and the guide says inventory reads the members to hash them. * fix(artifacts): validate PS-X file sizes and name the omitted text member * test(artifacts): extract PS-X EXE members in the reader test * style(artifacts): format the PS-X reader test --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> |
||
|
|
d28ee2b639 |
feat(model): inspect PyTorch checkpoints and pickle opcodes statically (#16257)
* feat(model): inspect PyTorch checkpoints and pickle opcodes statically inspect_model_artifact now reads PyTorch ZIP checkpoints, legacy torch.save files and protocol 2-5 pickle streams without unpickling. A bounded static walker (protocols 0-5) reports each stream's protocol and opcode counts and every GLOBAL, STACK_GLOBAL, INST, OBJ, REDUCE, NEWOBJ, BUILD and EXT reference with its offset, marking callables outside PyTorch's tensor-rebuild allow-list as observations of what loading would import or call. ZIP checkpoints report their archive prefix, version, byteorder and serialization records and each referenced data/<key> storage; legacy files locate every storage in the file. State-dict tensors get dtype, shape, byte span and parameter counts, and names when one unshared key path reaches them. Malformed opcodes, truncation and memo misuse are target failures with their offset; max_pickle_opcodes and max_pickle_memo_entries bound the walk. Refs #3652 * fix(model): address pickle walker and PyTorch interpretation review findings - push APPENDS/ADDITEMS values one at a time instead of spreading them - replace an equal key on SETITEM(S), as unpickling does - refuse a FRAME longer than the remaining stream as truncated - decode BINUNICODE with surrogatepass and validate raw-unicode-escape text - unwrap _rebuild_parameter chains iteratively - resolve tensor key paths once per node and charge names before building them - inventory every storage persistent ID and require its storage bytes - bound archive records in the MCP summary with record_count and records_omitted * fix(model): bound pickle integers, ZIP names and keep partial facts - validate but do not convert protocol 0 integers beyond an exact long; refuse inexact memo keys - decode STRING with Python's escape rules, keeping unknown escapes - fill the format peek before classifying the file - read PyTorch ZIPs under the session member count with a bounded metadata read, charging names as they are listed - retain completed pickle facts before full-file hashing - mark tensor coverage partial when a rebuild call cannot be read * fix(model): keep Python string identity and bound dict-key work - record the exact code point sequence of strings holding Python surrogates, so distinct keys stay distinct - build each key's identity once per node, so a reused memoized key is not rebuilt per write - decode raw-unicode-escape text in bounded batches instead of one fragment per backslash run - keep the first equal key when SETITEM replaces its value * fix(model): scan raw-unicode-escape text in one pass Measure each backslash run once instead of retrying a regular expression from every backslash, and build output without a per-escape list. * fix(model): keep GGUF partial tensor data offsets non-null * fix(model): bound pickle tensor counts and validate FLOAT operands * fix(model): bound shared tensor work and read expanded views * fix(model): format the pickle changes and drop the unused ModelFormat type --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> |
||
|
|
73582aa342 |
feat(native): identify Nim, Zig, GHC, OCaml and D toolchains (#16252)
* feat(native): identify Nim, Zig, GHC, OCaml and D toolchains Add identify_native_toolchain, a static, read-only reader that reports whether a local ELF, PE or thin or universal Mach-O image was built by Nim, Zig, Haskell (GHC), OCaml or D, including stripped images without a DWARF producer. The reader searches a bounded part of the selected image for a fixed table of runtime symbol names, runtime messages, mangled names, source paths and producer strings, and returns each observed marker with its file offset, section or segment, matched text and occurrence count. Data sections are searched before bytes outside sections and before instruction sections, so a bounded scan reaches strings first; coverage reports the bytes examined. The verdict is derived from the listed markers only: a language needs two distinct markers, one strong. Conflicting, too few or no markers give unknown, and a version is reported only when a marker states it. * perf(native): order toolchain scan ranges in linear time Intersect instruction sections with the bytes outside data sections in one pass, so an image with tens of thousands of sections does not take quadratic time before the scan starts. * fix(native): bound stated toolchain versions and describe scan order Track distinct versions per marker in a Set and list at most eight, counting the rest in versions_omitted, so an image with many version strings costs constant time per match and a bounded result. A candidate reports a version only when exactly one was stated. Describe max_scan_bytes and examined_bytes as a total in scan order rather than a prefix from the image start, and place the chunk-boundary test's marker across an actual read boundary. * fix(native): keep every stated toolchain version in the report * fix(native): bound stated toolchain version bytes before keeping them * feat(native): make the stated version budget a per-call control * fix(native): give no larger-limit retry once a toolchain control is at its maximum * fix(native): do not match toolchain markers on truncated runs * fix(native): keep exact markers on a final run at the image end * style(native): format the toolchain changes --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> |
||
|
|
208b81d724 |
feat(artifacts): inspect Game Boy and GBA ROM headers (#16249)
* feat(artifacts): inspect Game Boy and GBA ROM headers Game Boy and Game Boy Color images (game-boy-rom) are claimed when at least the first 24 bytes of the boot logo at 0x104 match, the half every boot ROM compares. Root metadata reports the entry code and its JP target, full or top-half logo match, title and manufacturer code, CGB and SGB flags, mapper and features, declared ROM and RAM sizes, destination, licensee codes, version, and declared and computed header and global checksums. The global checksum is summed over the file in bounded reads. Game Boy Advance images (gba-rom) are claimed from an ARM branch at 0, the fixed 0x96 at 0xB2, and the boot logo or a matching complement check. Root metadata reports the entry branch target, logo match, title, game and maker codes, fixed value, unit and device type, version, the complement check, and the multiboot fields when that layout could apply. Both serve header.bin and program.bin as stored ranges. Logos are compared by SHA-256 digest, so no logo bytes are carried. Checksum, logo and size disagreements leave coverage unknown; a header cut short is refused as truncated with the offset where the file ends. * fix(artifacts): keep missing GBA multiboot fields unknown and pin checksum vectors A GBA file that ends inside the multiboot fields reported boot_mode and slave_id as zero. They are now null, with a limitation naming where the file ends. The Game Boy reader charges artifact_limits.expanded_bytes from the file size before it sums the file for the global checksum. Checksum tests now use hand-derived vectors instead of copying the parser's own result. * refactor(artifacts): read Game Boy and GBA header fields through BinaryReader The GBA parser decoded words with a local reader that read missing bytes as zero. Both parsers now read header fields through BinaryReader, as the tool-design guide requires, after their length checks. The fixtures write literal offsets instead of the parsers' field constants, and the guides say inventory reads the stored members to hash them. * fix(artifacts): read documented GB size codes and MBC4, refuse truncated GBA headers * style(artifacts): format the handheld ROM test --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> |
||
|
|
3741beeafc |
fix(asar): report bytes outside every packed member as unknown coverage
The ASAR reader declared complete coverage after listing the header's members, even when bytes after the header belonged to no packed member: bytes after the last member, gaps between members, or the declared range of a member that cannot be read. Coverage is now unknown in those cases, with a limitation giving the unaccounted bytes, their range count and the first offset. Unpacked members need no packed bytes. The gap measurement the wxapkg reader used moves to a shared unaccountedBytes helper that both readers call. Closes #16588 |
||
|
|
a37994b3e8 |
feat(artifacts): inspect MetaTrader EX4 and EX5 program headers and resources (#16501)
* feat(artifacts): inspect MetaTrader 5 EX5 program headers and resources Recognize compiled MQL5 programs by their EX5 magic and inventory them through inspect_artifact and extract_artifact. Report the program type, compiler build, copyright/link/version property slots, nonzero header fields of unknown meaning, and the resource table. List the opaque body and resource payloads as stored byte ranges; nothing is decrypted, decompressed or decompiled. Refs #16495 * feat(artifacts): read MetaTrader 4 EX4 programs with the EX5 layout EX4 (magic EX-) shares the EX5 header, property slots and resource table, so both containers become one mql-program format with a container field. The version slot is 64 bytes and the opaque body starts at 0x2E8 in both containers; the earlier 0x3A8 header length counted 192 opaque bytes as part of the version slot. EX4 type code 3 is a library; build is reported under a neutral name because its EX4 meaning is not established. * fix(artifacts): bound repeated MQL resource ranges and let tar outrank printable magics Resource records may share one payload range, and each occurrence is hashed and extractable, so the reader now charges every record against artifact_limits.expanded_bytes, as the DTBO reader does. A checksum-valid tar header now runs before the recognizers that match a printable magic at offset 0. A tar whose first member was named EX-..., GDPC... or UnityFS was claimed as an MQL program, Godot PCK or UnityFS. Slot text keeps a leading U+FEFF, which is declared content rather than an encoding mark. * fix(artifacts): refuse an invalid tar header only after leading-magic formats Only a checksum-valid tar header outranks the printable leading magics. A Godot pack can hold ustar at 257 inside its own content without a valid tar checksum; refusing that header first rejected the valid pack. * fix(artifacts): compare MetaTrader resource declarations A resource's name, kind, record index and unpacked size live in the resource table, outside the stored payload that content comparison hashes, so a renamed resource compared as unchanged. Compare them as the resource's declaration, as tar, ar and UnityFS members do. * fix(artifacts): keep unreadable MetaTrader resource names unknown in comparison |
||
|
|
35d0d013c1 |
fix(artifacts): report an unrecognized file's leading bytes and working fallbacks (#16508)
* fix(artifacts): report an unrecognized file's leading bytes and working fallbacks A file no format route recognizes was refused with only the raw-binary load as recovery, which suits headerless machine code but not data containers. The refusal now reports the file size and first 16 bytes, names inspect_byte_entropy and inspect_yara_matches, which accept any file, and keeps raw-binary for machine code. The REA skill gains a workflow for continuing analysis when no route recognizes a file. * docs(development): require recovery fallbacks to fit and accept the refused input * docs(skill): describe entropy ranges as places to inspect, not content labels |
||
|
|
f33f0e1c0c |
fix(artifacts): honor expanded_bytes for FIT images and share repeated-range admission (#16517)
FIT charged its images against the default expansion budget inside the structure parser, ignoring a configured artifact_limits.expanded_bytes and refusing without limit facts. The reader now charges every image, including image-data links that repeat one range, through a helper the DTBO reader also uses, and reports the standard expanded_bytes refusal. The parser's untyped copy is removed. |
||
|
|
624d2f1ec1 |
fix(artifacts): preserve FAT table coverage for unsupported Mach-O slices (#15802)
* fix(artifacts): preserve FAT table coverage for unsupported Mach-O slices * test(artifacts): check retained FAT table extent on truncated slices |
||
|
|
37f2426123 |
docs(settings): describe the operation filter refusal
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
d4cefde290 |
fix(artifacts): keep universal Mach-O coverage unknown when bytes lie outside every slice
The universal Mach-O reader reported complete coverage whenever lipo and the FAT table agreed, without comparing the slice ranges with the file. Bytes appended after the last slice, or placed before a slice beyond the padding its alignment needs, were never exposed and nothing said so. readMachoImage now reports where the FAT table ends, including Apple's hidden ARM64 row. fatUnaccountedBytes measures the bytes outside the table, every slice and each slice's alignment padding, following lipo's placement of every slice at the first offset its alignment allows. Any such bytes keep coverage unknown with a limitation that counts them and names the first offset. Without a FAT parse only the fixed header is known, which measures leading bytes conservatively. The FAT fixture no longer pads its last slice, matching lipo output; the two tests that needed bytes past the last slice now add them explicitly. Fixes #15534 |
||
|
|
925dce1ded |
fix(pe)!: deliver inspect_pe_imports and inspect_pe_resources within the agent result budget (#15687)
* fix(pe)!: deliver inspect_pe_imports and inspect_pe_resources within the agent result budget Neither tool had a detail input or a summary view, so their complete Evidence was always delivered inline: about 200-480 KB of CLI JSON for stock kernel32.dll, shell32.dll and explorer.exe, and over 1 MB over MCP. Both now follow the inspect_deb_package pattern. With detail omitted, complete Evidence is returned when it fits the agent result budget, and otherwise the retained summary with delivery facts; detail complete always returns everything, and inspect_analysis_view evidence-json pages the retained record. The CLI gains --detail and --evidence_output. The imports summary carries image identity, imphash, coverage with DLL and function counts, issue/limitation counts and one name/function_count/ delay_load row per DLL, bounded to 16 KiB of rows with an omitted count. The resources summary carries image identity, the resource directory, coverage, directory/resource/icon-group counts and resource counts by type and by language, each bounded to 8 KiB of rows with an omitted count. The byte-bounded leading-prefix rule extract_artifact's summary used is now byteBoundedList, shared by the three summaries. BREAKING CHANGE: inspect_pe_imports and inspect_pe_resources output is now complete Evidence or, when detail is omitted and the Evidence exceeds the agent result budget, the inspect_analysis_view summary with delivery facts. Callers that need the complete record inline pass detail "complete" (CLI --detail complete); otherwise follow delivery.next. Fixes #15619 * test(pe): cover byte-bounded lists and named resource identities in summaries * fix(cli): withhold an over-budget summary answer and print its paging facts The CLI printed {summary, evidence_bundle, delivery} for over-budget Evidence without measuring it, so a summary larger than a smaller configured agent result budget was printed whole. Like MCP since #15591, the CLI now measures that answer and, when it is over the budget, prints the bundle receipt and the delivery facts marked withheld, whose next call pages the saved Evidence. |
||
|
|
21a5122a9a |
fix(native)!: bound read_bytes to what a minimum MCP response delivers (#15583)
* fix(native)!: bound read_bytes to 1 MiB per call read_bytes accepted any length up to Number.MAX_SAFE_INTEGER, both in the public contract and in the Ghidra bridge request, so one call could ask a provider to allocate and hex-encode an unbounded range before any delivery budget applied. Admit at most 1,048,576 bytes per call: about 2 MiB of hex, inside the 10 MiB maximum agent result budget and the MCP SDK's default 10 MiB stdio message buffer. The contract and the Ghidra request share one MAX_READ_BYTES_LENGTH, the schema describes the bound and how to read a longer range, and the refusal comes from input admission before the provider runs. Refs #8560 BREAKING CHANGE: read_bytes refuses length above 1048576 with invalid_request on length. Read longer ranges as consecutive calls that start at the previous address plus returned_bytes. * fix(native): derive the read_bytes ceiling from the maximum agent result budget The 1 MiB ceiling was a chosen number. Each byte returns as at least two hex characters and no result can exceed MAXIMUM_AGENT_RESULT_BUDGET_BYTES, so a read longer than half that maximum could never be delivered at any budget. Derive MAX_READ_BYTES_LENGTH from it (5,242,880 bytes), so it follows that ceiling instead of a separate constant. * fix(native): size the read_bytes ceiling to a complete MCP response MCP sends bytes_hex in both structuredContent and the text block, so a read of N bytes needs about 4N bytes of response. The ceiling was half the maximum agent budget, so a full read at it could not fit the default 10 MiB MCP response and failed after the provider finished. Derive it from MINIMUM_RESPONSE_BYTES, which every server delivers, less a 64 KiB Evidence envelope reserve, divided by four (2,605,056 bytes). The boundary test now delivers a complete read at the ceiling. The compact input schema drops field descriptions, so the consecutive-call advice now lives in the tool description and the length refusal message, from one READ_BYTES_CONTINUATION. * refactor(limits): own the minimum MCP response size in the domain limits nativeByteRead derives the read_bytes ceiling from the minimum MCP response, but imported it from config, which the pure-layer boundary forbids. Define MINIMUM_RESPONSE_BYTES with the other delivery limits in src/domain/analysisResourceLimits.ts; the config parser, the byte-read ceiling, the numeric-limit verifier and tests read it there. * test(ghidra): verify read_bytes at its admitted ceiling The real-Ghidra verifier still requested read_bytes with Number.MAX_SAFE_INTEGER and with a length past the new ceiling, so it stopped on input refusal. - The boundary probe reads MAX_READ_BYTES_LENGTH, which runs past the probe's mapped bytes, so it still checks an explicit incomplete read, and refuses a length one over the ceiling. - The large-result probe reads MAX_READ_BYTES_LENGTH through MCP and the CLI and checks it is delivered complete with the fixture's bytes. The annotation and dossier probes keep covering oversized delivery with a retained reference. * test(ghidra): compare the served annotation description with its owner The real-Ghidra boundary verifier compared annotate_native_function's served description with the bare contract text. Since the open-target prerequisite is appended by describeToolPrerequisite, the check failed before reaching the read_bytes probes. Compare with the description that owner produces from the contract and its availability. * test(ghidra): run verifier probes under the shared command owner The read_bytes and large-result verifier helpers launched the CLI, ps and the compiler through promisify(execFile), outside the verifier's command owner, so a failure or timeout could leave their children running. Pass the native-value verifier's commands owner through verifyGhidraBoundaries, verifyStartupCancellation and verifyGhidraLargeResults and run every command with commands.exec. Expected-refusal checks read the owner's VerifierCommandExitError output (snapshot.stdout.text). |
||
|
|
6b57e8e17d |
fix(delivery): refuse within the budget when even the summary is over it (#15591)
* fix(delivery): refuse within the budget when even the summary is over it
When complete Evidence was over the agent result budget, MCP retained it
and delivered its summary without measuring the summary. A deb package
with many ar members, for example, produced a summary larger than the
budget it was meant to fit.
Measure the summary before retaining it. When it is still over the
budget, return a resource_constraint error that carries the same
delivery facts in details.reported_limits.agent_budget: the complete
size, the budget, the retained complete Evidence ID and the
inspect_analysis_view call that pages it within the budget. Errors are
already delivered within the budget.
The CLI path, which builds its summary separately, is unchanged.
* fix(delivery): measure the delivered answer and describe the refusal
- Measure the {summary, delivery} answer MCP sends, not the summary
alone, when deciding whether the summary fits the budget.
- The refusal's delivery note says neither the result nor its summary
was delivered, instead of reusing the summary-delivered note.
- Offer repeating the call with detail complete only for idempotent
tools; a call with effects is told not to repeat its completed call.
- Build all three delivery refusals in this file through one
responseRefusal helper, and lower the resource-constraint constructor
baseline it no longer needs.
* Merge origin/main into fix/over-budget-summary-refusal
Also lower the untyped-budget-refusal baseline for ToolResultDelivery.ts,
which now builds its refusals through one helper.
* Merge origin/main into fix/over-budget-summary-refusal
With #15638, the page delivery.next names fits the effective budget.
The deb regression now asserts the followed page is within 4,096 bytes,
and the minimum-budget paging test accepts the refusal this branch
returns when the summary answer is over the budget too, following the
same next call.
* test(firmware): select a budget the vector-table summary answer fits
The test selected the 4,096-byte minimum budget to make the complete
vector-table report over budget. At that budget the summary answer with
its delivery facts is over the budget too, so this branch now refuses
with paging facts instead. Select 12,000 bytes: above the summary
answer and below the about 18 KB complete report, so the test still
exercises summary delivery.
|
||
|
|
44fbcfc787 |
feat(evtx)!: page event records with offset and report page facts (#15636)
* feat(evtx): page event records with offset and report page facts
inspect_evtx_archive stopped walking at max_records, so records past the first 20,000 (the newest events of a default-size Application log) could not be listed. The walk now covers every record. max_records stays a 20,000-record page bound, which limits retained Evidence. A new zero-based offset selects the first record listed. The result reports page { offset, limit, returned, total, next_offset }, and the record-limit-reached diagnostic names offset=next_offset. Coverage now describes parse loss only, so a page that leaves records out by selection is no longer partial, and chunk ending facts and endpoint checks cover records past the page.
Fixes #15612
* feat(evtx)!: qualify the file-tail offset for small and wrapped logs
The suggested tail offset is now the larger of 0 and page.total minus max_records, so a log smaller than one page gets a valid offset. File order is oldest first only in a log that has not wrapped; the guide and descriptions now say how chunks[] locates the newest records in a wrapped log.
BREAKING CHANGE: inspect_evtx_archive results now require page. Evidence saved before this change has no page, and inspect_analysis_view refuses to summarise it. Re-run inspect_evtx_archive on the log to produce current Evidence.
|
||
|
|
62e7c0b050 |
fix(views): size evidence-json pages to the effective agent result budget (#15638)
* fix(views): size evidence-json pages to the effective agent result budget An over-budget delivery names inspect_analysis_view evidence-json at offset 0 as its next call. With limit omitted, a page held at most 24,576 bytes of escaped text, sized for the 32 KiB default budget with a fixed 8 KiB allowance for its view Evidence. Below about 32 KiB (the minimum is 4,096), following next returned another answer over the budget. The view service now pages an omitted limit as the largest page whose view Evidence, measured as delivered, fits the effective budget (the runtime override, then REA_AGENT_RESULT_BUDGET_BYTES, then the default). A page over the budget shrinks by its measured excess and is projected again. The MCP binding, application-execution views and the CLI pass the launch seed they captured. A default page also never spans more code units than the largest explicit limit, so large budgets keep fitting the stdio frame. The fixed envelope constant and default page size are gone. * perf(views): reuse the last window while shrinking an uncached evidence-json page |
||
|
|
efbb66c16a |
fix(errors)!: report wrong-format, missing-file and missing-Evidence refusals by their cause (#15581)
* fix(errors)!: report wrong-format, missing-file and missing-Evidence refusals by their cause - inspect_labview_artifact refuses a file with no LabVIEW RSRC data as an unrecognized target (code unsupported_target, failure_kind unrecognized), as its format siblings do, instead of invalid_request. A PE whose resource tree could not be fully read is a malformed PE target. - inspect_gpu_code_objects, inspect_model_artifact and Apktool reported a missing or non-regular selected file through their own copy of the selected-file refusal (BinaryTargetError, target_unavailable). They now use the shared projectSelectedArtifactFileFailure owner (invalid_request, conforming, with its own next step), and the copy is removed. The shared owner keeps the verified-symlink recovery the copy carried. - A retained Evidence reference the session does not hold is invalid_request / invalid_input instead of evidence_integrity_mismatch. Altered or unauthenticated Evidence stays evidence_integrity_mismatch. BREAKING CHANGE: error codes change for three refusals. A non-LabVIEW file given to inspect_labview_artifact is unsupported_target (was invalid_request). A missing or non-regular selected file for inspect_gpu_code_objects, inspect_model_artifact or Apktool operations is invalid_request (was target_unavailable). A missing retained Evidence reference (details.reason "missing") is invalid_request with category invalid_input (was evidence_integrity_mismatch / integrity_mismatch). Callers that branch on these codes should match the new values; details.reason, retry_class and the remediation are unchanged in meaning. * test(model): expect the shared selected-file refusal for a missing model path The process-global host read failure test still expected target_unavailable for path errors on a model file. Those are now the shared selected-file input refusal. * fix(resources): name a rejected symlink in the shared selected-file refusal The GPU and model readers' copy of the selected-file refusal said the path was a symbolic link; the shared owner reported only ELOOP, so rejectedSymlinkRecovery failed once they moved to it. Use the rejected symlink's own message, and keep the errno message for every other selected-path refusal. * docs(errors): describe missing references and closure members as the caller's selection The comment above RESOURCE_SNAPSHOT_NOT_APPLICABLE still said a missing Evidence reference stays an integrity failure. Missing references, including retained sources and closure members, are invalid_request; only altered or unauthenticated Evidence stays an integrity failure. |
||
|
|
6ac87697e7 |
fix(errors)!: make retry_class the only retry field of a target failure (#15450)
* fix(errors)!: make retry_class the only retry field of a target failure A target failure reported two retry fields: its own `retry` hint (`none | backoff | after_change`) and the `retry_class` every error carries. They mapped one to one, so readers had to reconcile both. `retry_class` is now the single owner: the target-failure table declares it directly, the projection no longer emits `retry`, the error schema no longer accepts it, and the CLI recovery rewrite reads `retry_class`. BREAKING CHANGE: target failures no longer include `retry`, and the error schema rejects it. Read `retry_class` instead: `backoff` is `same_call`, `after_change` is `change_first` and `none` is `never`. * test(errors): readers reject the removed target-failure retry field |
||
|
|
d958391201 |
fix(mcp): serve refinement-only input rules agents need before the first call (#15437)
* fix(mcp): serve refinement-only input rules agents need before the first call - UEFI paths use the shared absolute-path schema, so the served schema carries the absolute-path pattern instead of a refinement. - Blank-text checks (guided workflow ids, prompt arguments, guidance queries, residual-unknown text) are a served `\S` pattern, not a trim refinement. - Input groups name the selector values that open them, for example `operation=architectures` for inspect_with_objdump. - inspect_native_data_type states its one-of rule in the tool description, from the same constant the refusal uses. - The served-schema parity sweep credits a cross-field rule when the description states the refusal or the selecting input group, with controls, and drops the fixed refinement gaps. Refs #15311 * fix(mcp): serve endpoint and literal rules on reduced schemas; state wider patterns - A reduced schema over budget drops name-derived fallback descriptions before its scalar rules, so analyze_web_bundle keeps its bounds. - Reduced root properties that are unions of literals serve their values as one enum (detail, format). - CDP and Inspector endpoint schemas declare the explicit-port envelope that explicitEndpointAuthority reads, as their pattern. - A pattern the portable grammar can only serve wider (`\S`, the adb serial) is also stated exactly in guidance. - The parity sweep drops the endpoint and literal gaps; the generated property accepts the host-independent absolute-path envelope. Refs #15311 |
||
|
|
b26c2ddd57 | fix(mcp): admit declared hosts on a loopback HTTP bind (#15439) | ||
|
|
bd353e7e5c |
fix(errors)!: producers declare retry class, refusal recovery and real error codes (#15372)
* fix(errors)!: derive retryable from the producer's declared retry class `retryable` means the unchanged request may succeed, but it was computed downstream as an OR of a code table and five class rules. Every error classification now declares a retry class (same_call, change_first, never, unknown_outcome); `retryable` is `same_call` after one incomplete-cleanup check, and the RETRYABLE_CODES table is deleted. Producer corrections: - update_unknown revision conflicts are change_first and report details.current_revision; duplicate record_unknown reports details.existing_unknown_id. - close_gdb_session's explicit-disposition refusal is change_first. - Per-call artifact reader limits are change_first (never when the limit cannot rise). - An exited or unreachable Hopper bridge, and a Hopper start that another REA session owns, are change_first. - File-descriptor exhaustion (EMFILE/ENFILE) outside process launch is occupied host capacity (same_call) for private workspaces, model and GPU readers and JavaScript application reads. - apktool JVM native-thread exhaustion follows the shared capacity default. BREAKING CHANGE: these refusals now report `retryable: false` (descriptor pressure now reports `retryable: true` as `resource_constraint`). Callers that repeated them unchanged should follow the remediation first: re-read the unknown and retry with details.current_revision, dispose GDB inferiors, raise the reported reader limit, or restart the Hopper provider. * fix(errors): require producers to name recovery for conforming refusals A refusal whose arguments match the input schema was presented as a schema error whenever its producer left out remediation, and many producers did. AnalysisInputError's options are now a union: a conforming refusal must supply both its outcome (userMessage) and next step (remediationAction), so the compiler lists every producer; only contract violations may fall back to the schema guidance. Producers fixed: unknown Frida session and script, decompile_all output-directory state, the duplicate unknown build computer factory (collapsed), stale Cutter sessions, Mach-O architecture selection, output roots that already exist, selected files the host refuses, Ghidra lookups the bridge could not resolve, YARA path refusals, unresolved native symbol names, apt key files and withheld sign-in state. A missing selected APK is now target_unavailable like every other selected-file reader. The capability fallback "Choose another analysis or target" is deleted; a capability refusal without its own recovery names details.reason and binary_session. Refs #15312 * fix(errors): classify caller selections and target bytes by their real failure Several refusals reported a code that reads as corruption or a crash: - a missing unknown_id and a missing Evidence reference now report invalid_request instead of execution_failure and evidence_integrity_mismatch; - close_binary with snapshot_path in a resource-only session reports invalid_request instead of evidence_integrity_mismatch; - ADB push onto an existing device path and pulls into an occupied output directory are conforming invalid_request refusals naming overwrite or output_directory, not unreadable_output; - damaged APK ZIP, signing-block, signer and central-directory structures are malformed targets, not invalid input; - NuGet and VSIX bytes without a ZIP signature are unrecognized, not malformed; - a historical source graph file whose entries contradict its root commitment is an integrity failure, not invalid input; - a CDP protocol failure states what happened instead of the unclassified fallback message. Refs #15319 * feat(errors): expose the producer's retry class as retry_class Every error projection now carries retry_class (same_call, change_first, never or unknown_outcome) beside retryable, which stays true exactly for same_call. The field is additive: the error schema accepts errors retained by earlier releases without it. Refs #15323 * fix(errors): address review of the folded error-contract PRs Keep a provider's own capability message as its remediation; the binary_session fallback applies only to a bare declared reason. Delete the unused conformingInputRefusal helper. Compose both retry fields for a refused publication whose cleanup is incomplete. Report descriptor exhaustion from a JavaScript directory opendir as occupied capacity. Let an exited Hopper startup attempt without a setup failure code retry unchanged. Declare retry for the Ghidra superseded checkpoint and unknown IDA readiness. Redact ambiguous selector candidates. Give a Ghidra document miss its own recovery. Drop an unchanged-files claim the journal repair cannot make. Name each withheld sign-in refusal's step. Hash the source graph commitment before the cancellation yield. Keep the browser protocol_error message neutral. Add tests for mutation-audit survivors C3, C5, P2, P4, P8, H1, H4 and H5. * fix(errors): keep a missing Evidence reference an integrity failure and state only the observed commitment mismatch * test(desktop): assert the unknown build computer refusal's remediation, not its message The refusal now carries its next step in remediation.action instead of the message, so the closed-computer checks assert the exact code, message and remediation facts. * fix(errors): keep producer retry choices apart from cleanup and fixed ceilings A capture's retryable flag no longer folds in pending cleanup, so the projection applies the cleanup rule once and a transient capture with pending cleanup reports change_first instead of never. A release-fixed artifact allowance reports never, and a stale admitted session identity reports change_first (reopen, then retry); both have catalogue rows. The bare capability-unavailable remediation names binary_session only for a binary-analysis session, so standalone bridges such as Cutter are pointed at their own reason. * test(vsix): expect a non-ZIP selection to be refused as unrecognized This PR reports bytes without a ZIP signature as another format (unrecognized), not a damaged package; the exact-reason assertion added on main still expected malformed. * test(delivery): expect the capacity refusal's retry class in delivered failure facts The exact failure facts asserted on main predate the projection's retry_class; occupied capacity reports same_call. * fix(errors): mark a sent Hopper cancellation unknown and missing Evidence recoverable A cancellation Hopper already received may still apply, so its retry class is unknown_outcome instead of same_call; an unsent cancellation keeps same_call. A missing EvidenceReferenceError is change_first, since importing the referenced records lets the same request succeed; other reference failures stay never. Both have catalogue rows. * fix(hopper): ask for changed launch arguments before retrying an unencodable launch A launcher path or argument that cannot be encoded as an AppleScript literal meets the same pre-launch guard on every attempt, so the start refusal is change_first and its retry_action is unknown; a start failure without a declared reason stays same_call. * fix(errors): keep a one-shot cleanup failure's retry class with its cleanup state A one-shot reply that reports cleanup_incomplete spread the primary or cleanup projection and overrode only retryable, so a timed-out read whose close also failed carried retry_class same_call. The reply now reads its retry class from the typed composed failure, and never offers the same call before cleanup settles. * test(evtx): expect an unreadable selected log to be refused with its own recovery This PR treats a well-formed path the host refused as a regular file as conforming input with its own remediation; the evtx boundary test still expected a schema-recovery refusal. * test(javascript): expect a broken source-graph commitment as an integrity failure This PR reports a well-formed historical source graph whose entries disagree with its root_sha256 as evidence_integrity_mismatch, not an input issue; the exact refusal assertion added on main still expected invalid_request. |
||
|
|
bdba620af3 |
fix(mcp): serve input rules agents need within every client's schema budget (#15393)
* test(mcp): check schema parity against the served tools/list Schema parity tests registered contracts on a bare SDK server, so they checked a schema REA never serves and missed the compact presentation's losses (#15310, #15311). - Add servedToolCatalog, which lists every tools/list page from a session server, and use it for parity checks in toolSchemaValidity and advertisedDialect. - Add a catalog-wide test that derives one violating value per constrained canonical field from each contract example and requires the served schema to reject it or the served description to name the rule. Today's gaps are listed by root cause; an entry that stops matching fails the test. - Remove absoluteLocalPathTools.test.ts; the catalog test covers every absolute-path field it checked. Refs #15328 * test(mcp): add a seeded property and visited fields to served parity - Generate string values for every constrained string field with a fixed fast-check seed; the refinement gaps it found (rules in .refine() with no served keyword or guidance) are listed with a violating value each. - Assert the sweep derives violations for root, nested and array absolute-path fields. - Check canonical schema validity against the contract schemas directly instead of a bare SDK server, and drop the served-listing test that validated canonicalInputSchema. - Move the reserved environment key check into the compact handler test, which now requires the served description to name the rule. - testing.md: assert parity against the served tools/list. Refs #15328 * fix(mcp): advertise the absolute-path pattern and dialect-dropped rules absoluteLocalPathStringSchema serialized as two allOf patterns, and the dialect projection kept only the first (NUL-free), so every absolute-path field advertised a schema that accepts relative paths. - absoluteLocalPathStringSchema emits one pattern: the absolute envelope over a NUL-free path. NUL is still refused first with its own message. - mergeAllOf conjoins exactly what it can: bounds keep the tighter value and negated-class patterns become one class. A pattern it cannot conjoin is named in tool guidance instead of dropped silently. - multipleOf, length bounds of 1999 or more and exclusive bounds on non-integers become tool guidance, including on nullable values. - Move the allOf merge into advertisedAllOf.ts. Fixes #15310 Refs #15328 * fix(mcp): keep defaults, scalar rules, examples and field semantics in compact schemas Compact input schemas dropped facts an agent needs for a correct first call: every default, the enums and bounds of reduced root properties, any example for reduced or pruned schemas, and the Frida cross-field rules. Name-keyed fallback descriptions also labelled fields of another type. - Tool guidance names root property defaults in one "Defaults:" sentence. - A reduced schema keeps the enum, const, pattern and bounds of each scalar root property. - A reduced or depth-pruned schema states its smallest canonical example (up to 1,024 bytes), and a pruned schema says nested fields are omitted. - Frida contracts state each cross-field rule once, as the refusal and the root description. - Fallback descriptions apply only to a property of the JSON type they describe; they move to propertyFallbackDescriptions.ts. Refs #15311 Refs #15328 * test(mcp): validate the served schema in three advertisement tests compare_artifacts sources, compare_web_captures inputs and the analyze_javascript_application source selection called a canonical or bare-server schema advertised. They now validate the served listing; canonical rejections stay on the contract parser, and the gaps the reduced form leaves are asserted with a pointer to the parity list. Refs #15328 * test(mcp): check recovery promises on an agent's first wrong calls Calls every served tool with generated wrong arguments on a session with nothing open: an unknown path key, an omitted required field, valid arguments for an active-target tool, a missing file and an unknown id. Every refusal must name only advertised tools, name open_binary for an active-target tool, give no schema remediation to arguments the served schema accepts, and claim retryable only when an identical replay can succeed. A seeded property varies the guessed key and missing path. Known failures are listed by root cause (#15309, #15312, #15323 and the active-target declarations #15350 removes); a new failure or a stale entry fails the sweep. * test(mcp): assert the served schema where tests claimed the advertisement Five tests validated the canonical schema and called it advertised, so they asserted rules the served tools/list does not carry: batch_decompile maxItems, inspect_api_contract format and view, the inspect_dart_aot length and line-terminator rules, extract_artifact uniqueItems, and examples on compare_javascript_export_shapes. Each now validates the served schema and keeps the handler enforcement. A missing rule is pinned as a known gap (in the parity sweep where it can see the field, or beside the test where the contract example leaves it unreachable), so the expectation fails once the rule is served. The parity sweep now also derives maxItems and uniqueItems violations from example arrays; it finds inspect_managed_members type_names uniqueItems. Two value-correct tests are relabelled and check the served schema too. * fix(mcp): fit every advertised input schema under Codex's 5,000-byte compaction threshold Codex compacts any MCP input schema above 5,000 serialized bytes and drops descriptions and nested structure first, so update_analysis_settings reached the model as a list of empty objects with no setting IDs. Lower the advertised input budget from 13 KiB to 5,000 bytes, bound $ref expansion separately so projection and depth pruning are judged on their result, and advertise update_analysis_settings changes as one object whose setting enum lists every ID; the canonical parser still enforces each setting's bounds. Refs #15339 * fix(mcp): address review findings across the served-schema stack Keep the recorded description, or its absence, when the deferred runtime materializes, so discovery and the loaded listing agree. Measure example guidance in UTF-8 bytes once, resolve defaults through each property's own reference scope, keep root names and types when scalar rules alone would overflow the reduced form, and decline joining negated classes that a literal hyphen could turn into a range. Served parity now counts guidance only when one sentence labels the field and states its rule, and counts uniqueItems guidance. That stricter match exposed seven gaps the loose match hid; they join their root causes, and the fixed arrayRules gap is removed. The first-contact sweep keys findings by check, checks a structured next step against the served catalog, and uses the catalog's own MCP settings. * chore(mcp): refresh advertised catalog summaries * fix(paths): keep the NUL path refusal's format reason Moving the NUL check out of the advertised pattern turned its issue into a custom refinement, so tool refusals reported reason invalid_value instead of invalid_format with expected regex. The check now raises the same format issue, and still stops before the absolute-path rule. * fix(mcp): state the optional Frida device choice and match bounds by rule The Frida device rule now says both fields may be omitted for the local device. Served parity matches a numeric bound by its direction, unit and complete value, so another bound on the same field cannot cover it. * test(mcp): stop pinning served-schema omissions in workflow tests Workflow tests asserted that the served schema accepts values runtime refuses, so serving a rule would fail them. They keep the valid-input and runtime-refusal checks; the catalog-wide parity sweep tracks what is served. * test(mcp): count a required field only when guidance requires it A sentence that only mentions a field, or a same-named key under another parent, no longer covers a missing required rule. Guidance must state the requirement about the field's full path, or state a shape listing every required key of the field's parent. * test(mcp): credit a served rejection only to the rule that failed The parity sweep counted any served rejection as coverage, so a probe that also broke another rule (a too-long locale that breaks its pattern) hid a missing bound. Served validation now reports every failing keyword, and a rejection covers a rule only when that rule's served keyword fails. |
||
|
|
0e07a3c876 |
fix(delivery)!: deliver over-budget results and errors inside the agent result budget (#15396)
* fix(mcp)!: deliver over-budget delivery facts inside the structured result
Codex and VS Code forward only structuredContent to the model, and Gemini
CLI and LangChain forward only the text blocks; _meta reaches no model. An
over-budget result put its delivery facts in a second text block and in
_meta, so Codex and VS Code agents received a summary with no sign that it
was one.
An over-budget result is now {summary, delivery} in structuredContent,
the shape the CLI already prints, and its one text block is that value's
serialization. The delivery layer owns the alternative: every budgeted
operation's registered output schema admits it, so canonical and compact
advertisements validate the result.
An overflowing completed result no longer picks its recovery by tool
name. The producer declares an overflow recovery (stateless, retained or
committed, with its next call and identities): list_unknowns,
get_evidence_bundle, inspect_address_context and committed unknowns
declare theirs in their bindings, and retained Evidence declares its own.
Undeclared results fall back to the contract's effects. Only a CLI
contract that reads no session is told to use its `rea` command, so
session reads and committed mutations are never told to use CLI JSON.
BREAKING CHANGE: When a budgeted tool's omitted detail returns a retained
summary, structuredContent is {"summary": <summary Evidence>, "delivery":
<delivery facts>} instead of the summary Evidence, the second
{"delivery": ...} text block is gone, and _meta["rea/agent-budget-delivery"]
is no longer set. Read the summary from structuredContent.summary and the
delivery facts from structuredContent.delivery (or the same members of the
text block). Pass detail "summary" or "complete" to receive Evidence at the
root as before.
Refs #15338
Refs #15326
* fix(delivery)!: deliver every error result under the agent result budget
A failure whose text exceeds delivery.agent_result_budget_bytes is now
retained whole as Evidence (mcp_tool_error in the MCP session,
cli_command_error in the CLI's private cache) and replaced by a bounded
summary. The summary keeps the code, category, retry, recovery and
remediation and every detail field that fits, names the fields it left
out, and carries details.failure_delivery with the inspect_analysis_view
call that pages the complete failure. Non-Evidence facts such as a
mid-extraction artifact inventory were previously inlined whole.
The transport's unretained string-ceiling fallback no longer points at
complete CLI JSON output.
BREAKING CHANGE: An MCP error, or a one-shot CLI failure without
--evidence_output, larger than the agent result budget is delivered as a
bounded summary: oversized details fields are listed in
details.omitted_details instead of being inlined, and
details.failure_delivery names the retained failure Evidence and the
inspect_analysis_view call that pages it. Pass detail complete (CLI
--detail complete) for the complete failure inline, or raise
delivery.agent_result_budget_bytes.
Refs #15326
* fix(delivery): keep overflow recovery from repeating effects or losing the session target
A retained overflow no longer offers the CLI command: the retained record is the complete result, and a call with effects is told not to repeat it. The CLI fallback for an unretained result excludes session tools. The MCP result guarantee is limited to successful results. The schema validity test selects the complete-result alternative of a budgeted output schema.
* fix(delivery): keep failure summaries schema-valid and CLI failure retention self-contained
boundedFailureSummary restores the details a code's schema requires. The CLI retains the failure as it was before its partial observation was summarized, so the record does not depend on a partial file the cache could evict, and a cache write that commits before failing or leaves cleanup incomplete keeps its receipt and cleanup owner.
* fix(delivery): retain the delivered CLI failure with its complete partial restored
* fix(delivery): budget CLI-enveloped failures through the envelope's owner
Provider-backed CLI commands wrap the canonical failure in their error envelope (a label and input diagnostics). The strict projection schema rejected the wrapped failure, so an over-budget failure printed whole without being retained. The envelope's owner now splits it; delivery budgets the canonical failure and keeps the envelope fields on the bounded result. CLI logging uses the same splitter instead of its own destructuring.
* fix(cli): print a bounded failure's retrieval facts on a terminal
A failure bounded to the agent budget carries its retained record and paging call in details.failure_delivery. The terminal presentation printed only the concise error for it, because its preserved-Evidence check did not know that field. It now does, so the structured failure is printed whole.
|
||
|
|
6a728ba419 |
feat(evidence): page retained procedure aliases (#9325)
* feat(evidence): page retained procedure aliases Bound alias pages by the serialized byte budget and advertise the native-inventory-aliases selector, including source_index. * use the shared analysis-view page refusal for alias pages the 1 MiB page budget already has a typed refusal, so this page does not declare a separate fixed ceiling. * test(evidence): verify alias page recovery and portability --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org> |
||
|
|
46367e5bef | docs(targets): include Unix ar extraction in supported targets (#15288) | ||
|
|
3772cab2e5 | docs(godot): include PCK format 1 in supported formats (#15270) | ||
|
|
33997f81c2 | docs(targets): include universal Mach-O in Go and Rust support (#15271) | ||
|
|
3e3c2ba1cc |
feat(artifacts): inspect SWF and extract embedded payloads (#15264)
Inventory FWS and CWS files through the shared artifact reader. Preserve the carrier and normalized identities, top-level tag counts, and individual DefineBinaryData occurrences. Use the existing selected-extraction pipeline and per-call artifact admission controls. Refs #3614 Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
927aefbca2 | docs(limits): correct Rust and SQLite producer input defaults (#15255) | ||
|
|
4dccd4d252 |
fix(comparison): retain function CFG entry identity (#14082)
Co-authored-by: Vincent Koc <vincentkoc@ieee.org> |
||
|
|
2ab890e2fc |
docs(il2cpp): describe version 108 partial observation (#15201)
Co-authored-by: Vincent Koc <vincentkoc@ieee.org> |
||
|
|
bd6ff678c4 |
feat(artifacts): inventory standalone Unix ar archives offline (#15224)
* feat(artifacts): inventory standalone Unix ar archives offline * test(artifacts): align standalone ar assertions and comparison docs * fix(artifacts): preserve ar names, admission and permission uncertainty * chore(contracts): refresh ar admission schema summaries * fix(artifacts): handle GNU thin references and exact name budgets * perf(artifacts): cache ar name-table observations --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org> |
||
|
|
aea385cda1 |
feat(evtx): inventory Windows event log records offline
Inventory EVTX file, chunk and record headers with source-scoped identities, full timestamp precision and explicit partial coverage. Discover the reader from first-contact inspection. Refs #9174. |
||
|
|
d840860bd7 |
feat(mcp): advertise each tool's family in tools/list _meta (#7154)
* feat(mcp): advertise each tool's family in tools/list _meta Clients that index a large catalog lazily had to guess each REA tool's group from its name. Every tools/list entry now carries the contract's adapter family under the vendor-prefixed _meta key "io.github.morluto/rea", attached once at the contract-to-registration boundary. The recorded catalog replays it unchanged on the deferred path. No tool is hidden or renamed and input schemas are unchanged. Closes #6870 * refactor(mcp): advertise the selectable family id in tools/list _meta Since #7228 the contract-owned family inventory gives every tool one selectable id, the vocabulary REA_MCP_TOOL_FAMILIES accepts. Advertise that id instead of the adapter kind so clients can map an advertised tool back to the scope that enables it. * fix(mcp): omit family metadata for contracts outside the inventory Renamed test fixtures have no published family; advertise nothing for them instead of throwing. Drop the docs claim that a family move changes the catalog digest, since the digest hashes the adapter kind. * docs(mcp): scope family _meta promise to domain tools; pin catalog env in test --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org> |
||
|
|
a5aee4f9e9 |
feat(artifacts): inventory Android super image metadata (#14928)
* feat(artifacts): inventory Android super image metadata Refs #14391 * fix(artifacts): preserve partial Android super metadata evidence * fix(artifacts): recognize Android super PE overlays Refs #14928 * fix(artifacts): reject an Android super device with no usable sector A first usable sector at the device size was accepted, so extent checks reported a different field. Keep stored copy failures to malformed, truncated, and unsupported now that format failures include unrecognized. * fix(artifacts): preserve Android super partial evidence on budget exhaustion * fix(mcp): preserve existing provider partial observation contracts --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com> |
||
|
|
11c8de1bc1 |
docs(artifacts): document Kubernetes audit log inventory (#15187)
docs(artifacts): explain Kubernetes audit log inventory |
||
|
|
52b3358f7e |
fix(limits): report details.limit for pyc budget refusals (#14386)
* fix(limits): report details.limit for pyc budget refusals Rebased onto main; the devicetree and NuGet parts were dropped here (landed via #14622 and #14629). This commit now carries only the pyc part. Refusals of the per-call budgets on inspect_devicetree, inspect_nuget_nupkg and inspect_python_pyc carried recovery only in remediation prose. Each owner now keeps one bounds object that feeds both its input schema and a structured details.limit (parameter, effective value, unit, range, default). A pyc limit that depends on max_objects and max_depth together reports related_parameters instead of a single range. The fixed decoded devicetree allowance is reported as a fixed ceiling and registered as pending. Refs #14234 * test(python): expect field-only pyc recovery text and the CLI limit flag |
||
|
|
996ab6e2ae |
fix(zip): bound the member count of a ZIP inventory (#14997)
* fix(limits): admit a ZIP member count on reader limits artifact.member_count now resolves artifact_limits.zip.member_count. Recorded Evidence from before this group may omit zip. * fix(zip): refuse a central directory past the member count Count every central-directory record before retaining it. The refusal omits required_value because later records stay unread. * test(zip): cover a central directory past the member count Three empty members at a count of two refuse through the reader and through the zip format reader. * docs(limits): name zip.member_count on the member-count setting The existing REA_ARTIFACT_MEMBER_COUNT seed already supplies that default. * test(artifacts): select the ZIP member count with the explicit fields The acceptance case ignores an invalid artifact.member_count seed only when every backed field is selected. zip.member_count is one of those fields. * fix(schemas): record the ZIP member-count input summaries extract_artifact and inspect_artifact changed their input compact schema when zip.member_count was advertised. * fix(zip): keep member count on Flutter, Playwright, and SAZ Those readers omitted the session count and described the refusal as a byte budget. They now admit artifact.member_count and report the count. * test(zip): cover member-count refusals outside artifact inventory A two-member archive at a session count of one stays a count for Flutter, Playwright traces, and SAZ. One member still passes that cap. * docs(limits): name the ZIP consumers of artifact.member_count Flutter APK inventory, Playwright trace import, and SAZ decoding use the session count and report it as a count. * fix(capture): read the fixed-limit boundary from the ceiling CaptureFormatError keeps that boundary on ceiling. The SAZ reply read cause.boundary, so a fixed-limit reply omitted the field the parent requires. * fix(limits): recover ZIP member count through the session setting Flutter, Playwright, and SAZ have no artifact_limits argument. The refusal names artifact.member_count, leaves parameter unset, and tells the caller to raise that setting. sessionSettingConstraint owns the error next to the other resource refusals. * fix(android): keep a partial JNI report at the ZIP member count readAndroidJniLibraries already returns a partial inventory when its entry allowance stops the scan. The session member count is that same stop. The reader takes artifact.member_count, and the report names the unexamined remainder instead of aborting the inspection. * fix(zip): resolve the member count from the selected environment ZIP admission and its refusal use the launch environment selected for the runtime. Only SAZ sends that count to the capture decoder. * fix(zip): drop the unused ZipReaderLimits export Knip reports the type because no caller imports it. ZIP limits stay on the schema. * fix(playwright): return an invalid member-count seed as a result The trace catch uses the count captured before the failure. A configuration error stays a Result and keeps the archive hash. * fix(jni): name the member count on a partial library scan The partial report keeps the count that stopped the scan and the recovery for artifact.member_count. * fix(settings): register artifact.member_count for its ZIP consumers Scoped inspection of the Flutter, Playwright, capture, and JNI operations includes the setting. * test(artifacts): parse Evidence that omits the audit-log policy The merged reader-limit schema still accepts a record that omits the Kubernetes audit-log policy. |
||
|
|
06761f2993 |
fix(xml): bound element depth at the XML syntax boundary (#14998)
* fix(xml): refuse element depth at the syntax check saxes keeps one handler per event and walks the open-element stack on every start tag. checkXmlSyntax now owns opentagstart and closetag, runs every caller handler after the depth check, and refuses depth above 1024 as xml-element-depth. 1024 stays above the desktop XML view cap and the plist nesting cap. This release adds no runtime override. * fix(xml): keep the depth limit when package parsers read XML XAR TOC, installer XML, Maven POM, and VSIX manifest parsing wrapped every syntax failure as malformed or a node budget. A depth limit is returned as the limit failure those callers already accept. * test(xml): cover element depth past the syntax ceiling A document one element past 1024 fails the syntax check, including a XAR TOC that used to parse because a later opentagstart handler replaced the depth guard. A sibling range after a branch at the ceiling still matches. * test(plist): keep nesting refusals inside the XML depth ceiling Plist fixtures deeper than 1024 now fail at syntax, so the nesting-limit cases sit on the deepest document the syntax check admits. One plist and one keyed archive assert the syntax limit past that ceiling. * fix(xml): type the depth guard as a saxes start tag opentagstart emits a start tag, not the finished SaxesTagNS. The handler call failed typecheck on that assignment. * fix(xml): report element depth from the package providers A VSIX manifest or Maven POM past the syntax ceiling is an XML limit. Those providers only translated their own format, so the refusal became an I/O error. * fix(xml): report element depth as a fixed allowance * fix(firmware): report SVD element depth as the XML ceiling * fix(nuget): preserve XML element depth on package XML * fix(capture): preserve XML element depth in SAZ metadata * style(nuget): format the package fixture * fix(plist): report XML element depth from native inspection * fix(pkg): carry the XML depth allowance through a deep TOC * test(plist): narrow the XML depth refusal before projection The native depth failure is an analysis error. Project it after that check. |
||
|
|
295bdfaf73 |
feat(artifacts): inventory Kubernetes audit logs offline (#14952)
* feat(artifacts): inventory Kubernetes audit logs offline A Kubernetes audit log exported from kube-apiserver is JSON-lines that the inventory treated as an unknown file: no format claim, no reader, and no way to see what an acquired log declares without a live cluster. Recognize the format from its first event and report, offline, the line, stage and verb totals and a bounded window of the events joined on their auditID. Each line stays an event in its own right, so a request whose stages were written out of order, repeated at one stage, or missing a stage is reported rather than reordered into a tidy request. Unknown API versions keep their auditID and stage but are not interpreted under field names the version may not use. Malformed lines are counted and bounded, never dropped silently. Refs #11352 (first slice: request, user, object reference and response code; request/response bodies, annotations and impersonation metadata are not read). * fix(artifacts): bound Kubernetes audit inventory and preserve stage evidence * fix(artifacts): preserve audit fields and extend first-record recognition * fix(artifacts): stream audit identity without decoding skipped bodies * fix(artifacts): handle every audit probe tokenizer event * fix(artifacts): read padded Kubernetes audit logs and modelled stages Recognition stopped at the first newline and rejected a leading UTF-8 BOM, while the reader skipped blank lines and trimmed that BOM away. Both now treat empty lines, JSON whitespace, and one leading U+FEFF as padding. Request fields come from the first stage whose API version is modelled, so an earlier unmodelled stage no longer hides a later v1 record. * fix(artifacts): skip unowned Kubernetes audit JSON bodies JSON.parse built a value tree for ignored request and response objects, so a deeply nested body could abort the process. Each line is tokenized and only the summary fields are kept. The tokenizer stops at 64 containers; identity already read is kept, and a deeper body before that identity is one line diagnostic. * fix(artifacts): report audit depth limits and wrong field shapes A container where a scalar or string list was required now leaves that field null, and a source address or group list past the retained text budget is not stored. Lines that exceed the tokenizer depth are counted separately from malformed JSON, and a sampled request says when the scan stopped early. Recognition uses the same depth cap and does not flush a tokenizer that already stopped. * fix(artifacts): keep audit field omission and last-key facts A source address or group list past the retained text budget sets request_fields_omitted instead of looking absent. Owned strings stop growing once they pass that budget. A later scalar that replaces user, objectRef, or responseStatus clears the earlier object. * fix(artifacts): chunk audit tokenization and depth-cutoff versions Ordinary lines are tokenized in 4 KiB slices. A depth overflow rereads that line one code unit at a time. When the cutoff hides apiVersion, request fields stay uninterpreted. A later array that replaces user, objectRef, or responseStatus clears the earlier object. * fix(artifacts): reread overflowed audit records from the start A depth overflow discarded every token in that slice, so identity later in the same record could be missed. Recognition keeps the first record's decoded slices and rereads them after an overflow. A scalar that replaces user.groups clears the earlier list. * fix(artifacts): stop replaying audit records once identity is known A depth overflow after auditID and stage no longer rereads the first record, and decoded slices are dropped once that identity is known. A replacement sourceIPs or groups list clears the previous list when it starts, including when the depth cap ends the replacement. * fix(artifacts): replay only the overflowed audit slice A depth overflow now rereads the failed slice one code unit at a time and the earlier slices in chunks, so a later stage key in that slice still wins. A cutoff before apiVersion suppresses request fields without labeling the version unsupported. * fix(artifacts): let a readable stage fill fields cut by depth A first stage whose request body hits the JSON depth cap observes no apiVersion, so its request fields are withheld. The sample still marked fieldsRecorded true because only a declared unsupported version counted, so a later readable stage for the same auditID never supplied the URI, verb, user, or object details. Gate both the flag and the later fill on suppressFields so depth-suppressed stages stay fillable. * fix(artifacts): clear audit budget omission when the final value fits A later duplicate that supplies a small user agent, URI, or list no longer leaves request_fields_omitted set for the value that was replaced. * fix(artifacts): drop audit budget omission when null replaces the value A later null or container for an owned field clears the budget-omission mark left by the value it replaces. * fix(artifacts): keep audit omission keys distinct and release replay slices Nested field omission no longer shares a key with a top-level property of the same spelling. Replacing a list with an object clears that list's budget mark. Recognition drops the first-record replay buffer when the line ends and when the probe finishes. * fix(artifacts): clear list budget marks and keep replay text until the line is read A later null for sourceIPs or groups clears that list's budget mark. Recognition keeps the first record's slices until that line has been tokenized, then drops them. * fix(artifacts): clear nested audit omissions and release failed replay text A later null or object for user.groups clears that list's budget mark, and a new user or objectRef object clears its child marks. Syntax failures drop the recognition replay buffer before the probe returns. * fix(artifacts): limit audit budget omission to request fields An over-budget apiVersion no longer sets request_fields_omitted. Replacing an objectRef field, or starting a new sourceIPs or groups list, clears that field's budget mark. * fix(artifacts): accept long zero-fraction audit response codes A status lexeme such as 200.00000000000000000 is still the safe integer 200. The number text bound is 64 characters, which covers that form and still rejects an unbounded digit string. * test(artifacts): cover audit response code number bounds The response code is now admitted by its numeric value instead of a 20-character text bound. Pin the two edges that keep the wider bound honest: the widest safe integer on both sides, an exponent form that evaluates to a safe integer, and a value past the safe range that is still dropped. * fix(artifacts): keep padded audit status codes and pending recognition Trailing zeros after a decimal do not drop an integral status code. A verb dropped by the text budget counts as unlisted. A recognition finish before the first line ends stays pending and keeps its replay text. * fix(artifacts): keep integral audit status exponents and probe padding A status code is the safe integer its lexeme evaluates to, including a fraction that an exponent cancels. Leading padding has its own recognition allowance, and a verb dropped before an unread API version stays out of the histogram. * fix(artifacts): keep audit status codes with a cancelling exponent A large exponent is rejected only when it cannot cancel to a safe integer inside the maximum line. The final shift still decides the code. --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> |
||
|
|
2c07552b64 |
fix(limits): report details.limit for KernelModuleProvider refusals (#14306)
* fix(limits): report details.limit for ELF dependency, unwind, and kernel reader refusals
Attach structured `details.limit` metadata to per-call budget refusals across
the remaining `src/native/elf/` providers (`ElfDependenciesProvider`,
`KernelModuleProvider`, `KernelBuildConfigProvider`, and
`ElfUnwindRangesProvider`), following the `#14243` shared-budget pattern:
- Generalize `elfReadBudgetLimit` in `src/domain/native/elfReadBudgets.ts` so
ELF and kernel readers share one parameter-limit builder.
- Export `ELF_DEPENDENCIES_READ_BUDGETS`, `KERNEL_MODULE_READ_BUDGETS`,
`KERNEL_BUILD_CONFIG_READ_BUDGETS`, and `ELF_UNWIND_RANGES_READ_BUDGETS` from
their domain schemas so Zod input bounds and projected `details.limit`
metadata have a single owner.
- Report `details.limit` for caller-selected file, entry, inflation, and record
budgets, including `compressed_candidate_bytes` (`max_config_bytes`), while
moving `KernelBuildConfigProvider` file-size handling onto
`offlineArtifactFailureDialect.fileSize` and removing its unreachable
`capacity` branch.
- Report `ElfUnwindRangesProvider`'s fixed 16 MiB `symbol_name_text_bytes`
allowance through `fixedAllowanceOptions` with narrowing guidance and
`related: { parameters: ["limit", "offset"] }`, registered in
`scripts/verify/fixed-ceiling-registry.json` under `#14235`, rather than
reporting an inverted `details.limit`.
- Remove `ElfDependenciesProvider.ts`, `ElfUnwindRangesProvider.ts`, and
`KernelBuildConfigProvider.ts` from
`scripts/verify/untyped-budget-refusal-baseline.json`, clearing all
`src/native/elf/` entries from the baseline, and update
`docs/reference/rea-limit-inventory.md` and
`docs/reference/limits-and-recovery.md`.
Part of #14234
* test(elf): assert CLI details.limit and flags for kernel module budgets
* fix(elf): report required_value for KernelModuleProvider max_file_bytes and add MCP recovery test
|
||
|
|
88373e3fba |
feat(apple): inspect Image4 (IMG4, IM4P, IM4M) firmware containers offline (#14907)
* feat(apple): inspect Image4 (IMG4, IM4P, IM4M) firmware containers offline Image4 files are recognized from a DER SEQUENCE whose first element is the IA5String IMG4, IM4P, or IM4M, independent of the filename, and are inventoried as apple-img4. The stored payload octet string is exposed as payload, the embedded IM4M sequence as manifest.der, and the IM4R sequence as restore-info.der. Keybags contribute a count and key types, with initialization vectors and keys left out of metadata; an encrypted payload is refused on open; signatures and certificates are reported by size; LZFSE and complzss payloads stay compressed; IM4R property names are listed and their values stay redacted. Four fixed allowances refuse excessive DER depth, element count, property count, and string length, and inventory coverage is unknown whenever a limitation is recorded. * fix(apple): read Image4 fields by universal tag and position Compare universal tag numbers instead of identifier octets, so constructed OCTET STRING and string values are recognized and reported. Read IM4P fields by position so an unsupported payload keeps its slot and a constructed keybag still marks the payload encrypted. Walk every constructed value once, caching the children of header-walked values so each element is charged once, and check large values a consumer does not decode. Report unknown restore members, extra property and object fields and a mistyped certificate chain. Decode UTF8String as UTF-8, accept DER sign padding on unsigned 32-bit integers, and recognize the magic with the shared BER header decoder. * fix(apple): read IM4P and IMG4 slots by position and keep unknown counts null Follow img4tool and img4lib: after the payload, an optional keybag OCTET STRING, then an optional compression SEQUENCE, then PAYP in [0]; IMG4 holds IM4P, [0] IM4M and [1] IM4R in that order. A value outside its slot is reported as unknown and never takes another field's role, and an EXPLICIT wrapper holds exactly one value. An absent or undecodable description is null rather than empty, and an undecoded keybag reports a null count and types instead of zero; a decoded keybag counts every entry. * fix(apple): keep Image4 compression unknown when it cannot be read An encrypted payload without a compression field, or a declared algorithm other than LZFSE with no recognizable magic, now reports compression "unknown" instead of "none". Make ia5Text the single owner of the retained-text allowance so a string too large to tree-parse is refused rather than reported absent, keep the canonical BOOLEAN check in the structural pass only, check the keybag's inner SEQUENCE through the shared decoder instead of its first octet, note a manifest version other than 0, and name the spec constants after their sources. Add a hand-encoded IM4P golden that does not use the fixture builders. * fix(apple): keep stopped Image4 slots and bound retained bytes A value whose end cannot be found keeps its identifier, so a stopped keybag still marks the payload encrypted and a stopped payload keeps its slot; the values after it become a limitation. The IMG4 payload slot is consumed whatever it holds, so an unsupported value does not hide the manifest and restore slots. A property body that is not a SET or SEQUENCE is reported instead of read as empty, and an entry whose name cannot be read is one unknown entry whose value is never walked for more names, so restore values stay redacted. Load a value only when it may be decoded and fits an 8 MiB retained budget; larger primitives and values past the budget are walked by header. * fix(apple): keep restore properties opaque and small fields readable A PRIVATE-tagged restore value is one property: only its name is reported, and its value is never searched for names, even when the name is unreadable or is IM4R. Only the IM4R property SET is walked as a container. Small primitives are always loaded, so names and scalars stay readable after the retained budget is used. A declared uncompressed size that is negative or not an exact integer is reported as a limitation. * fix(apple): reserve tree budget only for parsed values and keep PRIVATE manifest entries opaque Reserve retained bytes only for a value that will be tree-parsed, so a ranged wrapper around a large payload no longer uses budget a later small indefinite value needs. A PRIVATE manifest entry must name itself; when its name cannot be read it is reported and its value is never interpreted as manifest facts. * fix(apple): report MANB, MANP and IM4R entries with no body A MANB, MANP or IM4R entry that holds only its name is a missing body, not a confirmed-empty one, so it is reported as a limitation while sibling facts are kept. * fix(apple): require a SEQUENCE for named manifest entries A context-, application- or other-tagged manifest value that begins with a name is unsupported structure, reported as an unknown tag rather than read as a manifest entry. * fix(apple): assign IMG4 values to slots by position and context tag One slot assigner owns the IMG4 layout: a context-tagged value fills the slot with its tag number, skipping earlier optional slots, and any other value occupies the next slot even when it cannot fill it. An unsupported manifest value therefore no longer hides a following [1] IM4R. --------- 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: Cursor Agent <cursoragent@cursor.com> Co-authored-by: morluto <morluto@users.noreply.github.com> |
||
|
|
13f618e8e3 |
fix(native): report non-native bytes as unrecognized, not malformed (#14936)
* fix(native): report non-native bytes as unrecognized, not malformed
A file that is not the format a reader owns was reported as a broken file
of that format. `inspect_native_initializers` called a PE file or random
bytes a malformed target, and the thin Mach-O reader called any bytes
without Mach-O magic a malformed Mach-O.
Format owners can now say "these bytes are not my format": parse failures
and format target failures gain the `unrecognized` kind that target
failures already define ("no reader for this operation recognizes the
bytes"). The owners report it once:
- the thin Mach-O reader, for bytes without Mach-O magic;
- the shared native container reader, for bytes that are not ELF, PE or
Mach-O (previously `unsupported`);
- the initializers provider, for a file with neither ELF nor Mach-O magic.
Function starts no longer pre-checks the header itself; the shared reader
owns that decision. IL2CPP keeps mapping unknown native bytes to its
unsupported-container reason. A recognized header that is cut off or
broken stays truncated or malformed.
* fix(resources): keep every format failure kind's facts through artifact wrappers
`ArtifactReaderFailure` kept the owner's facts only for its own list of
three format kinds, and `artifactOperationReason` had a second list. With
`unrecognized` added, `artifactFormatFailure` and `artifactParseFailure`
dropped its facts, so `translateArtifactFailure` raised an internal
invariant error instead of the target failure.
The format kinds are now one list, `FORMAT_TARGET_FAILURE_KINDS`, and
`isFormatTargetFailureKind` is the one guard. `FormatTargetFailure`,
`ParseFailureKind` and `BinaryFormatFailure` derive from that list, and
the reader-failure constructor and the operation-reason check both use the
guard, so a new kind cannot be carried by one wrapper and dropped by another.
* test(conformance): expect unrecognized for foreign bytes on native readers
The Go, Rust and native-initializers readers now report bytes that are not
ELF, PE or Mach-O as unrecognized, so their foreign-bytes conformance cases
expect that kind. The case names follow the kind.
|
||
|
|
f25312a8bc |
feat(labview): inspect RSRC containers and embedded VI trees (#13337)
* feat(labview): inspect RSRC containers and embedded VI trees Add inspect_labview_artifact, a static reader for LabVIEW RSRC containers in .vi/.ctl/.llb files and in LabVIEW-built PE resources. It reports the container header, the recorded LabVIEW version, the complete block inventory with each section's coding, and whether the block-diagram and front-panel heaps are present, without starting LabVIEW or any process. Only zlib-coded sections are decoded, for their byte count; no payload is returned. An absent block-diagram heap is reported as a limitation rather than reconstructed. * docs(labview): document RSRC inspection Describe the inspect_labview_artifact contract, section codings, and the block-diagram limitation, and list the target in the supported-targets table and the documentation index. * test(labview): cover provider admission for the RSRC reader Add the provider-admission coverage the repository requires for a new provider, without changing the reader: - Move the synthetic RSRC container builder into a shared test fixture so the unit and boundary tests build the same bytes once. - Add a CLI and stdio MCP boundary test for inspect_labview_artifact. - Register `rea-labview-rsrc` lifecycle coverage for operation and cancel. - Declare the `labviewArtifact` conformance case. - Regenerate the advertised catalog summary for inspect_labview_artifact. * fix(labview): require an absolute path in the inspection contract `inspect_labview_artifact` admitted a relative `path`, while every other caller-path contract requires an absolute one. The CLI/contract parity check caught it: the CLI resolves a relative argument before admission, so the contract must hold the absolute rule alone. Use `absoluteLocalPathStringSchema`, the schema the other caller-path contracts already use. * fix(labview): bound inspection work and preserve parse facts Address the review findings on the RSRC reader: - Bound the PE resource walk with a visited set, a total visit budget, directory-entry and container allowances, and a typed limit failure instead of a silently partial scan. - Check the resource directory and its data against the declared resource range rather than the whole file. - Cap zlib inflation at its declared length, add a total decoded-work budget, and recognise any valid zlib header instead of three byte pairs. - Check nested RSRC records against their declared data/info sections and cap the total section count across blocks. - Read the artifact through readStableArtifact so identity, bounds and cancellation bind to the bytes actually inspected. - Carry parse failures as ParseFailureError facts: malformed input keeps its kind/offset/field, and a limit becomes a typed fixed-allowance refusal instead of invalid_format. - Report heap presence as `unknown` when an embedded program tree or an unexamined container could still hold it, not as `absent`. - Cover cancellation that arrives after the read starts. - Move the analyst guide under docs/guides/native/. * fix(labview): retry retained cleanup and keep read failures distinct - Own the artifact resource scope and run each read through it, so a retained failed close is retried before later work and reported at shutdown. - Translate the read failure as recorded instead of replacing it with the signal's current state; the stable read owns its cancellation facts. - State the 256 MiB input ceiling as a fixed allowance so an oversized artifact keeps its structured maximum and recovery. - Match the guide to the decoded-byte behavior: a section over the budget is reported `unknown` and the inventory continues. * fix(labview): bound the version scan and keep cleanup on refusal - Replace the unbounded `\d+\.\d+` scan with a bounded single-pass search over the first 64 KiB of each vers section; a digit-only section no longer drives quadratic matching work in the shared server. - Classify read failures through the shared provider classifier with a LabVIEW dialect, so the size ceiling is restated as a fixed allowance and the read's cleanup, partial observation and cancellation facts survive the refusal. - Cover both with regressions. * fix(labview): reuse the shared PE layout and bound the decode work - Walk PE resources through readPeResourceLayout, so RVA lookup is indexed, a payload may map through any admitted section, and the home-grown section scan is gone. Add a total entry budget. - Charge every attempted inflation against the container's decode budget, including failed and length-mismatched attempts. - Bound block records by the list's declared extent, clamped to the container because real LabVIEW-built PEs declare more than the resource payload holds. - Reject a named section whose name leaves the list instead of reporting it as unnamed. - Pass the selected container to the parser without copying it. - Cover the PE path and the over-declared list extent with regressions. * fix(labview): bound repeated decodes and report unexamined coverage - Charge compressed input bytes as well as declared output, and memoize the decoding of one stored section, so records that share a stream do not repeat its work. - Keep a zlib-coded `vers` section's decoded bytes for the version scan. - Cap list records by both the declared extent and the info section. - Report PE walk coverage, and keep heap presence `unknown` for a `.llb` archive or an unreadable PE resource branch. * fix(labview): key cached decoding by block and section A section's coding depends on both its stored bytes and the block that declares it: LVzp is XOR regardless of the bytes, while another block may read the same bytes as raw or zlib. Include the block identifier in the memo key so a shared section keeps each block's interpretation. Cover the shared-section case with a regression. * fix(labview): derive block facts once and stop inferring format from names - Compute the block-diagram, front-panel and program-tree facts in one pass over the inventory and reuse them. - Check the visited set before charging the PE directory-visit budget, so aliases of one directory do not exhaust it. - Deduplicate aliased resource payload ranges before counting containers. - Report a direct RSRC container's heap facts as unknown: its content does not establish whether it is a VI, a control, or an archive of member VIs, and the caller's spelling is not evidence of format. * fix(labview): decode the packed version record and keep resource type - Read the LabVIEW version from the packed four-byte word at the start of a `vers` record instead of scanning the whole record as Latin-1, and report `version_coverage` so an undecodable record is unknown rather than absent. - Accept only RT_RCDATA (type 10) PE resource payloads, so the `pe-rcdata-rsrc` kind is accurate and a larger custom resource cannot win selection. * fix(labview): walk only the RCDATA subtree and validate packed digits - Walk only the RCDATA (type 10) resource subtree, so a shared directory reached under another type cannot hide the container and unrelated branches are not charged to the entry budget. - Reject a packed version word whose digit nibbles are not decimal; a damaged record is skipped and a damaged-only container reports `version_coverage: unknown`. - Derive the heap and program-tree facts in the parser and consume them in the provider, so one owner defines their meaning. * fix(labview): filter root resource entries before dispatch - Apply the RCDATA root-type filter before either target branch, so a root entry that points straight at a payload cannot enter the result. - Validate only the decimal major, minor and bugfix fields; the build field is not part of the reported version. * fix(labview): filter PE root types before dispatch and validate only reported version digits The RT_RCDATA filter ran only for directory targets, so a noncanonical root entry of another type pointing straight at a data entry could be counted and labelled pe-rcdata-rsrc. Filter the depth-0 type identity before either target branch, and share the RT_RCDATA constant with the PE resource facts owner. The vers check rejected a record whose build bits held a nibble above 9. Only major.minor is reported, and pylabview (decimal build digits) and the classic NumVersion layout (binary non-release revision) disagree on the build, so only the reported major and minor nibbles are validated. * fix(labview): resolve names against the shared list and keep read identity - Locate the one section-name list after every block's start table and use it for all blocks, so named sections before the last block keep their identity instead of reading a neighbouring table. - Retain the completed read's byte identity on later refusals and failed closes, so a parse failure still names the bytes that were read. * fix(labview): report why recognized zlib sections stay undecoded A valid RFC 1950 header with FDICT set was classified as uncompressed, so a vers section's four-byte length prefix was read as version 0.0. FDICT now marks the section as recognized-but-undecodable zlib. Each undecoded zlib section records its reason (preset dictionary, compressed-input or decoded-output allowance, or failed inflation), and the report names the fixed allowance that stopped it, so a capacity omission is distinguishable from damaged bytes. A PE whose RCDATA branch could not be read is no longer described as carrying no embedded RSRC resource. The RSRC magic and zlib header fields are named once and shared. * fix(labview): keep PE admission separate from an unreadable tree A file that does not declare `MZ` is not a PE, so it must not be reported as a malformed PE resource tree. The scan reports whether the file was admitted as a PE separately from whether the walk was complete. * fix(labview): take PE identity from the MZ owner and bound section tables A two-byte MZ check treated plain DOS MZ and NE/LE/LX images as declared PEs, so an ordinary non-LabVIEW file was reported as an unreadable PE resource tree. PE identity now comes from observeMzWindowsHeader: only a PE signature at e_lfanew declares a PE. The unused admitted field is removed. A section-start offset inside the count word or block-header rows was accepted and could fabricate an inventory from block metadata. Tables must start at or after the end of every block header; blocks may still share a later table. The refusal tests now assert the error type unconditionally. * fix(labview): report embedded parse failures in file coordinates A malformed RSRC embedded in a PE failed with container-relative offsets, but the refusal names the selected executable and carries no container.file_offset, so callers could not locate the failure. The parser now takes the container origin and moves a failure offset into the selected file's coordinates; successful results keep container-relative ranges with container.file_offset. * fix(labview): frame RSRC tables before applying their count allowances A damaged container declaring an impossible block or section count was refused as a capacity limit before its table extent was checked, so a truncated target surfaced as resource_constraint. Each table is now framed first; a fully framed table over its allowance is still a capacity refusal. * fix(labview): keep unread PE resource roots and rows out of observed absence A nonzero resource RVA whose file-backed run cannot hold one directory header returned complete coverage without reading anything, so the file was reported as carrying no embedded RSRC. Only a zero RVA is observed absence now; a short declared root is an unread tree. Directory rows were checked against the entry allowances before their extent, so a damaged directory declaring impossible counts surfaced as resource_constraint. Rows are framed first; a fully framed directory over its allowance is still a capacity refusal. * fix(labview): reject RSRC data sections that overlap the fixed header A data offset inside the 32-byte RSRC header let a section's stored-length word be read from header fields, returning a fabricated empty section as a successful inventory. A data offset below the header is now malformed. * fix(labview): check decode-omission guidance structurally and own the RSRC magic once The allowance test froze the delivered sentence. It now checks the parser's decodeOmissions fact and the effective allowance, and compares the public limitation with the provider's own formatter output. The RSRC magic was declared again in artifact recognition; it now has one owner in the LabVIEW domain contract, used by recognition, the parser, the PE scan and the provider. * feat(labview): summarize and page the RSRC inventory from retained Evidence inspect_labview_artifact returned every block and section inline, so an admitted container with 4096 named sections could exceed a megabyte and bypass the agent result budget. The tool now takes detail: complete keeps the inline inventory; summary, or omitted detail over the budget, returns container, version and heap facts with block and section counts, and the complete inventory is paged with inspect_analysis_view kind labview-artifact (blocks, sections, optional block filter) or read with evidence-json. The CLI delivers the same way. RSRC data and info ranges that intersect are refused as malformed rather than reading list metadata as section data. * test(labview): read the CLI report as the complete inventory The advertised output now admits complete or summary detail, so the test parses the complete report schema explicitly. * perf(labview): build view rows only for the requested page Each view call copied every section before reading the request, so a summary or one-row page did work proportional to the whole inventory. A section index (block and section position, and positions per block) is built once per immutable retained report and reused; summaries read counts from it, and section pages build objects only for selected rows. --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> |