Skip to content

Independent alpha audit remediation: signing, storage, entropy, and CI evidence - #587

Merged
BitHighlander merged 33 commits into
alphafrom
fix/alpha-auditor-review
Aug 26, 2026
Merged

Independent alpha audit remediation: signing, storage, entropy, and CI evidence#587
BitHighlander merged 33 commits into
alphafrom
fix/alpha-auditor-review

Conversation

@BitHighlander

@BitHighlander BitHighlander commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Outcome

Independent alpha remediation produced while observing and checking the looping auditor. The review reproduced its findings in pinned Docker, found additional signing/report defects, filed them on the fork tracker, and repaired both firmware and the companion Python harness.

Security fixes

Evidence and CI fixes

Verification

  • clean pinned Docker gate at firmware 7d3cf278e61a8fc7497721216a072eaf302b486b / python-keepkey b9ab241cdf9f3c7fb8c097dcacaba4cb5620299f: exit 0
  • the only subsequent Python code change narrows the RC18 version boundary; both 7.16 execution paths are identical, and current/bitcoin-only/RC18 GitHub integrations pass at 4641244f57af0967e7b97ca1aeb149b20aba54d3
  • CircleCI build 361 passes the exact Python head with fork checkout, native dependency, screenshots, full suite, catalog, and PDF generation
  • merged companion pin 8e59e4c58c8e59150426bdcfdd27eac9b6bb65a9 is tree-identical to the green Python head; final firmware head is e4ec5317d
  • native: 579/579 passed across firmware, board, Pallas constant-time, and crypto suites
  • Python full suite: 678 passed, 26 intentional skips, 0 failures
  • screenshot suite: 222 tests, 0 failures; 1,261 retained PNGs; every declared screen captured
  • merged evidence: 2 Python + 4 native JUnit files
  • report catalog: firmware 7.16.0, 27 sections, 383 tests; 370 passed, 13 documented skips, 0 failed, 0 pending
  • generated artifact: 125-page PDF
  • Uniswap evidence: 3/3 signatures and 16 reviewed OLED frames (approval 3, add 7, remove 6)
  • final-head GitHub checks are required green before merge

Companion PR: BitHighlander/python-keepkey#59

Closes #398
Closes #400
Closes #446
Closes #449
Closes #457
Closes #516
Closes #523
Closes #524
Closes #525
Closes #526
Closes #529
Closes #530
Closes #531
Closes #532
Closes #558
Closes #559
Closes #560
Closes #588
Closes #594
Closes #595
Closes #596
Closes #597
Closes #598
Closes #599
Closes #600
Closes #601
Closes #602
Closes #603
Closes #605
Closes #606

Resolve #523, #524, and #525: make U2F counter updates shadow-only during setup, mint a fresh checked PIN-KDF salt for every new record, and replace erase-before-write storage commits with a CRC-framed, old-bootloader-compatible pending-record handoff.
Resolve #526 by routing PIN and recovery permutations through checked uniform draws, wiping outputs on health failure, and clearing recovery mnemonic state on early finalization exits.
Resolve #530 by separating each static bytes field exact schema capacity from its aligned repeated-field stride, rejecting the alignment padding byte without corrupting descriptor iteration.
Resolve #531 by routing confirm_data through the length-aware byte pager so non-ASCII OP_RETURN data is not silently truncated and exact payload length remains authoritative.
Resolve the native coverage portion of #516 with positive add/remove liquidity tests that approve every screen and prove third-party recipients reach completion.
Bump python-keepkey for #516 and #529 screenshot and mandatory-module gates.
@BitHighlander

Copy link
Copy Markdown
Owner Author

Follow-up audit remediation added after opening this PR:

@BitHighlander

Copy link
Copy Markdown
Owner Author

Independent follow-up completed:\n\n- #448 and duplicate #461 are now closed with a cryptographic regression at 616b8d3 proving the reviewed Solana message slice is exactly the signed slice for the optional zero-prefixed wire form.\n- #462 is closed: alpha commit da73417 fails both legacy and versioned oversized-account layouts as malformed; the boundary suite covers 33 and 256 accounts.\n- Python base CI was already red in run 32677388920 on three post-RC18 tests. a388ddef adds precise 7.16 firmware gates to the MAYA exactly-one-message, Ironwood empty-Orchard, and 72-byte multisig hardening tests. These checks were implemented by alpha commits 71e6c1d and 40da090 after RC18, so skipping only those cases on RC18 restores an honest compatibility lane without weakening current-alpha coverage.

