Skip to content

feat(artifacts): inspect Android boot image components - #9487

Merged
N0zoM1z0 merged 23 commits into
morluto:mainfrom
mvanhorn:fix/android-boot-image-reader
Nov 17, 2026
Merged

N0zoM1z0 merged 23 commits into
morluto:mainfrom
mvanhorn:fix/android-boot-image-reader

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Android boot (ANDROID!, v0–v4) and vendor_boot (VNDRBOOT, v3–v4) images now expose header facts and stored components through the existing local artifact inventory/extraction workflows. Component ranges, caller paths, raw target strings and Evidence provenance remain intact. This is read-only format support with ordinary safe extraction; no new provider, target execution, flashing, payload decompression, or signature/AVB verification. No issue is linked because this is an additive format proposal.

The parser uses the shared tagged failure algebra: unsupported revisions, truncated declarations and malformed structures stay distinct through CLI/MCP and cleanup retry. The directly affected Deno confirmed-slot consumer recognizes these reasons. Vendor table count/entry-size ceilings are checked before reading or allocating the table (at most 4,096 × 4,096 bytes); components stream admitted stored ranges. Positional metadata, entries and coverage publish together after final carrier validation. Shared PE input projection preserves selected paths and structured malformed/truncated diagnostics. Owning contracts, errors, documentation and format registration are updated. Existing files with recognized magic now inventory as Android boot images; other artifact formats retain their registrations.

Validation on Linux with pinned Node 24.22.1:

  • Seven benign fixtures generated with official AOSP mkbootimg at d2bb0af5ba6d3198a3e99529c97eda1be0b5a093 covered boot v0–v4 and vendor_boot v3/v4. All component slices/hashes matched known inputs and the official unpacker; compiled CLI vendor-v4 extraction matched all four inputs. No images were booted or flashed.
  • Final follow-up source checks: 65 passed, one Windows-only skip; compiled CLI/MCP: 24 passed, including all 14 existing PE unsupported/malformed classification cases. Positional sibling reader/lifecycle checks: 144 passed; four selected Node SEA extraction/identity/cancellation cases passed. Deterministic regressions verify metadata is unpublished after invalid/cancelled/mutated preparation, retry works, and selected-input facts/partial identity survive failed cleanup and retry.
  • Source and verification-script typechecks, changed-file lint/format, architecture/module checks, numeric-limit checks, Knip, documentation checks/build, discovery and advertised-schema checks passed. No dependency changes; peak observed bounded check memory was 1.96 GB, with verified process cleanup and no OOM/resource abort.

Coverage limits: no device-dumped images or signature/AVB verification; Windows/macOS-specific cases and C++/Rust schema engines were unavailable locally. Full typed lint and the complete suite were not run locally. On final head abb99f3e405014aff5ae7a40f4e6a11c8ea2056d, GitHub Static checks, all source tests, all 12 built-test shards, Portable tests, CI required and Greptile passed. The Windows capability lane was skipped. One unrelated IDA startup-diagnostic EPIPE cleared on a failed-job rerun without code changes; no gate was bypassed. An existing Node SEA same-size-mutation test failed intermittently in a sibling run; its producer is unchanged, and one targeted pinned-main comparison passed, so a baseline failure has not been established. This observation is retained for CI assessment rather than attributed to main as a confirmed bug.

Author readiness

Human owner: @mvanhorn

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

…mages

A format parser and artifact reader now recognize ANDROID! headers in
versions 0 through 4 and VNDRBOOT headers in versions 3 and 4 by magic,
independent of filename. Non-empty stored pieces become children:
kernel, ramdisk, second stage, recovery DTBO, DTB, a version 3 vendor
ramdisk or version 4 named ramdisk-table entries, bootconfig, and a
version 4 signature. gzip, lz4, and zstd are recorded from a leading
magic and left compressed, and admission stops at 4096 vendor ramdisk
entries, a 4096-byte entry, or a vendor header above 1 MiB before the
table is read. Header facts cover page size, command line, OS version
and security patch level when present, board name, and the header
digest, with an AVB footer reported as version and sizes only; the
format joins the existing container inventory and extraction path so CLI
and MCP return the same evidence, including the untrusted command-line
and name limitation and the unknown boot, init_boot, or recovery role.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-17T11:45:30.716605Z
We couldn’t complete this review. Comment @codex review to try again.
abb99f3 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The latest changes appear safe to merge, with no new blocking finding.

Summary

Adds read-only Android boot and vendor_boot inspection and stored-component extraction through the existing artifact workflows.

  • Android boot images expose their header facts and stored components for inspection.
  • Positional readers publish format facts with their prepared inventory.
  • Artifact parse errors keep distinct reasons through caller-facing messages.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Local image] --> B[Recognize Android magic]
  B --> C[Parse header and bounded component ranges]
  C --> D[Read vendor table and footer facts]
  D --> E[Recheck source and cancellation]
  E --> F[Publish entries, metadata and coverage]
  F --> G[CLI or MCP inventory]
  F --> H[Stream stored components for safe extraction]
Loading

Reviews (17) · Last reviewed commit: "fix(artifacts): publish validated facts ..." · Reviewed by Greptile

Comment thread src/domain/androidBootImageFormat.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 71de141317

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/domain/androidBootImageFormat.ts Resolved
Header and vendor ramdisk table capacity failures now carry the named
ceiling, and the reader reports them through artifactFixedLimitFailure so
the recovery states this release has no runtime override and what does
not raise the limit.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b01461cf47

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/domain/androidBootImageFormat.ts Resolved
…actReader

