Skip to content

fix(wallet): refuse Core and Platform sends to someone else's private address - #1113

Merged
lklimek merged 2 commits into
v1.0-devfrom
fix/shielded-foreign-address-guard
Oct 26, 2026
Merged

lklimek merged 2 commits into
v1.0-devfrom
fix/shielded-foreign-address-guard

Conversation

@Claudius-Maginificent

@Claudius-Maginificent Claudius-Maginificent commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

TL;DR: Sending from your Core wallet or Platform balance to another person's private (shielded) address quietly put the money into your own private balance and still showed success. The app now stops that send before anything happens and tells you to pay private addresses from your Shielded Balance. Moving your own funds into your own private balance works as before.

User story

As a wallet user, I want a payment to someone's private address to either reach them or be refused, so that I never believe I paid someone when the money stayed with me.

Scenario

Base flow

Wallet › Send, choose Core Wallet (or Platform Addresses) as the source, paste another wallet's private (shielded) address, enter an amount, press Send and confirm.

Actual behavior

The funds are shielded into the sender's own private balance. The typed address is ignored, the recipient receives nothing, and the app reports success.

Expected behavior

  • The send is refused before any transaction is built, with: "Core and Platform funds can only move into your own private balance. To pay this private address, choose Shielded Balance as the source."
  • Shielding your own funds (Shield, or typing your own private address) still works.
  • Paying someone's private address from the Shielded Balance still works.

Detailed discussion

Root cause: validated_send_route in src/ui/wallets/send_screen.rs accepts any (Core | Platform, Shielded) pair; send_core_to_shielded and send_platform_to_shielded dispatch ShieldFromAssetLock / ShieldFromBalance, which carry no recipient, and the backend deposits into shielded_default_address(seed_hash, 0) (src/backend_task/shielded/mod.rs).

Fix (UI route check only, no backend task changes): shielded_destination_is_own_pool() accepts the Shield preset's own-pool marker or an address whose decoded bytes equal the wallet's account-0 shielded address (so hex and case variants match). validated_send_route refuses everything else before a task or confirmation dialog exists. It fails closed while the wallet's own shielded address is not yet known. The MCP shield tools take no recipient and are unaffected.

