Repository navigation
feat(artifacts): inventory and extract U-Boot FIT images - #7771
Conversation
open_binary refused U-Boot Flattened Image Tree files as an unsupported format, so inspect_artifact and extract_artifact could not list or recover a FIT's kernel, devicetree, ramdisk and loadable images. Recognize an FDT v16/v17 with a top-level /images node and parse it with the existing parseDevicetree. Each /images child becomes an inventory entry named images/<unit-name>.bin that extracts its stored bytes from embedded data, data-offset (past the 4-aligned devicetree end) or data-position (from the file start). Image format_metadata records the declared type, arch, os, compression, load and entry; root metadata records the description, timestamp and configurations. crc32, md5, sha1, sha256, sha384 and sha512 hash nodes are verified in one streamed pass per image; other algorithms are reported unverified. Signatures are reported, not verified, and nothing is decompressed, decrypted or executed. Data outside the file, overlapping or duplicate image data, a missing or repeated data source and hash mismatches fail closed. The devicetree is bounded by the fixed 16 MiB allowance; external image data is streamed from disk. Refs morluto#7129
# Conflicts: # src/application/BinaryTargetResolver.ts # src/artifacts/inventory/ArtifactGraphConstruction.ts
[Medium impact] The PR appears safe to merge; the latest change fixes the remaining saved-metadata finding. SummaryAdds U-Boot FIT inventory and stored-byte extraction through the shared CLI/MCP artifact workflows.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A["CLI / MCP"] --> B["Shared FIT reader"]
B --> C["FDT parser and FIT facts"]
B --> D["Inventory and Evidence"]
B --> E["Stored-byte extraction"]
D --> F["Views and comparison"]
Reviews (13) · Last reviewed commit: "fix(artifacts): isolate nested entry met..." · Reviewed by Greptile |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…is only for plain images
# Conflicts: # docs/cli.md # docs/firmware-analysis.md # src/application/BinaryTargetResolver.ts # src/artifacts/inventory/reader.ts # src/domain/artifactFormatMetadata.ts
|
@codex review Please review current head d4f033d. The final test-only change replaces a global read ordinal with an observed source-end phase and reader-scoped fault. The preceding production lifecycle fix and real-data validation are described in the current PR body; unrelated main findings have been explicitly scoped in their threads. |
|
Final-head CI audit (d4f033d, run 40811293422): Source tests has 21,645 passing / 16 skipped tests and one failure, NativeMacOSProviderInput.test.ts (unreadable lipo output for inspect_macho). The same case reproduces on isolated current main cf9f010 (1 failed / 4 passed); all src/native blobs are unchanged between that main and this PR. The completed Source job log confirms this exact failure. Static checks, build, docs, macOS/Linux arm64 package checks and several compatibility lanes have passed; portable shards remain running. Greptile reviewed this exact 28-file head at 5/5 with no new findings. This records the unrelated baseline failure while awaiting the remaining CI and requested Codex review. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d4f033d78d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2724c61c68
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ac585f6caf
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
morluto#7771's U-Boot FIT probe read a bare entry from admitRawBinary's result. On this branch the result carries the whole load, and admission without an entry may first need a vector-table read. The probe always selects an entry, so it reads the canonical entry from the admitted load.
morluto#7771 adds the `fit` target format. As this test intends, it stopped compiling until `fit` had a fixture, so the merge adds that row.
Summary
Refs #7129. Add U-Boot FIT (
.itb) inventory and stored-byte extraction to the existing CLI/MCP artifact workflows, replacing unsupported-format refusal. This continuation retains the original contributor's commits and integrates main429355ca4.unreadable_fieldsdistinguishes absent declarations from parsing failures; algorithm names remain arrays. Shared entry ownership deep-copies nested facts and compares them structurally without serialization.admitRawBinary, identify an admitted image with exact parameters, and withhold incompatible or divergent mapping/entry declarations.Boundaries and resources
Static format inspection and ordinary extraction use the shared artifact provider.
parseDevicetreeowns FDT decoding,FitStructureowns FIT interpretation, and the reader owns identity/stream lifecycle; adapters consume those facts. Additivefit,fit/fit-imagemetadata; no new tools. Signature/cipher verification, decompression and target execution are outside this capability. Stored ciphertext is copied as opaque payload;cipher_presentretains that declaration.The FDT is capped at 16 MiB, with 1,024 images/configurations, 8 hash nodes per image, and 16,384 configuration references counted before expansion. Existing parser/archive bounds apply; external bytes stream from disk. Embedded equality uses source-buffer views. Returned streams retain cancellation and ownership until readable close, including buffered bytes; active/final validation failures retain precedence. No additional cache or retained image buffer.
Validation
Linux x64, Node 24.22.1 / npm 11.16.0, head
2c198c582e:d157560d4(39 pass / 2 fail). Their production and test blobs are unchanged by this PR. Earlier same-file runs passed, so this is timing-sensitive baseline behavior, retained in the validation record.check:fast, formatting,git diff --check, anddocs:checkpass (including 9 README conformance tests).Codex review was requested, but its current-head bot response reports the repository code-review usage limit. All actionable findings are addressed. Greptile reviewed this exact head at 5/5, with every thread resolved.
Final CI at this head: all required checks pass. Source tests: 21,650 passed /16 skipped; all 8/8 portable test shards and their aggregate pass. Static checks, package build, documentation, Windows capability/package and macOS arm64/Linux x64/Linux arm64 native package lanes pass. The timing-sensitive local Node SEA baseline failures above did not recur in CI. CI run.
Real data and independent oracles:
fb1eb7ef752bfc41fbc9e890d4af21f06e0a0dd5a77eb701d45e224ba47027f9. Kernel/initrd/FDT declarations matchmkimage -l/fdtget; extracted files and reported carrier slices match independentdumpimagehashes. CLI bundle views also work from another cwd with the original target path absent. A final-head complete MCP task passes the same independent metadata/payload oracles and cleanup at 499,214 estimated transport tokens (488,039 catalog), 3.695 s / 5.54 CPU s / 574.8 MiB peak family RSS.-E -B 0x200, and-E -p 0x2000 -B 0x200layouts containing a stored Debian executable and DTB. Public workflows check exact bytes, a 64-bit address, configurations, and current admitted raw hints. Three current-head MCP runs pass all layouts with cleanup under the resource guard (498,449–498,468 estimated transport tokens, including 488,039 catalog tokens; 2.663–2.687 s, 3.65–3.68 CPU s, 508.1–510.9 MiB peak family RSS).0x48010000, confirmed by native tools. Public MCP comparison reports the kernel metadata change plus root bytes; all three payload hashes remain equal. This correctness task passes in 2.888 s / 4.10 CPU s / 541.4 MiB peak family RSS; tokens unmeasured.Measured task costs
32 completed measurement tasks across pinned integration revisions, plus three current-head layout checks and the functional comparison above. Fresh client/server sessions, warm OS caches, compact input schemas, families
artifact,application,session; SDK 2.3.1 validates named responses. Complete tasks include initialization/instructions, catalog discovery, inspection, optional views, extraction, byte verification and close.For the diagnostic correction, four alternating tasks use an OpenWrt copy with a 4,096-byte configuration name and 16 distinct dangling references. Before is
ac585f6ca; after is310eb6e05(production identical to measured2e63e1997).Diagnostics fall from 16 to 1 while preserving all references, image facts and provenance. Whole-message token estimates decrease about 20%, including the added fact schemas (catalog 487,671 → 487,901). CPU/time/RSS do not establish an improvement. A four-task duplicate-reference control records 508,677 → 509,085 tokens: the old downstream dedup already collapses equal messages, so that control shows no token saving.
Earlier pristine OpenWrt measurements at
ac585f6cashow why small containers should prefer complete delivery: 498,627 estimated tokens / 3.139–3.412 s versus summary plus selected image metadata at 498,241 / 5.787–6.999 s. The extra view saves little context and incurs first-use client schema validation. No general speedup is claimed.Tokenx 1.3.0 estimates serialized JSON-RPC messages, including text/structured representations; these are transport estimates, not billed model/context counts. RSS is a 10 ms sampled sum for the Node client/server process group; CPU includes both, excludes the external sampler, and elapsed includes instrumentation. Node heaps are capped at 2 GiB with a 1.5 GiB family/150 s guard; all measured tasks complete without guard stops. Compilation-cache state was not independently controlled; cold caches and full-schema costs are unmeasured. Native producer/oracle preparation is outside task timings. Attack-scale OOM is source-derived and was deliberately not executed. No payload or deep provider was executed.
Author readiness
Human owner: @555aaditya
Before merge
type(scope): outcome.