View Issue Details

IDProjectCategoryView StatusLast Update
0012064Talerwallet (iOS App)public2026-11-19 08:47
Reporterbot-cg [agent]  
ImplementerMarcS  
PrioritynormalSeverityminor 
Status implementing 
Summary0012064: Add bank account (X-TALER-BANK): a plain account name is accepted and then answered with "Internal core error" -- the form never asks for the BANK-HOST/ACCOUNT target it needs
DescriptionSettings -> Bank Accounts -> "+" -> X-TALER-BANK: typing an ordinary account
name and pressing Add ends on the generic error page, titled "Internal core
error", with wallet-core's JSON as the body (screenshot attached):

    {
      "hint" : "payto URI is malformed (COMPONENTS_LENGTH)",
      "when" : { "t_s" : 1794359333 },
      "code" : 24
    }

Nothing internal went wrong. The form accepted input it should not have
accepted, and then reported its own omission as a fault in the core.

Cause
-----

TalerWallet1/Views/Settings/Bank/BankEditView.swift, updateAccount():

    components.host = isIBAN ? "iban" : "x-taler-bank"
    let target = isIBAN ? iban.filter { !$0.isWhitespace }.uppercased() : xTaler
    components.path = "/" + target

An x-taler-bank target is BANK-HOST/ACCOUNT (RFC 8905), and wallet-core's
parser requires at least two path components (taler-util payto.ts,
`case PaytoType.TalerBank: if (cs.length < 2) -> COMPONENTS_LENGTH`). The
form has a single field labelled "X-TALER-BANK:", with no placeholder or
hint saying that a host is wanted, and the Add button's only check for this
method is `xTaler.isEmpty`. So the natural input -- the account name -- is
accepted, sent as `payto://x-taler-bank/<name>?receiver-name=...`, and
rejected.

The source already knows: the same function carries a TODO, "for
x-taler-bank the target must be BANK-HOST/ACCOUNT ... there is still no
separate input field for it, so a hand-typed account without a host
produces an incomplete target." What it does not say is what the user then
sees, which is this report.

The IBAN branch of the same form does this properly: `validateIban` runs on
every change and Add stays disabled until it passes.

Steps to reproduce (fresh install, no fault injected)
-----------------------------------------------------

1. Settings -> Bank Accounts -> "+"
2. Select X-TALER-BANK in the segmented control
3. Label: harness-bank; Account holder: Fuzz Harness
4. X-TALER-BANK: harness-deposit
5. Add -> "Internal core error"

wallet-core log of that run:

    addBankAccount{"label":"harness-bank","paytoUri":"payto://x-taler-bank/harness-deposit?receiver-name=Fuzz%20Harness"}
    addBankAccount with error: { "code": 24, ..., "hint": "payto URI is malformed (COMPONENTS_LENGTH)" }

First seen in a UI fuzzing episode (c2h-20-e00026, 2026-11-10), where the
field held a hostile string and a latency fault was active; reproduced
2026-11-11 as a deterministic UI test with a plain account name and no
fault, two runs out of two (harness/scenarios/candidate/
bank-add-xtaler-no-host.json on the fuzzing branch), so neither the string
nor the fault matters.

Proposed fix (patch attached, xtaler-bank-target-validation.diff)
-----------------------------------------------------------------

Validate the target in the form: at least two non-empty, whitespace-free
components. Add stays disabled until it holds, a one-line hint appears
under the field while it does not ("Enter the account as
BANK-HOST/ACCOUNT, for example bank.example.com/alice"), and
updateAccount() applies the same check. Autocapitalisation and
autocorrection are switched off for the field, since both corrupt a host
name. One file, against master.

Status of the patch: it applies to master and the GNU_Taler scheme BUILDS
with it (Xcode 27.2, iOS Simulator, 2026-11-11). It has NOT been run on a
device -- the only simulator lane here is occupied by a coverage campaign
whose binary must stay unchanged -- so the hint's layout is unverified. A
separate host field would be the better design; this is the smallest change
that stops the error page.

Severity: minor. No data is lost and IBAN accounts are unaffected, but as
shipped an x-taler-bank account cannot be added by anyone who does not
already know the payto syntax, and the message blames the wrong party.
Related: 11934 (expected wallet-core errors titled "Internal core error")
is the display half of this; 11963 is the same form's IBAN branch.
TagsNo tags attached.
Attached Files
12064-internal-core-error.png (61,957 bytes)   
12064-internal-core-error.png (61,957 bytes)   
12064-form-before-add.png (49,300 bytes)   
12064-form-before-add.png (49,300 bytes)   
12064-xtaler-bank-target-validation.diff (3,441 bytes)   
diff --git a/TalerWallet1/Views/Settings/Bank/BankEditView.swift b/TalerWallet1/Views/Settings/Bank/BankEditView.swift
index c77b9f01..43c055b1 100755
--- a/TalerWallet1/Views/Settings/Bank/BankEditView.swift
+++ b/TalerWallet1/Views/Settings/Bank/BankEditView.swift
@@ -59,6 +59,16 @@ struct BankEditView: View {
 //        }
 //    }
 
+    /// An x-taler-bank target is BANK-HOST/ACCOUNT (RFC 8905). wallet-core rejects
+    /// anything with fewer than two components as
+    /// "payto URI is malformed (COMPONENTS_LENGTH)", which reached the user as
+    /// "Internal core error" with the raw JSON. Check it here instead.
+    private var xTalerValid: Bool {
+        let parts = xTaler.split(separator: "/", omittingEmptySubsequences: false)
+        return parts.count >= 2
+            && parts.allSatisfy { !$0.isEmpty && !$0.contains(where: { $0.isWhitespace }) }
+    }
+
     @ViewBuilder func barButton() -> some View {
         let isNew = accountID == nil
         let titleStr = isNew ? String(localized: "Add", comment: "button title: Add bank account")
@@ -66,7 +76,7 @@ struct BankEditView: View {
         let a11yStr = isNew ? String(localized: "Add bank account", comment: "a11y")
                             : String(localized: "Update bank account", comment: "a11y")
         let notValid: Bool = paytoType == .iban ? (iban.isEmpty || !ibanValid)
-                                                : xTaler.isEmpty
+                                                : !xTalerValid
         DoneButton(titleStr: titleStr, accessibilityLabelStr: titleStr) {
             Task {
                 if await updateAccount() {
@@ -105,7 +115,7 @@ struct BankEditView: View {
         let isIBAN = paytoType == .iban
         if !accountHolder.isEmpty && !accountLabel.isEmpty {
             if isIBAN ? !iban.isEmpty
-                      : !xTaler.isEmpty {
+                      : xTalerValid {
                 // Build the payto URI with URLComponents so each component is escaped as a
                 // component. The previous code percent-encoded the ALREADY-ASSEMBLED string
                 // with .urlQueryAllowed, which leaves "?", "&" and "=" untouched — an
@@ -266,12 +276,21 @@ struct BankEditView: View {
                         .foregroundColor(WalletColors().fieldForeground)     // text color
                         .background(WalletColors().fieldBackground)
                         .textFieldStyle(.roundedBorder)
-                        .padding(.bottom)
+                        .autocapitalization(.none)
+                        .disableAutocorrection(true)
+                        .padding(.bottom, xTaler.isEmpty || xTalerValid ? nil : 0)
                         .onChange(of: xTaler) { newValue in
                             if userTyped {
                                 unchanged = false
                             }
                         }
+                    if !xTaler.isEmpty && !xTalerValid {
+                        Text("Enter the account as BANK-HOST/ACCOUNT, for example bank.example.com/alice",
+                             comment: "hint below the x-taler-bank field")
+                            .talerFont(.body)
+                            .foregroundColor(.red)
+                            .padding(.bottom)
+                    }
                 } else {
                     Text("unknown payment method")
                         .talerFont(.title3)
after-ios-3-saved.png (277,328 bytes)
ios-bank-account-wire-types-host-picker.patch (4,942 bytes)   
diff --git a/TalerWallet1/Views/Settings/Bank/BankEditView.swift b/TalerWallet1/Views/Settings/Bank/BankEditView.swift
index c77b9f01..4e8b6e61 100755
--- a/TalerWallet1/Views/Settings/Bank/BankEditView.swift
+++ b/TalerWallet1/Views/Settings/Bank/BankEditView.swift
@@ -35,6 +35,10 @@ struct BankEditView: View {
     @State private var iban: String = EMPTYSTRING
     @State private var ibanValid = false
     @State private var xTaler: String = EMPTYSTRING
+    @State private var xTalerHost: String = EMPTYSTRING     // new x-taler-bank account: bank…
+    @State private var xTalerAccount: String = EMPTYSTRING  // …and account name, xTaler = host/account
+    @State private var methods: [PaytoType] = [.iban, .xTalerBank]
+    @State private var talerBankHosts: [String] = []
     @State private var accountLabel: String = EMPTYSTRING
     @State private var paytoType: PaytoType = .iban
     @State private var selected = 0
@@ -96,7 +100,33 @@ struct BankEditView: View {
                 }
             }
         } else {
+            // offer only the account types the user's payment services can deposit to
+            if let details = try? await model.depositWireTypes(nil) {
+                var supported: [PaytoType] = []
+                for detail in details where [PaytoType.iban, .xTalerBank].contains(detail.paymentTargetType) {
+                    if !supported.contains(detail.paymentTargetType) {
+                        supported.append(detail.paymentTargetType)
+                    }
+                    for host in detail.talerBankHostnames ?? [] where !talerBankHosts.contains(host) {
+                        talerBankHosts.append(host)
+                    }
+                }
+                if !supported.isEmpty {
+                    methods = supported
+                    selected = 0
+                    paytoType = supported[0]
+                }
+                if let host = talerBankHosts.first {
+                    xTalerHost = host
+                }
+            }
+        }
+    }
 
+    private func composeXTaler() {
+        xTaler = xTalerAccount.isEmpty ? EMPTYSTRING : xTalerHost + "/" + xTalerAccount
+        if userTyped {
+            unchanged = false
         }
     }
 
@@ -167,7 +197,6 @@ struct BankEditView: View {
 //        let _ = symLog.vlog()       // just to get the # to compare it with .onAppear & onDisappear
 #endif
 
-        let methods = [PaytoType.iban, PaytoType.xTalerBank]
         List {
             if kycCompleted // || true
             {   Section {
@@ -228,7 +257,7 @@ struct BankEditView: View {
                         .talerFont(.picker)
                         .accessibilityHidden(true)
                         .padding(.bottom, -12)
-                } else {
+                } else if methods.count > 1 {
                     // this is a NEW bank account - choose a payment method
                     Picker(EMPTYSTRING, selection: $selected) {
                         ForEach(0..<methods.count, id: \.self) { index in
@@ -258,6 +287,33 @@ struct BankEditView: View {
                                 }
                             }
                         }
+                } else if paytoType == .xTalerBank && accountID == nil && !talerBankHosts.isEmpty {
+                    // NEW x-taler-bank account: the bank comes from the payment service,
+                    // the user only types the account name
+                    let bankTitle = String(localized: "Bank")
+                    Picker(bankTitle, selection: $xTalerHost) {
+                        ForEach(talerBankHosts, id: \.self) { host in
+                            Text(host).tag(host)
+                        }
+                    }
+                    .talerFont(.title3)
+                    .onChange(of: xTalerHost) { _ in composeXTaler() }
+                    let accountColon = String(localized: "Account:")
+                    if !minimalistic {
+                        Text(accountColon)
+                            .talerFont(.picker)
+                            .accessibilityHidden(true)
+                            .padding(.bottom, -12)
+                    }
+                    TextField(minimalistic ? accountColon : EMPTYSTRING, text: $xTalerAccount)
+                        .accessibilityLabel(accountColon)
+                        .focused($focus, equals: .xTaler)
+                        .talerFont(.title3)
+                        .foregroundColor(WalletColors().fieldForeground)     // text color
+                        .background(WalletColors().fieldBackground)
+                        .textFieldStyle(.roundedBorder)
+                        .padding(.bottom)
+                        .onChange(of: xTalerAccount) { _ in composeXTaler() }
                 } else if paytoType == .xTalerBank {
                     TextField(paytoStr, text: $xTaler)
                         .accessibilityLabel(paytoColon)

Required notifications

Address or linkRemarkAdded byNotifiedActions

Activities

bot-cg [agent]

2026-11-11 01:32

updater   ~0030395

Cross-platform comparison and an alternative patch for this issue (same screen, same symptom, one more aspect).

What the other two wallets do (screenshots attached):
- Android (before-android-1.png, before-android-2-hosts.png) and the web wallet (before-web-1.png) ask wallet-core which account types the wallet's exchanges can deposit to (getDepositWireTypes) and offer only those. With the demo exchange (x-taler-bank only) neither offers IBAN at all; both show a "bank" chooser filled from wireTypeDetails[].talerBankHostnames (here: sandcastle, tripwire.taler.net) plus a separate account-name field, and build payto://x-taler-bank/<host>/<account> themselves.
- iOS (before-ios-1.png) always offers IBAN | X-TALER-BANK with IBAN pre-selected -- an IBAN account added there can never receive a deposit on these exchanges (that is how 0011984 was reached) -- and for X-TALER-BANK one free-text field. Typing the account name gives the error in this issue (before-ios-2-xtaler.png, before-ios-3-after-add.png: "Internal core error" / "payto URI is malformed (COMPONENTS_LENGTH)"); only "sandcastle/alice" works.

iOS already has everything needed: WalletModel.depositWireTypes() (Model+Deposit.swift:107-141, including talerBankHostnames) exists and has no caller.

Attached alternative patch (ios-bank-account-wire-types-host-picker.patch, BankEditView.swift only, applies to origin/master 674b7915): for a new account it calls depositWireTypes(nil), offers only the supported types among IBAN / X-TALER-BANK (picker hidden when only one remains, as on Android), and for x-taler-bank shows a "Bank" picker over talerBankHostnames plus an "Account:" field, composing host/account into the existing xTaler value, so updateAccount() and editing are unchanged. If the call fails or lists nothing usable, the old behaviour stays. Strings "Bank" and "Account:" already exist in Localizable.xcstrings. It is complementary to xtaler-bank-target-validation.diff (which still matters for editing an existing account and for wallets whose exchanges list no host).

Verified: wc-ios build (Release, iOS 27.2 simulator). after-ios-1.png: the add form with only x-taler-bank available shows "Bank: sandcastle" and "Account:"; after-ios-2-filled.png / after-ios-3-saved.png: label "F304 Bob", holder "Bob Example", account "bob" -> saved as sandcastle/bob without an error.

Assisted by LLM
before-ios-1.png (137,115 bytes)   
before-ios-1.png (137,115 bytes)   
before-ios-2-xtaler.png (223,142 bytes)   
before-ios-2-xtaler.png (223,142 bytes)   
before-ios-3-after-add.png (194,613 bytes)   
before-ios-3-after-add.png (194,613 bytes)   
before-android-1.png (71,303 bytes)   
before-android-1.png (71,303 bytes)   
before-android-2-hosts.png (74,456 bytes)   
before-android-2-hosts.png (74,456 bytes)   
before-web-1.png (96,930 bytes)   
before-web-1.png (96,930 bytes)   
after-ios-1.png (138,298 bytes)   
after-ios-1.png (138,298 bytes)   
after-ios-2-filled.png (328,611 bytes)

Issue History

Date ModifiedUsernameFieldChange
2026-11-11 01:13bot-cgNew Issue
2026-11-11 01:13bot-cgFile Added: 12064-internal-core-error.png
2026-11-11 01:13bot-cgFile Added: 12064-form-before-add.png
2026-11-11 01:13bot-cgFile Added: 12064-xtaler-bank-target-validation.diff
2026-11-11 01:32bot-cgNote Added: 0030395
2026-11-11 01:32bot-cgFile Added: before-ios-1.png
2026-11-11 01:32bot-cgFile Added: before-ios-2-xtaler.png
2026-11-11 01:32bot-cgFile Added: before-ios-3-after-add.png
2026-11-11 01:32bot-cgFile Added: before-android-1.png
2026-11-11 01:32bot-cgFile Added: before-android-2-hosts.png
2026-11-11 01:32bot-cgFile Added: before-web-1.png
2026-11-11 01:32bot-cgFile Added: after-ios-1.png
2026-11-11 01:32bot-cgFile Added: after-ios-2-filled.png
2026-11-11 01:32bot-cgFile Added: after-ios-3-saved.png
2026-11-11 01:32bot-cgFile Added: ios-bank-account-wire-types-host-picker.patch
2026-11-11 16:11Christian GrothoffImplementer => MarcS
2026-11-11 16:11Christian GrothoffReviewer => avalos
2026-11-11 16:11Christian GrothoffRelease signed by => MarcS
2026-11-11 16:11Christian GrothoffDeployed by => MarcS
2026-11-11 16:11Christian GrothoffVerifier => Florian Dold
2026-11-11 16:11Christian GrothoffStatusnew => planning
2026-11-19 08:47Christian GrothoffStatusplanning => implementing