Skip to content

Validate firmware image before patching#13

Open
ericlewis wants to merge 1 commit into
harden-payload-loadfrom
validate-firmware-patcher-inputs
Open

Validate firmware image before patching#13
ericlewis wants to merge 1 commit into
harden-payload-loadfrom
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

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 added security Input validation and hardening tooling Developer scripts and workflow tooling labels May 10, 2026
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