Repository navigation
feat(artifacts): add bounded static Android sparse image reader - #14395
saariuslystoned wants to merge 4 commits into
Conversation
Codex Review Summary: ❌ FailedThis 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. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
[Medium impact] The reviewed changes appear safe to merge; all previous findings are addressed. SummaryAdds static Android sparse image inspection and extraction of stored
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[New operation] --> B[Resolve complete reader limits]
B --> C[Parse sparse headers and chunks]
C --> D[Metadata and stored RAW slices]
E[Saved Evidence] --> F[Authenticate record]
F --> G[Read recorded limits without defaults]
G --> H[Summary or comparison]
Reviews (4) · Last reviewed commit: "fix(artifacts): preserve recorded effect..." · Reviewed by Greptile |
…oid-sparse # Conflicts: # .agents/skills/reverse-engineer-anything/references/native-and-artifacts.md # .cursor-plugin/skills/reverse-engineer-anything/references/native-and-artifacts.md # docs/getting-started/cli.md # src/artifacts/artifactFormats.ts # src/domain/artifactFormatMetadata.ts # src/domain/artifactFormatRecognition.ts # src/domain/artifactGraph.ts # src/domain/formatMetadata/androidAndSystemMetadata.ts # src/domain/targetFormats.ts # src/resources/ArtifactReader.ts
|
this overlaps #13244, whose full-image expansion is a distinct workflow. keeping the bounded inspection/RAW-slice work open; please add the human owner and Author readiness before landing review. |
|
The shared sparse parser and expanded-image path have landed in #13244. Your metadata-only inspection and RAW-slice behavior remain distinct; please build those on the landed parser owner. Keeping this open for that follow-up. |
|
Closing as superseded by #13244 ( |
Summary
Adds strictly read-only, bounded static container recognition, inspection, summary projection, and physical
RAWchunk extraction for AOSP Android sparse (simg,0xed26ff3a) images (android-sparse-image) acrossinspect-artifact/inspect_artifact,extract-artifact/extract_artifact, andBinaryTargetResolver.Problem and expected behavior
Previously, REA rejected Android sparse images (
0xed26ff3aLE headers commonly used forsystem.img,vendor.img,vendor_dlkm.img, andsuper.img). Now REA recognizes the little-endian0xed26ff3amagic prefix asandroid-sparse-image, validates the 28-bytesparse_header_tand 12-bytechunk_header_trecords acrossRAW(0xCAC1),FILL(0xCAC2),DONT_CARE(0xCAC3), andCRC32(0xCAC4), reports structured container metadata (unsparsed_size, block/chunk totals, bounded positional chunk descriptors, andandroid-sparse-image-summaryfor--detail summary/detail: "summary"), and exposes storedRAWchunk byte slices (chunks/chunk-<index>-raw.bin) by carrier offset without materializing gigabytes of virtualFILLorDONT_CAREblocks.Change and scope
src/domain/androidSparseImageFormat.ts):sparse_header_t(magic === 0xed26ff3a,major_version === 1,file_hdr_sz >= 28 <= 4096,chunk_hdr_sz >= 12 <= 1024, non-zero 4-byte-alignedblk_sz,total_blks,total_chunks <= 65536,image_checksum).BigIntarithmetic to rejectchunk_sz * blk_sz/total_blks * blk_szoverflows, 32-bit block-sum wraparound,total_szframing mismatches,CRC32non-zerochunk_sz, unknownchunk_type, carrier extent overflows/truncations, andtotal_blksmismatches.O(1)memory while capping inlinechunksdescriptors at256(chunks_omitted) andcrc32_chunk_valuesat64(crc32_chunk_values_omitted), recordingtrailing_byteswithcomplete: false(coverage.status = "unknown") when unparsed bytes trail declared chunks.src/artifacts/AndroidSparseImageArtifactReader.ts):PositionalArtifactReaderusing 4 KiB header read windows and zero-copy carrier byte slices (RAWchunks only), preserving carrier identity rechecks, cancellation checks, and forwardingANDROID_SPARSE_FIXED_LIMITSintoartifactFixedLimitFailure(registered inscripts/verify/fixed-ceiling-registry.json)."android-sparse-image"acrosstargetFormats.ts,artifactGraph.ts,androidAndSystemMetadata.ts,artifactFormatMetadata.ts,artifactFormatRecognition.ts,androidSparseImageSummary.ts,espFlashImageSummary.ts,artifactInventoryView.ts,ArtifactReader.ts,artifactFormats.ts, andTargetFormatVocabularies.test.ts.docs/android-sparse-image.mdand updateddocs/.vitepress/documentation.ts,docs/README.md,docs/getting-started/cli.md,docs/guides/firmware/firmware-analysis.md,.agents/skills/reverse-engineer-anything/references/native-and-artifacts.md, and.cursor-plugin/skills/reverse-engineer-anything/references/native-and-artifacts.md.Contract and boundary impact
src/domain/androidSparseImageFormat.ts(header/chunk grammar, bounds, ceilings, accounting) consumed by bothsrc/domain/artifactFormatRecognition.tsandsrc/artifacts/AndroidSparseImageArtifactReader.ts.RAWchunk byte ranges in the carrier file are hashed or extracted;FILLandDONT_CAREregions remain non-materialized metadata, andimage_checksum/CRC32chunk checksums remain unverified (crc32_verified: false).Evidence and regression coverage
tests/fixtures/androidSparseImage.ts).src/domain/androidSparseImageFormat.test.ts(magic, multi-GiB virtualFILL/DONT_CAREwithout allocation, header/chunk bounds, integer overflows,total_blkswrap/mismatch, truncation, trailing bytes, bounded inline previews, fixed ceilings)src/domain/artifactFormatRecognition.test.ts(0xed26ff3aprefix recognition)src/domain/analysisView/androidSparseImageSummary.test.ts(android-sparse-image-summaryschema & projection)src/application/binary/TargetFormatVocabularies.test.ts(exhaustive target format fixture)src/artifacts/AndroidSparseImageArtifactReader.test.ts(streamedRAWslices,0-raw-chunk sparse containers, trailing bytes)src/artifacts/AndroidSparseImageArtifactReader.boundaries.test.ts(artifactReaderLifecycleCases,artifactPreparationRecoveryCases, fixed ceilings, post-prepare carrier mutation)tests/acceptance/androidSparseImageCli.test.ts(compiled CLIinspect-artifact,--detail summary,extract-artifact, structured malformed/truncated/ceiling errors)tests/boundary/mcp/androidSparseImageMcp.test.ts(compiled MCPopen_binary,inspect_artifact, summary detail,extract_artifact)Validation performed
Verified on
HEADf17123668154e2bda8824f722b30c89e1c138e55:npm run format:check— exit0(8834files)npm run check:fast— exit0(turbo2/2;verify:architecture-guards3116source files)npm run verify:test-discovery— exit0(3905test and spec files)npm run metadata:check— exit0npm run build:cached— exit0(3/3)npm run docs:check— exit0(docs:check:built6/6;tests/conformance/readmeConsistency.test.ts8/8)npx vitest run src/domain/androidSparseImageFormat.test.ts src/domain/artifactFormatRecognition.test.ts src/domain/analysisView/androidSparseImageSummary.test.ts src/domain/analysisView/artifactInventoryView.test.ts src/application/binary/TargetFormatVocabularies.test.ts src/artifacts/AndroidSparseImageArtifactReader.test.ts src/artifacts/AndroidSparseImageArtifactReader.boundaries.test.ts tests/acceptance/androidSparseImageCli.test.ts tests/boundary/mcp/androidSparseImageMcp.test.ts— exit0(9test files,108/108tests passed)