Skip to content

chore: remove ota_POC.py proof-of-concept (unsafe DFU activation)#6

Merged
g4bri3lDev merged 1 commit into
OpenDisplay:mainfrom
balloob:chore/remove-ota-poc
Jul 5, 2026
Merged

chore: remove ota_POC.py proof-of-concept (unsafe DFU activation)#6
g4bri3lDev merged 1 commit into
OpenDisplay:mainfrom
balloob:chore/remove-ota-poc

Conversation

@balloob

@balloob balloob commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Removes ota_POC.py from the repo root. It is a proof-of-concept that is unsafe to run and duplicates functionality already provided correctly by the maintained library src/nrf_ota/dfu.py.

The hazard

In ota_POC.py, the firmware VALIDATE step treats status INVALID_STATE (0x02) as success:

status = rsp[2]
if status not in (0x01, 0x02):
    raise RuntimeError(f"Validation failed with status {status}")

It then unconditionally calls activate_and_reset(). For this Legacy bootloader, dfu_image_validate() returns INVALID_STATE exactly when the received byte count does not match the image size (a data packet was dropped in transit) — it is not an alternate success. Firing Activate at that point resets the device without writing the valid-app settings and leaves it stuck in DFU. Legacy DFU cannot retransmit, so this is a real bricking-into-DFU footgun.

The maintained library already documents and handles this exact case correctly in src/nrf_ota/dfu.py (it raises a clear, retryable DFUError on INVALID_STATE instead of activating).

Why it's safe to remove

  • ota_POC.py was already excluded from the built wheel (only src/nrf_ota is packaged).
  • Nothing in the repo imports it — it was a standalone script sitting next to the correct library, a footgun for anyone who ran it directly.
  • The now-dead references to it in pyproject.toml (ruff exclude) and .github/CODEOWNERS are removed as well.

No changes to the library itself. uv run pytest -q passes (30 passed).

🤖 Generated with Claude Code

https://claude.ai/code/session_012g2e8mr132vcizx92WsgiR

ota_POC.py treats VALIDATE status INVALID_STATE (0x02) as success and then
activates the image, which can leave a device stuck in DFU. The maintained
library src/nrf_ota/dfu.py handles this case correctly. The file was already
excluded from the built wheel and is not imported anywhere; remove it and its
now-dead references in pyproject.toml and CODEOWNERS.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012g2e8mr132vcizx92WsgiR
@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@g4bri3lDev g4bri3lDev merged commit b173341 into OpenDisplay:main Jul 5, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants