Skip to content

Validate firmware image before patching#2

Closed
ericlewis wants to merge 1 commit into
codex/harden-payload-loadfrom
codex/validate-firmware-patcher-inputs
Closed

Validate firmware image before patching#2
ericlewis wants to merge 1 commit into
codex/harden-payload-loadfrom
codex/validate-firmware-patcher-inputs

Conversation

@ericlewis

Copy link
Copy Markdown
Collaborator

Summary

  • Validate firmware header length/hash fields before patching.
  • Check loader file inputs before appending.
  • Check the Rev B patch range before writing the pointer.
  • Add unit tests for the validation helpers.

Why

The patcher trusted firmware files even when the header did not match the file body. That could create a broken patched firmware file that still looked valid. This stops bad inputs before the script writes output.

Verification

  • python3 -m unittest discover -s tests
  • python3 -m py_compile combine.py tests/test_combine.py
  • git diff --check

@ericlewis ericlewis changed the title [codex] Validate firmware image before patching Validate firmware image before patching May 10, 2026
@ericlewis ericlewis added security Input validation and hardening tooling Developer scripts and workflow tooling labels May 10, 2026
@ericlewis ericlewis self-assigned this May 10, 2026
@ericlewis ericlewis marked this pull request as ready for review May 10, 2026 04:53
Why: The patcher trusted firmware files even when the header did not match the file body. That could create a broken patched firmware file that still looked valid. This checks the header, loader files, and Rev B patch location before writing output, so bad inputs stop early.
@ericlewis ericlewis force-pushed the codex/validate-firmware-patcher-inputs branch from b174296 to 35e9e89 Compare May 10, 2026 05:09
@ericlewis ericlewis changed the base branch from main to codex/harden-payload-load May 10, 2026 05:10
@ericlewis

Copy link
Copy Markdown
Collaborator Author

Replaced by #13 with the cleaned branch name.

@ericlewis ericlewis closed this May 10, 2026
@ericlewis ericlewis deleted the codex/validate-firmware-patcher-inputs branch May 10, 2026 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

security Input validation and hardening tooling Developer scripts and workflow tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant