Skip to content

fix(trezor-client): send empty passphrase for standard wallets#7034

Open
ifdario wants to merge 1 commit into
trezor:mainfrom
infinitefield:fix/passphrase-standard-wallet
Open

fix(trezor-client): send empty passphrase for standard wallets#7034
ifdario wants to merge 1 commit into
trezor:mainfrom
infinitefield:fix/passphrase-standard-wallet

Conversation

@ifdario
Copy link
Copy Markdown

@ifdario ifdario commented May 31, 2026

Fixes #7033

handle_interaction incorrectly handles PassphraseRequest for standard wallets (no passphrase configured).

When on_device() returns false, the current code calls req.ack(!on_device) which sets on_device = true in the PassphraseAck, causing the Trezor to prompt for passphrase entry on the device even when none is configured.

The fix sends an empty passphrase string via ack_passphrase(String::new()) when on_device() is false, which is the correct protocol response for standard (non-hidden) wallets.

handle_interaction was sending on_device=true for non-device passphrase
requests, which caused the Trezor to prompt for a passphrase even when
none is configured. For standard wallets (no passphrase), the correct
behavior is to reply with an empty passphrase string.
@ifdario ifdario requested a review from obrusvit as a code owner May 31, 2026 12:54
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 31, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 67cce5fb-60e5-4450-8c1a-67278c879efe

📥 Commits

Reviewing files that changed from the base of the PR and between a3bc309 and 99b8fcb.

📒 Files selected for processing (1)
  • rust/trezor-client/src/client/common.rs

Walkthrough

This PR fixes a bug in the Trezor client's interaction handler. The handle_interaction function previously called req.ack(!on_device) for all PassphraseRequest cases, which incorrectly sent on_device=true when the request had on_device=false. The fix adds explicit branching: when the device should handle passphrase entry, it calls req.ack(true); otherwise it calls req.ack_passphrase(String::new()) to provide an empty passphrase string. The resulting response is then recursively handled.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing passphrase handling for standard wallets in the trezor-client.
Description check ✅ Passed The description clearly explains the bug, root cause, and the fix with relevant code context and protocol details.
Linked Issues check ✅ Passed The code changes directly address issue #7033 requirements: branching on on_device(), calling ack(true) when true, and ack_passphrase(String::new()) when false.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing PassphraseRequest handling in handle_interaction, directly addressing the linked issue #7033 with no extraneous modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

handle_interaction sends on_device=true instead of empty passphrase for standard wallets

1 participant