Skip to content

fix: add passphrase verification and safety gates to wallet delete - #230

Open
ygd58 wants to merge 1 commit into
open-wallet-standard:mainfrom
ygd58:fix/wallet-delete-safety-gates
Open

fix: add passphrase verification and safety gates to wallet delete#230
ygd58 wants to merge 1 commit into
open-wallet-standard:mainfrom
ygd58:fix/wallet-delete-safety-gates

Conversation

@ygd58

@ygd58 ygd58 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Closes #228

Summary

Addresses all four safety gaps in ows wallet delete reported in issue #228.

Changes

1. Passphrase verification (ops.rs)

delete_wallet() now requires the owner passphrase before deletion. The passphrase is verified by decrypting the wallet envelope — an incorrect passphrase returns an error without touching the file. Agents and scripts cannot delete wallets without owner authentication.

2. API key warning (wallet.rs CLI)

Before deletion, the CLI checks for API keys scoped to the wallet and prints a warning listing their names, so the user knows which keys will stop working after deletion.

3. Path traversal protection (vault.rs)

delete_wallet_file() now explicitly rejects IDs containing path separators or traversal sequences (../ etc.) with a clear error.

4. Filesystem permissions respected (vault.rs)

If the vault directory has read-only permissions (e.g. chmod 500), delete_wallet_file() now returns an explicit error instead of silently restoring write permissions to force deletion. Checks the owner-write bit (0o200) on the vault directory before attempting removal.

Testing

All 604 existing tests pass.

Closes open-wallet-standard#228

Addresses three safety gaps in ows wallet delete:

1. Passphrase verification (ops.rs)
   delete_wallet() now requires the owner passphrase before deletion.
   The passphrase is verified by decrypting the wallet envelope —
   incorrect passphrase returns an error without touching the file.
   Agents and scripts cannot delete wallets without owner authentication.

2. API key warning (wallet.rs CLI)
   Before deletion, the CLI checks for API keys scoped to the wallet
   and prints a warning listing their names. This makes it clear that
   dependent keys will stop working after deletion.

3. Path traversal protection (vault.rs)
   delete_wallet_file() now rejects IDs containing path separators
   or traversal sequences (../ etc.) with an explicit error instead
   of relying on file-not-found behaviour.

All 604 existing tests pass.
@ygd58
ygd58 requested a review from njdawn as a code owner June 4, 2026 08:11
@vercel

vercel Bot commented Jun 4, 2026

Copy link
Copy Markdown

@ygd58 is attempting to deploy a commit to the MoonPay Team on Vercel.

A member of the Team first needs to authorize it.

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.

Bug: wallet delete --confirm bypasses policy engine, filesystem permissions, and all safety gates

1 participant