Skip to content

feat(uefi): add pure-TypeScript UEFI firmware analysis tools - #12342

Merged
morluto merged 24 commits into
morluto:mainfrom
bartman081523:feat/uefi-firmware-analysis
Nov 19, 2026
Merged

morluto merged 24 commits into
morluto:mainfrom
bartman081523:feat/uefi-firmware-analysis

Conversation

@bartman081523

@bartman081523 bartman081523 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add a bundled UEFI firmware provider to REA: inspect_uefi_firmware, extract_uefi_firmware, and inspect_uefi_nvram, with FV/FFS artifact inventory and a separate open_binary step for extracted, supported executable payloads.

Problem and expected behavior

Vendor UEFI flash images (for example AMI Aptio on AM4 boards) need firmware-volume / FFS / section cartography, byte-extraction with provenance, and reading of the vendor NVRAM setup store — without depending on external tools that only carve generic blobs (Binwalk/Unblob) and do not understand UEFI structures. REA had no native UEFI parser.

Expected: map the FV/FFS/section tree with explicit limits and integrity notes, extract selected bytes with digests/ranges/derivations and explicit decode gaps, and parse AMI NVAR variable stores as observations.

Change and scope

  • New pure-TypeScript parser under src/uefi/: firmware volumes, FFS files, section chains, GUID/section typing, embedded-volume rescan, conservative PSP-directory probing, UefiGuid, UefiImageScan, an owned UefiLzmaWorker (pinned lzma-purejs) plus node:zlib for AMD-zlib, and an AMI NVRAM (NVAR) parser.
  • New tools: inspect_uefi_firmware, extract_uefi_firmware, inspect_uefi_nvram; CLI inspect-uefi-firmware, extract-uefi-firmware, inspect-uefi-nvram.
  • UefiArtifactReader and 'uefi' format wiring across inventory/domain/contracts so parsed PE32/TE files hand off to open_binary.
  • Tests: src/uefi/*.test.ts, tests/boundary/uefi/, tests/acceptance/uefiFirmware.test.ts, tests/fixtures/uefiImage.ts.

Intentionally not included: no target execution or emulation, no writes into the source image, no vendor-specific proprietary decompressors beyond recognized-with-gaps classification, and no extraction of code that requires keys/signatures to be bypassed.

Contract and boundary impact

  • Semantic owner and earliest changed stage: artifact reading plus a new read-only firmware provider.
  • Contribution scope fit: the maintainers approved local static inspection, bounded decoding and caller-selected extraction to a fresh directory through CLI and MCP. The decoder runs in a REA-owned helper where applicable. The approved LZMAF86 scope expansion adds the inverse x86 BCJ filter within that same worker. The approved scope excludes source image mutation, execution of extracted code, injection, and protection recovery. Maintainer scope decision.
  • CLI and MCP/tool-catalog contract: adds three MCP tools and three CLI commands through the shared registries. The packaged MCP catalog has recorded schema summaries for all three tools.
  • Provider, bridge, target-format, or platform compatibility: pure TypeScript, no external tool; LZMA-custom and LZMAF86 use one bounded owned worker. AMD-zlib uses node:zlib.
  • Evidence, artifact, provenance, or reconstruction contract: extraction publishes files with SHA-256, source-stream ranges, derivations and extraction_gaps. Original image ranges are present for flash-backed bytes and null for decoded bytes; runtime addresses stay null because they are not statically proven.
  • Target selection, authority, upstream behavior, and cleanup details: static parsing only; extraction uses SafeOutputTree staging; nothing is executed.
  • Generated metadata/package/installation impact: package.json adds lzma-purejs and refreshes the verified runtime notices. Catalogs and skills are generated.

Expected effects (check known effects; use documentation-only on its own):

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Change process memory, registers, files, or configuration.
  • Inject instrumentation or run scripts/code.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: src/uefi/ unit tests (FFS, sections, volume, GUID, image scan, provider, NVRAM, artifact reader), tests/boundary/uefi/, tests/acceptance/uefiFirmware.test.ts, synthetic fixtures in tests/fixtures/uefiImage.ts.
  • Author-reported evidence from the earlier PR revision (real 16 MiB B550 AORUS Elite V2 FId image):
    • inspect_uefi_firmware — 11/11 firmware volumes, coverage: complete, entry_basis: amd-psp-first, 5 PSP tables, 0 integrity issues.
    • inspect_uefi_nvram — one StdDefaults store at 0x37090 with the 11 nested setup variables (Setup, PlatformLang, AMITSESetup, XhciDID, GcSensorVarName, PCI_COMMON, SioSetupData, UsbSupport, NetworkStackVar, SecureBootSetup, Setup).
  • Packaged MCP output excerpt for two synthetic NVAR records:
    [
      {"name":"Setup","next":18,"attributes":131,"guid_index":3,"data_offset":17,"data_length":1},
      {"name":null,"next":16777215,"attributes":136,"guid_index":null,"data_offset":28,"data_length":2}
    ]
  • Remaining proof gaps: review follow-up verification covered synthetic fixtures, built CLI/MCP, and the real LZMA worker on macOS. The vendor image, native Windows execution and live Ghidra handoff were not rerun at the pushed head.

Validation performed

  • The review follow-up adds a shared structural budget, stream-relative scan and extraction evidence, portable output names, PI/PSP layout fixes, and retryable provider, reader and publication cleanup. LZMAF86 now restores the complete decoded stream with inverse x86 BCJ before mapping child sections.

  • 82 focused tests passed, including CLI/MCP acceptance, EDK II-generated LZMAF86 extraction, malformed section coverage, pre-commit receipt validation, and ordered descriptor and workspace cleanup retry. The three new regressions reproduced the publication and cleanup defects at 87b24aac4d.

  • In the earlier review revision, 64 streams generated by pinned EDK II BaseTools recovered byte for byte.

  • At 6c2024b5c1, 159 focused tests passed on macOS, including packaged CLI and MCP extraction with matching selection and digests. The review regressions cover FFS and NV-data siblings, preservation of opaque bodies and uncovered ranges, scoped extraction, and images with no mapped volumes. All three regressions failed at ae11bb43a3.

  • check:fast and docs:check passed at 6c2024b5c1. The dependency inventory passed licenses:check after merging main. The advertised-schema check matched the committed summaries, validated all 259 distinct schemas with the Rust and Python validators, and compiled all 31 patterns with each required engine.

  • At 5f40a6765b, 161 focused tests, check:fast, and docs:check passed on macOS. Both inventory regressions failed at 6c2024b5c1. The fixed reader reports unknown coverage at the structural record limit and when a later volume extends past EOF, while retaining earlier completed volume entries.

  • At 90b682239d, 165 focused tests, check:fast, docs:check, and full advertised MCP schema validation passed on macOS. The NVAR prefix and FFS suffix regressions both failed at 5f40a6765b. The packaged MCP test checks the linked records, exact byte ranges, and payload SHA-256 digests.

  • At 4bc6afd797, 168 focused tests, check:fast, and docs:check passed on macOS. The audit covered scoped FFS and section suffixes, depth limits, and structural and file budget omissions. Both suffix regressions failed at 90b682239d. The extraction tests verify complete coverage for intact siblings and exact gap ranges for affected selections.

  • At 83662cd1da, 1,204 focused tests passed on macOS, including the provider lifecycle inventory, provider capability conformance, and contract-backed CLI parity tests that failed in GitHub Actions. check:fast and docs:check passed. The packaged CLI retained its offset selection flags and rejected incompatible selector combinations.

  • At 7ec2d90fe2, 1,271 focused tests, check:fast, and docs:check passed on macOS. This includes CLI decimal admission and schema parity, readable FFS prefixes with unknown traversal coverage, and independent extraction of a PE32 sibling beside an embedded FV in a decoded stream. Both firmware regressions failed at 83662cd1da.

  • At eb136fe737, 1,270 focused tests, check:fast, and docs:check passed on macOS. Both real decoder limit cases and the unknown-first section chain fixture failed at 7ec2d90fe2. The fixed provider reports partial coverage at decode limits and preserves selectable siblings and byte ranges in decoded streams.

  • At 75fd32b7cb, 1,272 focused tests, check:fast, and docs:check passed on macOS. Two synthetic AMD-zlib regressions failed on eb136fe737 and now verify that malformed GUID and compression metadata produce exact section gaps while later PE32 sections remain independently extractable with verified digests.

  • At e8316a9bb1, 1,393 focused tests passed with one existing skip, plus check:fast and docs:check on macOS. Synthetic regressions cover bounded FV/FFS extents and checksums, NVAR siblings, checksum-gated PSP provenance, guided and typed leaf payload ranges, exact alignment and decode gaps, and native ELF/PE admission through target resolution and packaged CLI inventory. This run included the compiled LZMA worker and packaged firmware CLI/MCP acceptance.

  • At a95a9b6168, 1,401 focused tests passed on macOS with one existing skip. check:fast and docs:check passed. The tests cover signed guided sections remaining opaque, recovery of active NVAR children after an inactive prefix, the compiled LZMA worker, production zlib paths using shared reply validation, and packaged CLI/MCP acceptance after merging main.

Compatibility, safety, and release

  • The new NVAR result reports raw next, guid_index, and inline guid instead of the previous draft field state. The attributes value is the observed 8-bit field.
  • Real Hopper/Ghidra, browser, or OS coverage: the earlier author validation used a vendor image. The review follow-up exercised CLI/MCP and the real LZMA worker on macOS with fixtures. Native Windows, current-head vendor firmware, and live Hopper/Ghidra remain unverified.
  • Package or release metadata impact: adds the lzma-purejs dependency.
  • Security, privacy, process, or containment review: static only; no target execution; extraction is confined to a freshly created output directory with byte/file budgets.

Author readiness

Human owner: @bartman081523

  • 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.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

…extract tools

Add a dependency-free rea-uefi provider that maps AMI/Aptio flash images:
- inspect_uefi_firmware: aligned _FVH discovery, volume-relative FFS walking,
  guided section/compression classification, conservative PSP-directory probing,
  embedded-volume rescan and leftover-region classification; incremental SHA-256
  and explicit integrity notes.
- extract_uefi_firmware: whole-image/volume/FFS-file/section extraction with
  LZMA-custom/LZMAF86 and AMD-zlib decoding, SafeOutputTree staging, derivations
  and extraction_gaps.
- UefiArtifactReader + 'uefi' format wiring across inventory/domain/contracts
  so parsed volumes and extracted PE32/TE files hand off to deep-provider
  analysis (open_binary -> Ghidra).
Add a pure-TypeScript tool that maps the vendor AMI NVRAM variable stores
(factory-default "StdDefaults" and peers) inside a flash image:
- scan the raw image for NVAR entry chains ("NVAR" + u16 total size +
  u32 attribute 0x8[23]FFFFFF + state + NUL-terminated name + data),
- recurse into a container entry whose data is itself an NVAR chain, so the
  StdDefaults setup variables surface as depth/parent_offset rows,
- report attributes, state, data range, SHA-256 and trailing padding per entry.

Verified against B550 AORUS Elite V2 FId: one StdDefaults store at 0x37090 with
the 11 expected nested variables (Setup, PlatformLang, AMITSESetup, XhciDID,
GcSensorVarName, PCI_COMMON, SioSetupData, UsbSupport, NetworkStackVar,
SecureBootSetup, Setup). Exposed as MCP tool and inspect-uefi-nvram CLI command.
@greptile-apps

greptile-apps Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5 Tier: plus

[Medium impact] The PR adds bounded local firmware analysis to REA's CLI, MCP, and artifact workflows.

The repository's coverage requirement must be satisfied before merging: unused LZMA carrier bytes need explicit accounting.

Findings

  1. P2 LZMA trailing bytes disappear ▶
Fix with agent prompt
### Issue 1
src/uefi/UefiLzmaWorker.ts:125-127
`UefiLzmaWorker` never checks how many input bytes `decompressFile` used. Appending bytes to a valid LZMA or LZMAF86 stream leaves the decoder's reads unchanged, so it returns the same successful output. If that output contains a complete section chain, inspection and extraction can report `complete` without a gap for the unused suffix. The derivation also names the entire carrier as consumed input.

This violates the repository requirement to preserve omissions and derive completeness from examined bytes. Before merging, retain format-aware consumed-input facts and report unexplained trailing bytes, as the zlib path does.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds local UEFI inspection, extraction, and AMI NVAR tools through CLI and MCP, plus FV/FFS artifact inventory.

  • REA maps UEFI images into volumes, files, sections, and unknown regions.
  • People can extract selected UEFI bytes with their source history.
  • AMI NVAR stores show their variable names, links, and data ranges.
  • UEFI flash images appear in artifact inventory as volumes and files.
  • The CLI and MCP expose the three UEFI inspection and extraction workflows.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[CLI or MCP request] --> B[Shared UEFI service]
  B --> C[Serialized provider operation]
  C --> D[Bounded image read]
  D --> E{Operation}
  E -->|NVAR| F[Bounded variable scan]
  E -->|Firmware| G[FV / FFS / section scan]
  G --> H{Decode handler}
  H -->|LZMA or LZMAF86| I[Owned worker]
  H -->|AMD zlib| J[Bounded Node decoder]
  I --> G
  J --> G
  G --> K{Inspect or extract}
  K -->|Inspect| L[Inventory and coverage]
  K -->|Extract| M[Select bytes and gaps]
  M --> N[SafeOutputTree staging]
  N --> O[Validate receipts and commit]
  F --> P[Evidence]
  L --> P
  O --> P
Loading

Reviews (22) · Last reviewed commit: "fix(uefi): preserve nested NVAR chains a..." · Reviewed by Greptile

Comment thread src/uefi/UefiImageScan.ts Resolved
Comment thread src/uefi/UefiAnalysisProvider.ts Resolved
Comment thread src/uefi/UefiImageScan.ts Resolved
Comment thread src/uefi/FfsSections.ts Resolved
Comment thread src/uefi/UefiAnalysisProvider.ts Resolved
Comment thread src/uefi/FfsSections.ts Resolved
Comment thread src/uefi/UefiImageScan.ts Resolved
Comment thread src/uefi/UefiImageScan.ts Resolved
Comment thread src/uefi/UefiPublication.ts Resolved
Comment thread src/contracts/uefi/uefiToolContracts.ts Resolved
Comment thread src/uefi/UefiLzmaWorker.ts Resolved
Comment thread src/uefi/UefiAnalysisProvider.ts Resolved
Comment thread src/uefi/UefiAnalysisProvider.ts Resolved
Comment thread src/uefi/UefiImageScan.ts Resolved
… NVRAM bounds

- FFS file checksum: verify the two's-complement invariant (payload sum +
  stored byte == 0 mod 256) instead of comparing sums, and encode the correct
  complement in the fixture builder.
- Compression sections (type 0x01): use the 9-byte header and classify EFI
  standard compression instead of 'none', so extraction reports a gap rather
  than publishing compressed bytes as a raw section.
- GUID-defined sections: derive GUID/data-offset/attributes from the parsed
  common header size (compact or extended) and reject out-of-range payload
  offsets.
- AMI NVRAM: bound recursive chains to the enclosing container's data end and
  report partial coverage when a valid nested chain is cut by max_depth.
…e, mark truncation

- LZMA worker: enforce max_output_bytes while decoding through a bounded output
  sink, so an oversized stream is rejected during expansion instead of after a
  full decompression plus a second Buffer copy.
- Provider: serialize admitted operations (the promised single decode-worker
  lane must not become one worker per overlapping call) and apply one
  whole-request deadline that covers every decode stage, not a fresh per-stream
  timer. close() drains the queue and the resource scope.
- Scan: track truncated sections of known type and report coverage partial
  instead of complete when a section declares more bytes than are present.
Comment thread src/uefi/UefiAnalysisProvider.ts Resolved
Comment thread src/uefi/UefiAnalysisProvider.ts Resolved
…der omissions

- Queue: check the caller signal before enqueue and when a job reaches the head,
  and race the queued promise against abort so a cancelled wait returns
  immediately instead of blocking behind the active request.
- Deadline: track the internal deadline and return AnalysisTimeoutError instead
  of the AnalysisCancelledError that runOwnedCommand reports for any external
  abort, preserving the real failure reason for CLI/MCP callers.
- CapabilityInventory: treat inspect_uefi_nvram like the other bundled rea-uefi
  tools so discovery does not demand Unblob for it.
- UefiArtifactReader: report image truncation through onOmission so inventory
  coverage reflects the unread suffix even when no volume was found.
Comment thread src/uefi/UefiAnalysisProvider.ts Resolved
Comment thread src/uefi/UefiAnalysisProvider.ts Resolved
…meout cleanup

- #raceWithAbort only returns early for jobs that have not started; once a
  request is running, await it so worker cleanup and completed output are
  preserved instead of being discarded by a bare cancellation.
- Reclassify a deadline-induced cancellation as AnalysisTimeoutError while
  keeping its cause and cleanup observations, and never override a different
  primary failure.
@morluto
morluto marked this pull request as ready for review November 19, 2026 15:09
@chatgpt-codex-connector

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

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T21:12:48.984688Z a95a9b6 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.

@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: d353107119

ℹ️ 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/server/createServer.ts Resolved
Comment thread src/uefi/UefiImageScan.ts Resolved
Comment thread src/uefi/UefiImageScan.ts Resolved
Comment thread src/uefi/UefiAnalysisProvider.ts Resolved
Comment thread src/uefi/UefiAnalysisProvider.ts Resolved
Comment thread src/artifacts/UefiArtifactReader.ts Resolved
Comment thread src/uefi/UefiAnalysisProvider.ts Resolved
Comment thread src/uefi/UefiAnalysisProvider.ts Resolved
Comment thread src/uefi/UefiImageScan.ts Resolved
Comment thread src/uefi/UefiImageScan.ts Resolved
Comment thread src/uefi/UefiAnalysisProvider.ts Resolved
Comment thread src/uefi/UefiAnalysisProvider.ts Resolved
@greptile-apps

greptile-apps Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Want your agent to iterate on Greptile's feedback? Try greploops.

Comment thread src/uefi/UefiImageScan.ts Resolved
Comment thread src/uefi/UefiAnalysisProvider.ts Resolved
@morluto
morluto enabled auto-merge (squash) November 19, 2026 17:50

@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: 6c2024b5c1

ℹ️ 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/uefi/UefiArtifactReader.ts Resolved
Comment thread src/uefi/UefiArtifactReader.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: 83662cd1da

ℹ️ 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/uefi/UefiArtifactReader.ts Resolved
Comment thread src/uefi/UefiImageScan.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: 7ec2d90fe2

ℹ️ 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/uefi/UefiImageScan.ts Resolved
Comment thread src/uefi/UefiImageScan.ts Resolved
Comment thread src/uefi/UefiImageScan.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: 75fd32b7cb

ℹ️ 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/uefi/UefiFormatProbe.ts Resolved
Comment thread src/uefi/UefiAnalysisProvider.ts Resolved
Comment thread src/uefi/FfsSections.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: e8316a9bb1

ℹ️ 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/uefi/UefiNvram.ts Resolved
Comment thread src/uefi/UefiImageScan.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: a95a9b6168

ℹ️ 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/uefi/UefiImageScan.ts Resolved
@morluto
morluto merged commit d380dc2 into morluto:main Nov 19, 2026
57 checks passed
@bartman081523

Copy link
Copy Markdown
Contributor Author

🎉🎉🎉

Comment thread src/uefi/UefiAnalysisProvider.ts Resolved
Comment on lines +125 to +127
);
const decoded = output.getBuffer();
if (declaredOutput !== null && BigInt(decoded.length) !== declaredOutput) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 LZMA trailing bytes disappear

UefiLzmaWorker never checks how many input bytes decompressFile used. Appending bytes to a valid LZMA or LZMAF86 stream leaves the decoder's reads unchanged, so it returns the same successful output. If that output contains a complete section chain, inspection and extraction can report complete without a gap for the unused suffix. The derivation also names the entire carrier as consumed input.

This violates the repository requirement to preserve omissions and derive completeness from examined bytes. Before merging, retain format-aware consumed-input facts and report unexplained trailing bytes, as the zlib path does.

Context Used: AGENTS.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/uefi/UefiLzmaWorker.ts
Line: 125-127

Comment:
**LZMA trailing bytes disappear**

`UefiLzmaWorker` never checks how many input bytes `decompressFile` used. Appending bytes to a valid LZMA or LZMAF86 stream leaves the decoder's reads unchanged, so it returns the same successful output. If that output contains a complete section chain, inspection and extraction can report `complete` without a gap for the unused suffix. The derivation also names the entire carrier as consumed input.

This violates the repository requirement to preserve omissions and derive completeness from examined bytes. Before merging, retain format-aware consumed-input facts and report unexplained trailing bytes, as the zlib path does.

**Context Used:** AGENTS.md ([source](https://github.com/morluto/rea/blob/main/AGENTS.md))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@morluto morluto added enhancement New feature or request provider: uefi Analysis provider / engine: uefi area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior enhancement New feature or request provider: uefi Analysis provider / engine: uefi

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants