AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 32 Bitcoin

fix(python): fix trezorctl get-session

Public commit record

What the developer wrote

Authored by matejcik

92/100 · Strong
fix(python): fix trezorctl get-session

* if an invalid base64 string is set in TREZOR_SESSION_ID, trezorctl
would crash.
* when resuming a THP session, pairing.finish() was not called, leading
to an invalid state. Ensure that pairing.finish() is called even in case
a pairing flow did not run.
* change `@get_session(passphrase=False)` to mean "do not prompt for
passphrase" as opposed to "force use standard wallet". That matches the
actual usages in code.
* try resuming session first in `get_session`, so that if we do have
a session to resume, prompt_passphrase=False will use it without
(re)deriving a standard wallet. (There is no situation where we explicitly
*need* a standard wallet for something, what we actually have are situations
where we *don't need* to ask for passphrase.)
* take advantage of improved ensure_unlocked() and remove trezorctl-specific
reuse of standard session (which is now no longer auto-created).
✓ Descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides detailed explanatory context✓ Explains rationale or failure mode
The short version

What changed, and why it matters

This commit fixes the `trezorctl get-session` command in Trezor's Python library. It prevents crashes when an invalid session ID is supplied, ensures a required pairing step is completed when resuming secure (THP) sessions, and changes the meaning of `passphrase=False` from 'always use a standard wallet' to 'do not ask for a passphrase.' These are reliability and state-correctness fixes in the command-line tool, not the hardware wallet firmware itself.

Recommended action

Treat as a bug-fix commit with minor security hygiene benefits. Users of trezorctl should update the Python library. No urgent firmware or key-extraction risk is evident from the diff alone. Reviewers may want to confirm that `client.pairing.finish()` is safe to call unconditionally and that removing the standard-session cache does not reintroduce passphrase prompts in scripted/automated workflows.

Security signals we found

01

Invalid input (malformed base64 session ID) previously caused an unhandled exception/crash in the CLI.

02

THP session resumption could leave pairing in an invalid state because `pairing.finish()` was skipped when no pairing flow ran.

03

The `passphrase=False` semantic change could affect which wallet/session is derived in CLI workflows, but the commit message frames this as matching actual intended usage.

04

Removal of a locally cached 'standard session' reduces risk of stale/unlocked session reuse inside trezorctl.

Risk score

Why this scored 32/100

Our methodology →
Potential impact 8/30
Exploitability 5/25
Stealth signal 4/15
Affected reach 6/15
Confidence 6/10
Evidence quality 3/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.