@BitHighlander

Copy link
Copy Markdown
Owner Author

Audit update at c6fe3a0: the firmware-dependent Python multisig regression was removed from standalone python-keepkey CI and replaced with a native pure-predicate regression at the exact fee-accounting boundary. Pinned Docker compilation passed. Targeted Signing.MultisigQuorumMustBeBoundedBeforeFeeAccounting passed; full native suite ran 520 tests with 517 passing and only the three known local token-table/transform baseline failures. LLVM 20 formatting and git diff checks pass. Python PR #56 is restored to a tree-equivalent state to its previously passing a388ddef head and has fresh CI running.

@BitHighlander

Copy link
Copy Markdown
Owner Author

CI is red at head 78731bc: python-integration-tests (full variant, NOT bitcoin-only) fails on both runs — deterministic, same failure both times:

SECTIONS validation FAILED: 3 test(s) not green for fw 7.16.0:
  E17 test_msg_ethereum_erc20_uniswap_liquidity::test_sign_uni_approve_liquidity_ETH -> skipped-but-required
  E18 test_msg_ethereum_erc20_uniswap_liquidity::test_sign_uni_add_liquidity_ETH -> skipped-but-required
  E19 test_msg_ethereum_erc20_uniswap_liquidity::test_sign_uni_remove_liquidity_ETH -> skipped-but-required

Root cause: test_msg_ethereum_erc20_uniswap_liquidity.py's setUp() unconditionally skips every test in the file whenever self.client.features.firmware_variant[0:8] == "Emulator" (documented, pre-existing: the ETH/FOX pool contract isn't in the token table, and approving an unknown contract HANGS the emulator rather than failing, so it's gated rather than deleted). This skip fires on every emulator build, full or bitcoin-only — there's no CI path where it doesn't fire.

MUST_RUN_MODULES['test_msg_ethereum_erc20_uniswap_liquidity'] = '7.16.0' (added for #516, per the comment above it) demands this module run non-skipped on build_variant == 'full' for fw≥7.16.0. FULL_FEATURE_ONLY_MUST_RUN_MODULES only exempts bitcoin-only builds — it does not exempt the structural emulator-hang case that applies to full builds too. The result: this gate can never be satisfied by any CI run, on any variant, until the underlying firmware token-approval hang is actually fixed (out of scope here) — real hardware isn't available to this pipeline either.

This isn't a regression from anything else in this PR — MUST_RUN_MODULES's addition for #516 is what has the bug, and it's present in the currently-pinned commit d3660b12. Both PR #587 CI runs (32930315939, 32930311879) reproduce it identically at Phase 2 (~19-20min in, after the screenshot-driven Phase 1 completes cleanly).

Required remediation (matches the existing bitcoin-only exemption pattern, doesn't touch firmware): exempt test_msg_ethereum_erc20_uniswap_liquidity from MUST_RUN_MODULES enforcement on every CI-emulator variant, not just bitcoin-only — e.g. drop the '7.16.0' entry back out of MUST_RUN_MODULES (reverting to pre-#516-enforcement state) while keeping the SECTIONS catalog entries and their existing "PENDING, disclosed" language, so the PDF still documents the gap honestly instead of silently claiming coverage. #516 stays open until the firmware side is fixed for real.

Do not merge #587 at the current head until this resolves.

@BitHighlander
BitHighlander merged commit 893c93d into alpha Aug 26, 2026
33 checks passed
This was referenced Aug 26, 2026
@BitHighlander

Copy link
Copy Markdown
Owner Author

Final independent audit reconciliation:\n\n- Merged head: e4ec5317d23218aabe7553be1d64b8dd66173e07\n- Alpha merge/tip: 893c93d1072cf52faae601485e7a21b4ff6d3059\n- Both complete final-head CI workflow runs passed, including static analysis, ARM/emulator builds, native/unit/crypto tests, full and Bitcoin-only Python integrations, screenshot report generation, and both aggregate CI gates.\n- Clean Docker evidence: 704 Python tests (678 passed, 26 skipped), 222 screenshot tests (214 passed, 8 skipped), 579 native tests passed, 383 catalog entries (370 passed, 13 skipped), zero failures/errors/pending; 1,261 screenshots and a 125-page report.\n- All 30 issues explicitly covered by this firmware/companion fix set are closed as completed. Unrelated #604 remains open and untouched.\n\nThe companion harness was merged in BitHighlander/python-keepkey#59 and pinned by the firmware merge.

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.

1 participant