The reader now extends PositionalArtifactReader for the entry cache,
stream ownership, cancellation, carrier freshness checks and close order,
and keeps only Android header, vendor ramdisk table, AVB footer and entry
construction.
ramdisk_addr describes the assembled vendor ramdisk section, and
bootloader fragment selection decides where each fragment lands, so
table fragments no longer inherit it as their load_address. The declared
base stays on the root image metadata.
Inventory keys logical paths by their NFC spelling, so two canonically
equivalent ramdisk names collided after normalization and could not be
extracted together. Uniqueness is now checked with logicalPathNfc before
suffixing; name_bytes_hex still records the stored bytes.
Resolve docs/specs/README.md by keeping both the Firmware section from
this branch and the Native section from main.
@mvanhorn

mvanhorn commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Merged current main in b1d0c4f. The only conflict was docs/specs/README.md, resolved by keeping both this PR's Firmware section and main's new Native section; the Android boot reader suites, typecheck and lint pass on the merge.

Comment thread src/domain/androidBootImageFormat.ts Resolved
A UTF-8 character can straddle the 512-byte cmdline/extra_cmdline split
in v0-v2 boot headers, which made both separate decodes fail and left
command_line null. The joined line is now decoded from the concatenated
NUL-trimmed field bytes; the separate fields and raw hex are unchanged.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ab3f8014b1

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/domain/androidBootImageFormat.ts Resolved
…ecting the image

A zero-length vendor ramdisk table entry made the whole vendor_boot image
fail to parse, hiding the other fragments, DTB, and bootconfig. Keep the
range check, then omit the empty entry and report it as a limitation,
matching how other layouts skip zero-sized components.
@mvanhorn

Copy link
Copy Markdown
Contributor Author

Merged current main in f5acef6, which removes the duplicate packageName declaration in src/cli/adbCommands.ts that this branch had picked up from its earlier merge of main and that kept several Source tests suites from loading.

Register android-boot-image in main's shared artifact recognizer table so
inventory classification and binary target resolution reach the same
verdict, instead of re-adding a magic check at each route. The extraction
test's kernel member now carries a decodable ELF header, since main
classifies ELF only when its header decodes (morluto#10650).
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Comment thread src/domain/androidBootImageFormat.ts Resolved
Comment thread docs/android-boot-image.md Resolved
… parser beside its reader

Main's architecture guards refuse new raw Buffer reads, per-format Error
classes and local UTF-8 decoders. The domain module now owns only the
ANDROID!/VNDRBOOT magic that the shared recognizer table needs; the header,
vendor ramdisk and AVB footer parser moves to src/artifacts beside its
reader and reads through BinaryReader, throws ParseFailureError (malformed,
or decodeLimit for its fixed limits) and decodes with decodeStrictUtf8.
Its Result interface is unchanged.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Compare the vendor ramdisk count refusal with artifactFixedLimitFailure
instead of fragments of its wording, throw the returned parse error in the
success helpers instead of a generic unreachable error, and let the MCP
extraction test inherit the project deadline.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Build images whose tables really hold 4,096 and 4,097 entries: the first is
inventoried completely, and the second is refused before its table is read.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Comment thread src/domain/liveBinaryTargetSummary.ts Resolved
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Take the BINARY_TARGET_FORMAT_KINDS lookup main uses for archive formats and
list android-boot-image there, and read ArtifactReader helpers from
src/resources and BinaryReader from src/domain/binaryContainer.
@mvanhorn

Copy link
Copy Markdown
Contributor Author

Merged current main in f4ee42f to clear the conflict in src/application/BinaryTargetResolver.ts: it now uses main's BINARY_TARGET_FORMAT_KINDS lookup, with android-boot-image listed as an archive in src/domain/binaryTargetTypes.ts. The boot image reader and format modules read ArtifactReader helpers from src/resources and BinaryReader from src/domain/binaryContainer.ts, following main's moves.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

gensokyo-dev and others added 2 commits November 17, 2026 10:52
Preserve Android boot image registration alongside the merged inspection workflows.

Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)
Co-authored-by: gensokyo-dev <[email protected]>
Keep shared parser failures through artifact inventory and error projection,
including cleanup retry. Distinguish unsupported revisions, truncated declared
structures and malformed layouts through the compiled CLI and MCP workflows.
Preserve parser-owned fixed allowances and update the directly affected Deno
confirmed-slot consumer, generated metadata and feature documentation.

Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)
Co-authored-by: gensokyo-dev <[email protected]>
@N0zoM1z0 N0zoM1z0 changed the title feat(artifacts): inventory and extract Android boot and vendor_boot images feat(artifacts): inspect Android boot image components Nov 17, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

Comment thread src/resources/ArtifactFileOperation.ts Resolved
Commit positional entries, coverage and Android metadata after carrier
freshness and active checks, keeping failed preparations retryable.

Project owned PE parser failures through one selected-input owner so
unsupported targets retain the path and malformed or truncated headers retain
their structured issues. Preserve primary causes, partial identity and cleanup
ownership through retry.

Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)
Co-authored-by: gensokyo-dev <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@gensokyo-dev gensokyo-dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the Android format/reader integration and shared failure/publication corrections. Official AOSP producer/unpacker controls and bounded source/public checks support the read-only stored-component scope. Exact-head required CI and automated review must pass before merge; real-device/signature and platform-specific verification limits remain explicit.

@N0zoM1z0
N0zoM1z0 enabled auto-merge (squash) November 17, 2026 11:50
@N0zoM1z0
N0zoM1z0 merged commit a88c0a5 into morluto:main Nov 17, 2026
94 of 108 checks passed
@morluto morluto added area: evidence Evidence, artifacts, and reconstruction enhancement New feature or request labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: evidence Evidence, artifacts, and reconstruction enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants