Skip to content

Merge to master#121

Merged
cedelavergne-ledger merged 31 commits into
masterfrom
develop
Jun 22, 2026
Merged

Merge to master#121
cedelavergne-ledger merged 31 commits into
masterfrom
develop

Conversation

@cedelavergne-ledger

Copy link
Copy Markdown
Contributor

No description provided.

cedelavergne-ledger and others added 30 commits June 11, 2026 14:20
Replace the legacy Create-React-App / React 17 / yarn / Node 16 stack with
the reference stack used by app-openpgp:

- Vite 8 + React 18 + pnpm 11 + Node 22
- Ledger lumen design system (@ledgerhq/lumen-ui-react + lumen-design-core,
  Tailwind 3 with ledgerLivePreset), following the bundled ai-rules
- Vitest for the pure-logic units (charset mapping, metadata round-trip)
- vite-plugin-node-polyfills for the Buffer API used by the APDU layer

App rewritten with lumen (ThemeProvider/Banner/Tag/Button/...): Connect /
Backup / Restore / Disconnect flow, in-app notification banners (replacing
react-toastify) and an FAQ rebuilt with lumen tokens + react-markdown.

Transport stays WebUSB (the Passwords app uses the generic USB interface).
PasswordsManager keeps its APDU logic; disconnect() now releases the device
and an onDisconnect callback surfaces physical unplugs.

Icons reuse the device app glyph (glyphs/app_passwords_64px.gif): a white
open-padlock for the in-page logo (on the dark canvas) and a white padlock on
a black rounded tile for the favicon / PWA icons (visible on a white tab).
The manifest previously pointed at a non-existent favicon.svg; fixed.

Deploy workflow updated to pnpm + Node 22 + dist/; CNAME passwords.ledger.com
preserved (Vite base "/"). Also refresh the stale support link in the FAQ and
exclude pnpm-lock.yaml from codespell.
…f peaceiris

Switch the Web UI deployment to GitHub's native Pages flow.
PRs still build for validation; only pushes / manual runs deploy.

The passwords.ledger.com custom domain is preserved (kept in the repo Pages
settings and reinforced by dist/CNAME in the artifact).
The POPULATE build flag seeded password1/2/3 in app_main() on every app
start, with no guard, so they piled up as duplicates on each launch.

init_storage() now reports whether it just freshly initialized the storage
(magic not yet set); the demo passwords are created only in that case. The
behaviour stays fully gated by the POPULATE compile flag.
The save dialog was opened only after the device exchange (dump_metadatas),
by which time the click's transient user activation had expired, so
showSaveFilePicker threw "Must be handling a user gesture".

Split saveJSON into pickSaveTarget() — called first, synchronously from the
click handler while the activation is still valid — and writeJSON(), called
once the backup data is ready. Falls back to a Blob/anchor download when the
File System Access API is unavailable or refuses.
Reading the card consumes the click's transient user activation, so
showSaveFilePicker cannot be called from the continuation of the device
exchange (it throws "Must be handling a user gesture"); opening it before the
approval instead would create the chosen file on disk and leave it empty if the
device is rejected.

Use a two-step flow: back up first, then surface a "Save…" button that opens
the native save dialog from its own click. This keeps the file-name dialog
without the SecurityError and without creating an empty file on rejection;
falls back to an anchor download where the File System Access API is missing.
The "Storage 4096 bytes" line showed the total metadata capacity read from
GET_APP_CONFIG. It is a constant, so it adds noise to the device card.The controller still reads storage_size internally for buffer sizing;only the UI row and its React state are removed.
override_metadatas() took the destination offset as a uint8_t, but
load_metadatas() passes app_state.bytes_transferred (size_t, up to
MAX_METADATAS = 4096).Small backups happened to work because only the first chunk carries data;larger lists (> ~255 bytes of metadata) were corrupted.
Cover the boundary behaviour of the metadata store:

- override_metadatas at offset 300 lands at 300, not at 300 % 256 == 44
  (regression guard for the uint8_t-offset truncation fix), plus a write at
  the very end of the buffer.
- write_metadata refuses new entries once full (ERR_NO_MORE_SPACE_AVAILABLE),
  so the 4096-byte buffer cannot overflow.
The RUN_TEST dispatch was already guarded by #ifdef TESTING, but tests.c was
compiled unconditionally (APP_SOURCE_PATH globs all of src/) and dispatcher.c
included tests.h unconditionally. Guard the test handler's definitions and the
include with #ifdef TESTING so production builds (TESTING=0) contain no test
code at all, instead of relying on linker dead-code elimination. The #include
lines in tests.c stay outside the guard to avoid an empty translation unit.
Replace the device prompts "Transfer metadatas ?" / "Overwrite metadatas ?"
with "Backup" / "Restore" + "password list", aligned with the WebUI buttons,
and without the stray space before "?". Wallet screens keep the question mark;
the Nano variant drops it. The WebUI notices, FAQ and README that quote these
prompts are updated to match.
Also silence pylint's false no-member errors on the MetaScreen-generated
CustomTouchScreen members (surfaced now that the file is touched).
On touch devices the passwords list is paginated and NBGL forwards a
page-relative index, so password_callback() rebuilds the absolute index
from the page number. Add a regression test that seeds enough passwords
to span two pages, shows the first entry of page 2, and asserts the
revealed value matches the value derived independently for that nickname
(guarding against an off-by-page error in the recalculation). Marked
skip_nano since the Nano list shows one choice per page.
The Backup/Restore approval used nbgl_useCaseConfirm, whose callback only
fires on "Approve". Pressing "Refuse" silently dismissed the modal without
sending any APDU response, so the host waited forever (the WebUI stayed stuck
with greyed-out buttons).

Switch to nbgl_useCaseChoice, which reports both outcomes: approve keeps the
previous behaviour, refuse answers SWO_CONDITIONS_NOT_SATISFIED (0x6985) and
returns to the home page.
Cover the refusal path: triggering a Backup/Restore and pressing "Refuse" on
the device must answer 0x6985 (ActionCancelledError). Adds an APDU_REJECT
navigation instruction for both the touch and Nano navigators, refusal helpers
on the command client, and two xfail tests.

Regenerate the Nano backup/restore approval snapshots: the screen now uses
nbgl_useCaseChoice and shows a small alert glyph.
A device refusal now returns 0x6985, which surfaced as a generic "failed"
error banner. Tag the mapped error with its status word and treat the
cancellation status apart: show an informational notice instead of an error.
@github-actions

Copy link
Copy Markdown
Contributor

Code coverage report

Code Coverage

Per-file coverage
Package Line Rate Branch Rate Health
src 67% 63%
Summary 67% (113 / 168) 63% (45 / 71)

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.66667% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.88%. Comparing base (ce5a4fb) to head (d40f5ff).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
src/password.c 33.33% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #121      +/-   ##
==========================================
+ Coverage   73.96%   81.88%   +7.92%     
==========================================
  Files           7        7              
  Lines         361      381      +20     
  Branches       41       42       +1     
==========================================
+ Hits          267      312      +45     
+ Misses         88       53      -35     
- Partials        6       16      +10     
Flag Coverage Δ
unittests 81.88% <86.66%> (+7.92%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cedelavergne-ledger
cedelavergne-ledger merged commit 878a919 into master Jun 22, 2026
132 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