Inventory Android boot and vendor_boot images through shared artifact workflows. Preserve parser failure kinds and bounded stored-component extraction. Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning) Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
3.0 KiB
Implementation plan
One format-aware parser normalizes the header, vendor ramdisk table, and AVB footer. The artifact reader consumes that result. Registration follows the uImage reader. Requirements are numbered in spec.md.
Boundary and contract
- Keep parsing in
src/artifacts/AndroidBootImageFormat.ts, using sharedResult,ParseFailureError, and boundedBinaryReaderprimitives. Keep magic recognition insrc/domain/androidBootImageFormat.ts. ExportparseAndroidBootHeader,parseVendorRamdiskTable,inspectAvbFooter, andcompressionFromPrefixfrom the parser. Preserve parser failure kinds through the shared artifact failure owner. - Add
AndroidBootImageArtifactReaderwith formatandroid-boot-image. It probes at most 4096 header bytes, reads a 64-byte tail for the AVB check, and streams member bytes on demand. Table admission uses the 4096-entry, 4096-byte entry, and 1 MiB header caps before any table read. - Add
androidBootImageMetadataSchemaandandroidBootImageEntryMetadataSchemaasstrictObjectmembers of the kind-discriminated artifact metadata union. Catalog order does not select the schema. - Add
android-boot-imagetoARTIFACT_FORMATSwith the same container flags as uImage:roleContainer,retainClassifiedSource,extractable, andabsentInventory: "unavailable".createArtifactReader, inventory classification, and extraction follow that registry.ArtifactGraphConstructionandBinaryTargetResolvercallhasAndroidBootImageMagic. Add the kind toArtifactReader, the artifact graph, evidence subject, analysis snapshot, live target summary, and binary target types. - Carry untrusted target-derived strings and the unknown boot, init_boot, or
recovery role in reader limitations. CLI and MCP preserve that Evidence.
Summary detail keeps the full Evidence and uses
inspect_analysis_viewfor paging. - Reuse
ArtifactFileSource, ranged reads, chunk reads, andArtifactResourceScope. A failed close stays owned so a later close can retry. Cancellation covers admission, paused inventory, buffered bytes, and multi-chunk reads.
Validation
Synthetic fixtures live in tests/fixtures/androidBootImage.ts: version 0,
version 2 with a DTB, versions 3 and 4 boot, version 4 vendor_boot with two
ramdisk table entries, and truncated and overlapping-range negatives. Cover
the parser, the reader, filesystem boundaries, CLI acceptance, and MCP
boundary output, including matching Evidence limitations and unsupported,
truncated, and malformed refusals. Use pinned AOSP generation and unpacking
with small inert component inputs as an independent byte oracle. State that
no device-dumped image was checked.
Effects and compatibility
The reader only reads an admitted local file. It introduces no execution, boot, decompression, digest check, or signature check. The new metadata kinds are additive. Other artifact formats keep their existing schemas.