The Send screen redesign (#1112) contains an equivalent guard with compatible wording.

Known limitations

  • If DET ever shows a diversified (non-default) own shielded address, shielding into it from Core or Platform would be refused; today only the account-0 default address is shown.

Testing

  • 4 new send-screen unit tests: foreign address refused for Core and Platform (route check and send path), refused while the own address is unknown (Shield preset still works), own pool still accepted (marker, bech32m, uppercase, hex), Shielded source still pays a foreign address. The refusal tests failed before the guard.
  • ui::wallets::send_screen lib tests: 74 passed; clippy --all-features --lib --tests -D warnings clean.
  • Not tested in the running app or on a live network.

🤖 Co-authored by Claudius the Magnificent AI Agent

🤖 Generated with Claude Code

https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

PR Hygiene · 1929e69

  • Bots — coderabbitai skipped by lklimek · thepastaclaw skipped by lklimek
  • Self-review — not asked of a bot author
  • Build green
  • Approvals
    • files with no dedicated owner (src/ui/wallets/send_screen.rs) — approved by lklimek

When every merge requirement is met, the PR Hygiene check passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.

Summary by CodeRabbit

  • Bug Fixes
    • Core and Platform sends are now blocked when the destination is a private address belonging to a different wallet.
    • Recognized spellings of the selected wallet’s own receive address are accepted. Shielded sends to other shielded addresses remain available.

… address

Shielding from Core or Platform always deposits into the paying wallet's
own shielded pool: the ShieldFromAssetLock and ShieldFromBalance tasks carry
no recipient. The Send screen still accepted any typed private address for
those sources, so a payment meant for another wallet landed back in the
sender's own pool while the app reported success.

The route check now refuses a Core or Platform source paired with a private
address unless it is the wallet's own (the Shield flow's own-pool marker, or
the wallet's account-0 address compared as decoded bytes). The refusal
happens before any backend task is built and tells the user to pay from the
Shielded Balance instead. Fails closed while the own address is not cached.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 41 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between ad9901c and 1929e69.

Files selected for processing: 1
  • src/ui/wallets/send_screen.rs

No actionable comments were generated in the recent review.

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between 4c38d4c and ad9901c.

📒 Files selected for processing: 1
  • src/ui/wallets/send_screen.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

Core and Platform sends now reject shielded destinations that do not match the selected wallet’s known receive address. The empty Shield-flow marker and matching own-address spellings remain accepted. Shielded sources can still send to another shielded address.

Changes: Shielded send validation

Layer / File(s) Summary
Recognize the wallet’s own shielded address
src/ui/wallets/send_screen.rs
Adds a check that accepts the empty Shield-flow marker or a parsed address matching the selected wallet’s known receive address by bytes. Adds the refusal message for other shielded destinations.
Enforce validation before route selection
src/ui/wallets/send_screen.rs
Core and Platform sources return the refusal message when a shielded destination fails the check. Tests cover unknown own addresses, accepted own-address spellings, foreign addresses, and the Shielded-source exception.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

  • dashpay/dash-evo-tool#1105 — This issue requires Platform-to-foreign shielded-address payments. This change rejects those destinations, so the requested payment behavior remains a follow-up.

Suggested reviewers: lklimek

Merge Risk: Minimal · up to ad990

Foreign private-address sends from Core or Platform funds are refused before submission. No actionable merge-blocking risk remains after normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: Core and Platform sends to another wallet's private address are now refused. The raw summary shows the validated_send_route check and the refusal message in send_scree…
Docstring Coverage Passed Docstring coverage is 81.82% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 1 files.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: Core and Platform sends to another wallet's private address are now refused. The raw summary shows the validated_send_route check and the refusal message in send_screen.rs, which match the title. The title follows the conventional fix(wallet) prefix and is concise and specific, so it passes.

✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@thepastaclaw

thepastaclaw commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

🔍 Review in progress — actively reviewing now (commit 1929e69) · triage: critical · Phase 2 only (no Phase 1 for this repository)
███████████████░░░░░ 74% · taking longer than usual · running for 1 h 0 min
✅ triage → ⏭️ Phase 1 → ⏳ Phase 2 (1/2 lanes) → ▫️ verify 2 → ▫️ publish
Estimated from recent reviews of this tier · updated 13:13 UTC · live progress

@lklimek
lklimek marked this pull request as ready for review October 23, 2026 23:27
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai ✓ · thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Oct 23, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final validation — Phase 2 only (no Phase 1 for this repository)

The PR correctly blocks Core and Platform shield operations from accepting another wallet’s private address while preserving own-pool shielding and Shielded Balance transfers. The guard is applied before task construction, and the backend shield tasks independently deposit into the sender’s account-0 shielded address; current Test Suite and Clippy checks are still in progress.

Review provenance

Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.1-sol (effort low) — This is a contained UI routing and validation change affecting send behavior, but the diff does not itself perform or alter funds movement, transaction construction, signing, or backend processing.
  • Phase 1 reviewers: not run (disabled for this repository)
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort high); agent phase2-reviewer

@github-actions github-actions Bot removed the waiting-bots Waiting for the review bots to report on this head label Oct 24, 2026
@lklimek
lklimek enabled auto-merge (squash) October 26, 2026 11:39
@lklimek

lklimek commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

/skip-bots

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai not yet · thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Oct 26, 2026
@lklimek

lklimek commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

/skip-bots

@github-actions

Copy link
Copy Markdown
Contributor

Policy satisfied — this can merge.
Full checklist in the description.

@github-actions github-actions Bot added bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. and removed waiting-bots Waiting for the review bots to report on this head labels Oct 26, 2026
@lklimek
lklimek merged commit 1d9d710 into v1.0-dev Oct 26, 2026
10 checks passed
@lklimek
lklimek deleted the fix/shielded-foreign-address-guard branch October 26, 2026 13:15
lklimek added a commit that referenced this pull request Oct 28, 2026
…1147)

With Core or Platform as the source and another wallet's private address
typed, the Send form offered an enabled Shield DASH button and a fee
estimate. It refused only on click. The #1113 route check now lives in one
function that also drives the form: the refusal shows under the address
as soon as it applies, and Shield DASH is turned off with the same
explanation on hover. The route check still refuses with the same error,
so the guard itself is unchanged.

The address suggestions popup stayed open after the field lost focus. It
drew above a blocking dialog's dimmed backdrop, and its arrow and Enter
keys kept working behind the dialog. AddressInput now closes the popup
while a modal layer blocks the field.


Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

Co-authored-by: Lukasz Klimek <842586+lklimek@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot-review-skipped A required review bot did not report; it was skipped by the window or by a person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants