taler-android

Android apps for GNU Taler (wallet, PoS, cashier)
Log | Files | Refs | README | LICENSE

purge-destroys-coins-and-history-without-saying-so.md (4430B)


      1 <!--
      2   This file is part of GNU Taler
      3   (C) 2026 Taler Systems S.A.
      4 
      5   GNU Taler is free software; you can redistribute it and/or modify it under the
      6   terms of the GNU General Public License as published by the Free Software
      7   Foundation; either version 3, or (at your option) any later version.
      8 
      9   GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
     10   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     11   A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     12 
     13   You should have received a copy of the GNU General Public License along with
     14   GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
     15 -->
     16 
     17 # "Force deletion (purge)" destroys the coins and the history, and says neither
     18 
     19 Found by the `history_after_forgetting_exchange` scenario, written to ask
     20 whether the transaction history survives removing the payment service it
     21 belongs to. It does not, and nothing warns about it.
     22 
     23 **Severity: moderate.** Irreversible, reachable in a release build from
     24 Settings → Payment services, and it destroys money: the wallet went from
     25 €9.87 and a transaction history to the first-run welcome screen.
     26 
     27 ## What happens
     28 
     29 A wallet with €9.87 withdrawn from one payment service, Settings → Payment
     30 services → the service's menu → **Delete payment service**. The dialog is:
     31 
     32 ```
     33 Delete payment service
     34 [ ] Force deletion (purge)
     35                                           Delete   Cancel
     36 ```
     37 
     38 That is the whole dialog — a title, a checkbox, two buttons. There is no body
     39 text, no mention of the balance held at that service, and no statement of what
     40 "purge" additionally destroys.
     41 
     42 Ticking the box and pressing **Delete**:
     43 
     44 ```
     45 transactions before:  ['Withdraw']
     46 after forgetting:     the payment services list, with the service gone
     47 home afterwards:      ['Wallet', 'Welcome to Taler Wallet!',
     48                        'To make your first payment, withdraw digital cash.', …]
     49 transactions after:   []
     50 ```
     51 
     52 The €9.87 is gone, the withdrawal that produced it is gone, and the wallet
     53 looks like a fresh install.
     54 
     55 Without the checkbox the app does protect the user — a plain delete of a
     56 service that still holds coins is refused, which is what the
     57 `exchange_delete_with_coins` scenario covers. The checkbox is the override,
     58 and it is the override that carries no warning.
     59 
     60 ## Why
     61 
     62 The dialog has no text beyond the checkbox label:
     63 
     64 ```kotlin
     65 // wallet/src/main/java/net/taler/wallet/exchanges/ExchangeListScreen.kt:297
     66 AlertDialog(
     67     onDismissRequest = onDismiss,
     68     title = { Text(stringResource(R.string.exchange_delete)) },
     69     text = {
     70         Row(verticalAlignment = Alignment.CenterVertically) {
     71             Checkbox(checked = purge, onCheckedChange = { purge = it })
     72             Text(stringResource(R.string.exchange_delete_force))
     73         }
     74     },
     75     confirmButton = { TextButton(onClick = { onConfirm(purge) }) { … } },
     76     …
     77 )
     78 ```
     79 
     80 `R.string.exchange_delete_force` is the five words "Force deletion (purge)".
     81 There is no string in the file that explains the consequence, so there is
     82 nothing to show even if the dialog wanted to.
     83 
     84 For contrast, the wallet's own reset dialog *does* explain itself, and
     85 forgetting a bank account asks "Do you really wish to forget…".
     86 
     87 ## Reproduce by hand
     88 
     89 1. Withdraw some money, so the wallet has a balance and a transaction.
     90 2. Settings → **Payment services** → the service's **Menu** → **Delete
     91    payment service**.
     92 3. Tick **Force deletion (purge)** and press **Delete**.
     93 4. The service disappears. Go back to the main screen: it is the first-run
     94    welcome screen, the balance is gone, and the transaction list is empty.
     95 
     96 ## Reproduce with the simulator
     97 
     98 ```bash
     99 ssh root@tripwire.taler.net
    100 cd /opt/taler-sim/driver
    101 SIM_WORKER=4 python3 suite.py history_after_forgetting_exchange
    102 ```
    103 
    104 The notes record the transactions before, the dialog, and the empty list
    105 afterwards.
    106 
    107 ## Suggested fix
    108 
    109 Give the dialog a body that says what will happen, and name the amount at
    110 risk: the balance for that scope is already in `BalanceManager`, so "This
    111 payment service holds €9.87. Deleting it will destroy that balance and the
    112 record of every transaction made with it." is available to write. Requiring
    113 the checkbox *and* a typed confirmation would not be excessive for an action
    114 that cannot be undone; at the very least the consequence should be stated
    115 before the money is gone.