Repository navigation
fix(fit): preserve leading U+FEFF in property strings - #8026
ShuaixinHuang wants to merge 1 commit into
Conversation
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. |
|
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 PR appears safe to merge; no actionable defects were found. SummaryPreserves leading U+FEFF in FIT property strings at the shared decoder, fixing the source of lost characters rather than repairing individual consumers.
No actionable issues found. A direct decoder check confirmed the option’s behavior; the repository test suite was not run during this review. Supersession and existing GitHub discussions could not be checked because GitHub authentication was unavailable. Reviews (1) · Last reviewed commit: "fix(fit): preserve leading U+FEFF in pro..." · Reviewed by Greptile |
Summary
FIT property values beginning with U+FEFF lose that character during decoding. For example,
algo = "\uFEFFsha256"is reported assha256, and a matching SHA-256 digest is reported as verified even though the declared algorithm is different. Preserve the exact string and retain unsupported algorithms as unverified.No associated issue; this was reproduced directly against the production reader and compiled CLI while reviewing existing FIT support.
Problem and expected behavior
The shared property decoder uses TextDecoder's default BOM handling. These are NUL-terminated property values inside a binary container, so the leading character belongs to the property rather than declaring a file encoding. The same loss also changes descriptions, configuration defaults and image references.
Change and scope
Set
ignoreBOM: trueon the existing shared UTF-8 decoder, retaining fatal UTF-8 validation and all existing string/count bounds. Source regressions cover scalar facts and exact configuration reference identities; compiled CLI regressions distinguish ordinary SHA-256, an unknown prefixed algorithm and U+FEFF-prefixed SHA-256.This is an ordinary fix within existing read-only FIT inventory/extraction support. No new provider, capability or target-execution authority is introduced; a maintainer scope decision is not applicable.
Contract and boundary impact
FitStructure.tsproperty decoding; existing reader, inventory, CLI/MCP and comparison consumers use its parsed facts. No downstream normalization or duplicate interpretation is added.Expected effects:
Evidence and regression coverage
Executed on Windows with Node 24.22.1 / npm 11.16.0, based on
1ef5918179d3cb77b8868bd117de662cbd7099ab:inspect-artifactreportedhash_algorithms: ["sha256"], hashes_verified: 1, hashes_unverified: 0for the U+FEFF-prefixed declaration. Ordinary SHA-256 andXsha256controls passed.npm run test:focused -- src/artifacts/fit/FitStructure.test.ts src/artifacts/FitArtifactReader.test.ts tests/acceptance/fitImageCli.test.ts tests/boundary/mcp/fitImageMcp.test.ts tests/acceptance/artifactComparisonFit.test.ts: 81 passed (32 source, 24 reader, 22 compiled CLI, 2 compiled stdio MCP full/compact, 1 comparison). The prefixed declaration now remains"\uFEFFsha256", with 0 verified / 1 unverified.check:fast: 2/2 passed; standaloneknip,knip:production, formatting and metadata checks passed. Typed lint: 0 errors (3,962 warnings).npm run checkis not green locally: its initial parallel Knip task failed allocating an ArrayBuffer; subsequent standalone Knip passed on both the exact clean baseline and patched tree. The architecture guard also reports backtick-NUL keys in unchangedGuidanceAccess.tsandwebCaptureDiff.ts; restoring all three modified files to the exact clean baseline reproduces both architecture errors. All three files were restored byte-for-byte afterward. No gate or resource limit was changed.Boundary coverage retains malformed UTF-8, unsupported algorithms, digest mismatch, range/overlap, cipher uncertainty, extraction and full/compact MCP controls.
Compatibility, safety, and release
Synthetic FIT fixtures were exercised through real local compiled CLI and stdio MCP. No U-Boot board, external
mkimage, or Linux/macOS local verification was performed. No claim of signature authenticity or firmware bootability is made. No migration or release metadata changes.Author readiness
Human owner: @ShuaixinHuang
Before merge
type(scope): outcome.