fix: close what the security review before the first release found

A review of the tree and its history before they are published found no
key and no bank data in them. It did find these, each closed here.

The password dialog could be emptied (daemon). Shown(), which makes a
payee's name fit for polkit's dialog, let an & through. GNOME's older
agent (polkit-gnome) and MATE's put the message into Pango markup
unescaped, where a bare & fails to parse and leaves the dialog without
a message: paying "Tom & Jerry", or an order an app names so at
checkout, asked for the password and showed no amount and no payee.
Line and paragraph separators passed too. Shown() now shows & as +,
leaves out what draws nothing or places text (control and format
characters, the separators, what Unicode ignores by default, private
use) and makes any run of spaces one space. An address is held to it
instead of made fit: an e-mail address the dialog could not show
unchanged is refused before anyone is asked, since "a&b@..." shown as
"a+b@..." is somebody else's address.

A refused caller could look (daemon). A call that names an account, a
card, a request, a draft or a connector had it looked up, at the bank
where that takes it, before polkit was asked. So a caller polkit
refused was told whether it was there ("no account is called ..."),
and had the bank asked. Such a call now asks for View first
(HandleLookup), a call that only sees looks its account up after its
yes, and the connectors are read, which refreshes the accounts at the
bank, on the first yes instead of on the first call.

An app at checkout was told too much (checkout). The refusal of an
order's reference with another amount named the amount on record, and
a refusal by the bank carried the call it answered, whose path has the
user's and the account's ids at bunq. Neither does now.

A key typed by hand could be read off the screen (app). The line under
a key field showed how the key begins and its last four characters,
which is every character of it as it is typed. It shows how the key
begins and how long it is.

Every change asks for the password (packaging, app). Change, the
action for what changes something and pays nobody, passed without a
password in an active session, so any program of the user's could
cancel a scheduled payment, ask for money in their name or freeze a
card. It asks now (auth_self), a draft saved and a card frozen
included: only View passes as shipped, and loosening is an
administrator's rule, of which the README has an example. The app says
of every change where it is confirmed (AsksPassword is gone), and the
request form sends on its button as the pay form does: its review
sheet would be a second confirmation of what the dialog confirms.

What is built is what was tested (build). Crafter.Network, Crafter.DB
and Crafter.LintRules are named at the commits the tests ran against.
Crafter.Thread still follows its branch, which Crafter.Network's own
project file names, and so does Crafter.Network in the app's debug
build, where Crafter.Debug names it too and crafter-build refuses a
module built twice. lib/json.hpp was nlohmann/json's develop branch at
95e9a593 less its last newline, and called 3.12.0: it is that file
byte for byte now, and called what it is.

The published contract changes with this, before any release (design
rule 10): an e-mail address the dialog cannot show as it is is
refused, a call that looks something up needs View as well as its own
action, the checkout's errors say less, and the policy asks for the
password for Change. The XML, the policy and ShouldServeEveryUser,
which now holds the policy to its defaults, change together.

Reproduced and verified on the fake bus and the fake bunq. The new
checks of ShouldServeEveryUser fail on the worker of before (50 of
them: the & shown, the lookups answered, the bank asked) and pass now.
crafter-build test (17 tests), lint for the library, the app and the
fake system, and tests/coverage.sh (every line, function and region)
pass. Looked at on the made-up system, 360x760 dp at scale 2, dark, on
KDE Wayland: the key form with a key typed, the request form with its
wait and its result, a card frozen, and About. No picture in the
README shows a screen that changed.

Not tried: bunq's sandbox, a real polkit agent, the Flatpak builds.
The README's example rule ran against a stand-in for polkit's rule
engine only.

Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
This commit is contained in:
Jorijn van der Graaf 2026-11-19 16:09:48 +01:00
commit 2e3739ff7a
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB
23 changed files with 488 additions and 209 deletions

View file

@ -31,11 +31,11 @@ Five C++26 modules, and a sixth in one build:
| `implementations/nostro-app.cpp` | The app's `main`: the command line, the parts put together, the toolkit's gallery (`--gallery`) and a player of input scripts (`--poke`). |
| `interfaces/Nostro.DebugCommands.cppm`, `implementations/Nostro.DebugCommands.cpp` | The commands, watches, events and checks of the app's `--debug-api` build; see "Looking at the app". |
| `assets/` | Noto Sans Regular and Medium with their licence (`OFL.txt`); the app's build puts the fonts beside the executable. |
| `project.cpp` | The build description: reads `--banks=`, `--lib`, `--dbus`, `--product=`, `--graphics=`, `--debug-api`, `--coverage` and `--profile-runtime=`, forwards the other args to the dependencies (with `--no-quic` for Crafter.Network, except in the app's debug build), returns the product. It also holds what the app is as a Flatpak (`app.flatpak`) and the `fake` run script. |
| `project.cpp` | The build description: reads `--banks=`, `--lib`, `--dbus`, `--product=`, `--graphics=`, `--debug-api`, `--coverage` and `--profile-runtime=`, forwards the other args to the dependencies (with `--no-quic` for Crafter.Network, except in the app's debug build), returns the product. It names each dependency at a commit ("Dev environment"). It also holds what the app is as a Flatpak (`app.flatpak`) and the `fake` run script. |
| `packaging/dbus/` | The published D-Bus interfaces, `net.catcrafts.Nostro1.xml` and `net.catcrafts.Nostro1.Checkout.xml`. |
| `packaging/system/` | What a Flatpak cannot install: the polkit policy, the D-Bus policy and activation files, `nostrod.service`, the sysusers entry, the `nostro` command, `install.sh` and `uninstall.sh`. |
| `packaging/flatpak/`, `packaging/licenses/`, `packaging/arch/` | nostrod's Flatpak manifest (on crafter-build's Flatpak as its base app), each Flatpak's metainfo and `.flatpakref`, the app's desktop entry and icon, and the two scripts that cross-build both Flatpaks for aarch64; the licence texts the Flatpaks carry, with a `NOTICE` of what each covers; the Arch package of the system files, `nostro-system`. |
| `lib/json.hpp` | nlohmann/json 3.12.0 (MIT), included in the global module fragment of `:Bunq` and of the `Connector`, `Bunq` and `BunqPayments` implementation units. |
| `lib/json.hpp` | nlohmann/json (MIT), included in the global module fragment of `:Bunq` and of the `Connector`, `Bunq` and `BunqPayments` implementation units. Not a release: `single_include/nlohmann/json.hpp` as upstream's `develop` had it at commit `95e9a5931c828cd7306eff36090a5b38e0e3f598` (2026-09-25), which still calls itself 3.12.0, the release of 2025-04-11. It is that file byte for byte, so `git hash-object lib/json.hpp` gives its id there, `4981c3b02e0367e22419b17c37345873d7813076`: keep it so, and name the commit here and in `packaging/licenses/NOTICE` when it is replaced. |
| `tests/<Name>/main.cpp`, `tests/Support/`, `tests/FakeSystem/`, `tests/coverage.sh` | The tests, their checks, fake bunq and fake system bus, the made-up system built from those, and the coverage run; see "Testing instructions". |
| `docs/screenshots/` | The README's pictures of the app, on a phone's screen and in a desktop window, and `take.sh`, which takes them again on the made-up system; see "Looking at the app". |
| `README.md`, `LICENSE`, `LICENSE.GPL` | The manual; the LGPL version 3, which the library, nostrod and the CLI are under, and the GPL version 3, which the LGPL adds its permissions to and which the app is under (design rule 13). |
@ -78,7 +78,7 @@ Partitions, from the bottom up (each imports only the ones above it):
- `:Banks`: what is a bank's own, for each bank the app can connect: `Bank` (what nostrod calls it, its name, its ways in) and `Way` (a way to connect: its title, the form it is filled in on, where what was given is revoked, and whether a connection made that way pays between the user's own accounts only). They are found by nostrod's names for them (`Banks`, `FindBank`, `FindWay`, `BankName`, `WayName`, `OwnAccountsOnly`, `Revoking`); a bank or a way that nostrod has and the app does not know is said by nostrod's name for it. Not the library's `Nostro:Banks`, which is the banks a build has.
- `:Format`: how the app words what a bank gives it: `Money` (`€12,500.00`), `GroupIban`, `PartyName`, `DayLabel`, `ShortDate`, `KindLabel`, `StatusLabel`, `CardExpiry`, `ScheduleLabel`, `Fingerprint`. English only; every such wording is here, and none of it names a bank.
- `:Forms`: what is typed, read (`ReadAmount`, `ReadParty`, `ReadDay`, `ReadCount`), and the forms with their checks: `PaymentForm`, `RequestForm` and `FilterForm`, which are any bank's, and the two a connection to bunq is made with, `BunqKeyForm` and `BunqOAuthForm`.
- `:Errors`: `Operation`, the polkit action of each (`ActionOf`, `AsksPassword`, `MovesMoney`), and `Explain(error, operation)`, which turns an answer's error into `Guidance`.
- `:Errors`: `Operation`, the polkit action of each (`ActionOf`) and whether money leaves an account by it (`MovesMoney`), and `Explain(error, operation)`, which turns an answer's error into `Guidance`. There is no asking whether an operation takes a password: as shipped every one but a reading does.
- `:App`: `Host` (what the program around the app gives it), `Loadable<T>`, `Connection`, and the class `App`.
`Nostro.Ui.Shell`, in `namespace Nostro::Ui::Shell`, imports Crafter.Graphics and `Nostro.Ui`, and nothing of the library or the app: `:Loop` (`Loop`, `Timer`, `Defer`, `WaylandSource`, `FrameDriver`), `:Canvas` (`Fonts`, `Canvas`), `:Window` and `:Portal`.
@ -100,8 +100,13 @@ The bunq connector end to end:
nostrod end to end:
- **The front** (`implementations/Nostro-Daemon.cpp`, `RunDaemon`) is one sd-event loop with two system bus connections. One owns `net.catcrafts.Nostro1` and serves that interface. The other owns `net.catcrafts.Nostro1.Checkout` and serves the checkout alone: a Flatpak allowed to talk to that name can call its owner's unique name too, and on that connection there is nothing else. Every method of both is one forwarding handler. It asks the bus for the caller's uid (`GetConnectionCredentials`), and logind for that uid's name, starts the uid's worker if there is none (`posix_spawn` of `/proc/self/exe --worker <uid> <name> …`, a socketpair end as fd 3, D-Bus peer to peer over it), and passes a copy of the call on, from the caller's unique name and allowing a dialog only when the caller did. The answer is relayed when it comes, so one user's open dialog holds up nobody. A worker that dies under a call is answered `Failed` with "may have been carried out". It holds no connector and no secret. It ends once idle with no worker left, on SIGTERM, or when the bus goes; D-Bus activation starts it again.
- **A worker** (`implementations/Nostro-Daemon-Worker.cpp`, `RunWorker`) is one user's library: `configPath` and `cachePath` are `<state>/users/<uid>`, the connectors are read on the first call, and it is not dumpable. A directory records whose it is (`owner`): a uid that logind now names differently, after a user was deleted and another given their uid, is refused. Every handler reads and checks the call first (the account, the counterparty, what is to be paid, or for a request or a draft the object as bunq has it), builds a `Prompt` (the polkit action, a summary from its own data, and details for polkit rules), and hands it to `Gate`. `Gate` asks polkit asynchronously (`CheckAuthorization` about the caller's bus name, cancelled if it does not answer in time) and runs the call's work only once polkit says yes. It fails closed: no polkit, an error or a timeout is `AccessDenied`. A dialog the user closed is `Cancelled`, which polkit says with `polkit.dismissed` or, from Plasma's agent, `polkit.result` `auth_…`. A challenge to a call that allowed no dialog is `InteractiveAuthorizationRequired`. Every answer of the main interface ends with the notes. A summary's text from a caller or the bank goes through `Shown()` (no control, invisible or direction characters, `<` and `>` replaced, `$(` broken, 64 characters at most) and names the address before the name. The worker ends once idle with no dialog open, on SIGTERM, or when the front goes.
- **Checkout** (the same file): `Order::Read` refuses a payee that is not an IBAN, an amount that is not positive, an unknown currency or an empty reference. An order already in `checkouts.cdb` (a Crafter.DB table, `CheckoutRecord`) is answered with its payment, `repeated`, without a dialog, or refused when its amount differs, or when its payment is still 0: a payment whose outcome was lost. An order being paid makes the next call for it wait, and `Settle` gives it the first call's answer. `ChooseAccount` picks the account (the one in `checkout-account`, set by `SetDefaultCheckoutAccount`; an account of an OAuth connector is refused there) and answers through a continuation, so an account picker can take its place later. The dialog (`net.catcrafts.Nostro1.Checkout`) shows the order and that account. `PayOrder` records the order, with no payment, before it pays, and takes the record away again only when bunq refused before doing anything, below 500.
- **A worker** (`implementations/Nostro-Daemon-Worker.cpp`, `RunWorker`) is one user's library: `configPath` and `cachePath` are `<state>/users/<uid>`, and it is not dumpable. A directory records whose it is (`owner`): a uid that logind now names differently, after a user was deleted and another given their uid, is refused.
- Every handler reads and checks the call first (the account, the counterparty, what is to be paid, or for a request or a draft the object as bunq has it), builds a `Prompt` (the polkit action, a summary from its own data, and details for polkit rules), and hands it to `Gate`. `Gate` asks polkit asynchronously (`CheckAuthorization` about the caller's bus name, cancelled if it does not answer in time) and runs the call's work only once polkit says yes.
- On the main interface nothing of the user's is read, and the bank is asked nothing, for a caller polkit has not said yes to. A call that sees something (`Transactions`, the listings) looks its account up in its work, after the yes. A call that must look something up to word its own question (a payment's account, a card, a request, a draft, a connector) goes through `HandleLookup`: polkit is asked for `View` first, worded as the listing of what is looked up, and the handler's body runs on its yes. So such a call makes two checks, of which the first has no dialog in an active session as shipped; where `View` takes a password it asks twice. The connectors themselves are read (`Load`, which refreshes each one's accounts at the bank) on the first yes, or for the first new order at checkout, and not on the first call.
- It fails closed: no polkit, an error or a timeout is `AccessDenied`. A dialog the user closed is `Cancelled`, which polkit says with `polkit.dismissed` or, from Plasma's agent, `polkit.result` `auth_…`. A challenge to a call that allowed no dialog is `InteractiveAuthorizationRequired`. Every answer of the main interface ends with the notes.
- A summary's text from a caller or the bank goes through `Shown()`: nothing that draws nothing or places text (control and format characters, line and paragraph separators, what Unicode ignores by default, private use), any kind of space as one plain space, `<`, `>` and `&` replaced by `‹`, `›` and `+`, `$(` broken, 64 characters at most. The `&` matters as much as the brackets: GNOME's older agent and MATE's read the message as Pango markup, and show an empty dialog for one with a bare `&`. A summary names the address before the name. An address a caller gives is not made fit but held to it (`Counterparty`): one `Shown()` would change, up to 254 characters, is refused before anyone is asked, since an address shown otherwise than it is could be somebody else's.
- The worker ends once idle with no dialog open, on SIGTERM, or when the front goes.
- **Checkout** (the same file): `Order::Read` refuses a payee that is not an IBAN, an amount that is not positive, an unknown currency or an empty reference. An order already in `checkouts.cdb` (a Crafter.DB table, `CheckoutRecord`) is answered with its payment, `repeated`, without a dialog, or refused when its amount differs, or when its payment is still 0: a payment whose outcome was lost. An order being paid makes the next call for it wait, and `Settle` gives it the first call's answer. `ChooseAccount` picks the account (the one in `checkout-account`, set by `SetDefaultCheckoutAccount`; an account of an OAuth connector is refused there) and answers through a continuation, so an account picker can take its place later. The dialog (`net.catcrafts.Nostro1.Checkout`) shows the order and that account. `PayOrder` records the order, with no payment, before it pays, and takes the record away again only when bunq refused before doing anything, below 500. An app at checkout is someone else than the user, and is told less: a refusal for another amount does not say which amount the order has, and an error of the connector's reaches it as `bunq: …`, without the call it answered, whose path names the user and the account at bunq (`ErrorFor`). The checkout is also the one place that reads before polkit is asked: an order it knows is answered from its record, and the account that pays a new one is chosen for the dialog to name.
- **The client** (`implementations/Nostro-Client.cpp`) allows interactive authorization and waits 10 minutes by default. Each method is one `MethodCall` (member, whether it changes anything, how its answer is read) and one append helper, shared by the blocking form (`Run`: `sd_bus_call`) and the asynchronous one (`Start`: `sd_bus_call_async` on a bus attached to the caller's sd-event loop, whose non-floating slot the returned `Pending` owns; the slot frees what waits for the answer, and `OnReply` reads the answer into an `Answer` and calls `then`, never throwing into sd-bus). nostrod's `InvalidArgument` becomes `std::invalid_argument`, `ServiceUnknown` `DaemonMissing`, a write without an answer, or one bunq answered with an error ending in `BunqError::maybeCarriedOut`, `OutcomeUnknown`, and the rest a `DaemonError` with its name. `Nostro.Checkout`'s `Pay` does the same for the checkout with its own types.
The app end to end:
@ -110,8 +115,8 @@ The app end to end:
- Of each kind of reading one call is in flight, and the newest asked for meanwhile waits for it: dropping a call does not stop the worker's HTTPS, and bunq allows 3 GETs per 3 seconds.
- The bank is asked for an account's payments when its list is first shown, when it is read again (Refresh, F5, the pull) and after a change to the account. A search, a filter and "Show more" are questions about that list, put to what nostrod has stored (`LoadActivity(key, true)`, the query's `stored`): they are answered in milliseconds, so a search runs with every letter typed. Where no list is shown, because none was read yet or the reading failed, a search does go to the bank, once the typing has stopped for 400 ms or at Enter. A search therefore finds what the list had when it was last read, not what the bank has had since.
- One change at a time: a sheet shows it under way and then its outcome, and nothing else can be asked for meanwhile, so nothing is sent twice. Three things hold that: the sheet covers the screen and cannot be sent away; the toolkit takes the focus from whatever a sheet covers, so the key that pressed a button does not press it again from under the sheet; and `Navigate` refuses while a change is under way.
- The pay form sends on its button (`SubmitPayment`, the region `pay.submit`, named for what it does: Pay, Schedule or Save as draft), with no question of the app's own before it. A payment and a schedule are confirmed in polkit's dialog, which nostrod words from its own data; a draft is saved at once, since accepting it is what gets confirmed. The app's own review of a payment was taken out on 2026-11-19, as a second confirmation of what the dialog confirms: do not put one back. Closing polkit's dialog is how a payment is backed out of: nothing is paid, and the form stays as it was filled in.
- What the app does ask about first, in an `Ask` sheet built from the values that are then sent: a request before it is sent, which polkit confirms with no password in an active session, and what a detail sheet offers (revoking, accepting, rejecting, cancelling, a card reported lost, a connection removed). While a change is under way its sheet says where to confirm it when its action asks for a password (`AsksPassword`), and `ShouldDriveTheApp` holds that to the action nostrod's check names.
- The pay form sends on its button (`SubmitPayment`, the region `pay.submit`, named for what it does: Pay, Schedule or Save as draft), with no question of the app's own before it, and so does the request form (`SubmitRequest`, `request.submit`). A payment, a schedule, a draft and a request for money are each confirmed in polkit's dialog, which nostrod words from its own data; accepting a draft is confirmed there once more. The app's own review of a payment was taken out on 2026-11-19, as a second confirmation of what the dialog confirms, and the review of a request went the same day, when a request began to ask for the password: do not put either back. Closing polkit's dialog is how a payment is backed out of: nothing is paid, and the form stays as it was filled in.
- What the app does ask about first, in an `Ask` sheet built from the values that are then sent, is what one press on a detail sheet would do: revoking, accepting, rejecting, cancelling, a card reported lost, a connection removed. Each such sheet says that the system asks for the password, and while a change is under way its sheet says where to confirm it: every change asks for the password as shipped (design rule 9), so the app does not ask which do. Freezing and unfreezing a card go straight to the dialog. `ShouldDriveTheApp` holds each operation to the action nostrod's check names.
- An answer that leaves open whether money moved says so, shows the way to the account's activity, and offers no button to try again.
- An action names what it is about by value, an IBAN or the bank's id, never by a place in a list: a press acts on what it went down on, and a list changes under the finger when an answer arrives.
- Accounts go to nostrod by IBAN, by name where the bank gave none; a connection by name, or by its number from a fresh `Accounts` listing when two share a name.
@ -125,7 +130,8 @@ The app end to end:
crafter-build is the only build tool. It compiles with its clang 23 and libc++, `-std=c++26` and `import std;`, and links `-lssl -lcrypto`, and `-lsystemd` for anything with D-Bus in it (libsystemd's `sd-bus.h` and `sd-event.h`; crafter-build's Flatpak SDK has them). nostrod's Flatpak is made by flatpak-builder, the app's by crafter-build itself (`--packaging=flatpak`; `project.cpp` was written against crafter-build 6.3.0), and the aarch64 ones by the two scripts in `packaging/flatpak/`.
- Every build needs the network: Crafter.Network (with Crafter.Thread behind it; nostro builds it `--no-quic`, so without msquic) and Crafter.DB are `GitProject`s on their default branches, and Crafter.LintRules a `#pragma crafter dependency` of `project.cpp`, so each build `git pull`s them from `forgejo.catcrafts.net`, and the notes at the end of this file follow their HEAD. A `.commit` (in the pragma, `commit "<sha>"`) would pin them, as Crafter.Debug's build helper is, the second pragma.
- Every dependency `project.cpp` names is at a commit: Crafter.Network (nostro builds it `--no-quic`, so without msquic) and Crafter.DB are `GitProject`s with a `.commit`, and Crafter.LintRules and Crafter.Debug's build helper `#pragma crafter dependency` lines with `commit "<sha>"`. crafter-build clones each from `forgejo.catcrafts.net` once and builds from that clone, and the notes at the end of this file are those commits' notes. They were pinned on 2026-11-19, to what the tests had run against that day: a build runs each dependency's own `project.cpp` and links its code into the program that holds every user's bank keys. Moving one forward is a change to `project.cpp`, with the tests run again.
- Two things still follow a branch, so a build still needs the network. Crafter.Thread comes behind Crafter.Network, whose own project file names it without a commit: pinning it is Crafter.Network's to do. And the app's `--debug-api` build takes Crafter.Network without a commit, because Crafter.Debug does: with one library named two ways crafter-build stops with "module Crafter.Network is built twice for nostro-app", as tried on 2026-11-19.
- The app needs a Wayland compositor and a Vulkan device to run, and nothing else of nostro does. No test opens a window. `--product=app` takes `--graphics=<a Crafter.Graphics checkout's project.cpp>` for now: the app asks the input method for a field's purpose and hints, which Crafter.Graphics has on its branch `claude/nostro-app` and not yet on master. Once that is merged, name it as a `GitProject` at a pinned commit in `project.cpp` and drop the flag.
- The app's `--debug-api` build links Crafter.Debug, which talks QUIC: that one build has Crafter.Network with msquic (crafter-build builds it with CMake once, for minutes, and keeps it in its cache), and its binaries carry a runpath into that cache.
- Where the connectors live depends on who runs the library. nostrod's worker keeps each user's under `<state>/users/<uid>/`: `connectors.json`, the transaction tables, `checkouts.cdb`, `checkout-account` and `owner`, with `<state>` from `--state`, else `$XDG_DATA_HOME`, else `$HOME/.local/share`. Installed, that is `/var/lib/nostro/.var/app/net.catcrafts.Nostrod/data/`, readable by the user `nostro` alone. The library used directly reads `connectors.json` from `$XDG_CONFIG_HOME/.config/nostro/` (sic, see "Gotchas") or `$HOME/.config/nostro/`, and keeps the transaction tables under `$XDG_CACHE_HOME/nostro/transactions/` or `$HOME/.cache/nostro/transactions/`. A real connectors file holds a real API key: point every experiment elsewhere.
@ -174,7 +180,7 @@ The app's packaging: `--packaging=flatpak` makes `bin/nostro-app-<variant>/files
| `ShouldTalkToBunq` | the connector: every user type, signatures, rate limits, session renewal, errors, accounts, the sync, cards, OAuth, old connectors |
| `ShouldMoveMoney` | payments, drafts, schedules and requests, and their formatters |
| `ShouldRunCommands` | the CLI: `implementations/main.cpp` compiled in with its `main` renamed, every command run in-process against a real nostrod on the fake bus |
| `ShouldServeEveryUser` | nostrod: users kept apart, a uid handed to a new user, every polkit answer and what each dialog says, calls that wait on each other or do not, the checkout and its retries, the checkout client, workers that die, idle exits, every error as the client gets it, and the published contract (the XML and the polkit policy) |
| `ShouldServeEveryUser` | nostrod: users kept apart, a uid handed to a new user, every polkit answer and what each dialog says, what a dialog is kept free of and which addresses are refused for it, that a caller polkit refuses is told nothing of what is there and has the bank asked nothing, calls that wait on each other or do not, the checkout and its retries, the checkout client, workers that die, idle exits, every error as the client gets it, and the published contract (the XML, and the polkit policy with its defaults: only seeing passes without a password) |
| `ShouldAnswerAsynchronously` | the client's asynchronous calls from an sd-event loop: each method once against a real nostrod on the fake bus, every way an answer fails (refused, cancelled, bunq's refusal, a 5xx to a payment, no answer in time, no nostrod, an answer that cannot be read), notes in the answer, and dropping, cancelling, moving and assigning a `Pending` |
| `ShouldWrapText` | `Nostro.Ui:Text`: UTF-8, measuring, cutting with an ellipsis, wrapping and its cache |
| `ShouldEditText` | `:Edit`: typing, the cursor and the selection, each kind of field and what it refuses, the composing text, a secret wiped |
@ -221,7 +227,7 @@ What a test cannot show (that the window draws what the frame says, in the right
- `wait 'app.busy == false'` after anything that asks nostrod, `wait 'app.changing == false'` after a change; the events are `Screen`, `AnswerArrived`, `Changing` and `FrameRendered`;
- `screenshot`, and `log --level warn` for the checks: a frame that overflowed the window's buffers, something pressable under 48 dp on a phone's size.
- The README's screenshots are taken that way too, on the made-up system so that nobody's bank is in them: `docs/screenshots/take.sh <nostro-fake-system> <nostro-app>` plays one `--poke` script per picture and writes the five files beside itself. It names what it taps by its place, so it is looked over, picture by picture, after a change to a screen it shows. The made-up bank dates its payments back from now: every taking has other days and times in it. Four of the five are in the dark look and one in the light one, and everything the made-up bank holds is in English, people's names too, as the app is: both as asked for on 2026-11-19, so new made-up data is written in English.
- A region's key is its name in the tests too: `nav.accounts`, `account.<IBAN>`, `account.pay`, `tabs.1`, `pay.to`, `pay.submit`, `request.review`, `review.confirm`, `done.close`, `card.<id>`, `settings.connections`, `connections.add`, `bank.bunq`, `way.key`, and `copy.<label>` for a line of a sheet (`copy.IBAN`), which a press copies. `get ui.regions` lists a screen's.
- A region's key is its name in the tests too: `nav.accounts`, `account.<IBAN>`, `account.pay`, `tabs.1`, `pay.to`, `pay.submit`, `request.submit`, `confirm.yes`, `done.close`, `card.<id>`, `settings.connections`, `connections.add`, `bank.bunq`, `way.key`, and `copy.<label>` for a line of a sheet (`copy.IBAN`), which a press copies. `get ui.regions` lists a screen's.
## Code style
@ -248,11 +254,11 @@ What a test cannot show (that the window draws what the frame says, in the right
6. **Synchronous HTTPS, one client per bank host.** `ClientHTTP1::Send` on the calling thread, a persistent connection for reads and a fresh one for every write, no thread pool, default TLS verification. A bank's own request function owns the protocol: signing, verifying, waiting out rate limits and renewing an expired session once. Every other error is an exception; whether to retry a write is the caller's decision, and an unknown outcome is reported as such. (Revised 2026-10-31: the retries moved from the transaction sync into the request function.)
7. **Signing is opt-in per bank.** `:Crypto` and `-lssl -lcrypto` are pulled in by `opensslEnabled`, the OR of the banks that sign; a bank that does not sign must not make the build depend on OpenSSL.
8. **The library is the product; the CLI and the app are thin clients.** `--lib` returns the library configuration; the CLI adds `main.cpp` alone, which parses `argv`, calls nostrod through `Client` and prints through the formatters, and nostrod adds `nostrod.cpp` alone. Logic goes into a partition (the daemon's into `:Daemon`), not into `main.cpp`. What the CLI and the app both need is the library's, not written twice: reading the address an OAuth redirect lands on, the end of a day a person typed, a card's status as bunq kept it (the check; what the app then says it words itself, in no bank's name). The app decides nothing nostrod should: what an account, a payee or an amount may be is nostrod's to refuse, and the app's own checks only spare the user a round trip. (Revised 2026-11-01: the CLI talks to nostrod, not to the bank. Revised 2026-11-19 for the app.)
9. **nostrod answers each caller for their own money, and asks polkit first.** The front maps a caller's uid, asked of the bus, to that uid's own worker process; nothing of one user's is ever in another's process. Every method has one polkit action, decided by what the call does (`View`, `Change`, `Pay`, `UnfreezeCard`, `BlockCard`, `Connectors`, `Checkout`), and the dialog's summary and details are built from the worker's own data after the call is read and checked, never from text the caller formatted: what the dialog shows is what gets paid. Every action is owned by `unix-user:nostro` in the policy, or polkit refuses nostrod's checks. Every method is `SD_BUS_VTABLE_UNPRIVILEGED`, since polkit decides, not sd-bus. It fails closed. No action keeps an authorization: polkit keeps one per process, so the CLI would ask every time anyway, and the app, which lives for hours, would not: an administrator's rule that keeps one (`auth_self_keep`) lets a running app pay for minutes without a password.
10. **The wire is a published contract.** `packaging/dbus/*.xml` is what nostrod serves (`ShouldServeEveryUser` compares them with its introspection), and apps in other languages generate their proxies from it. A method may be added; changing a method's signature or meaning means a new interface (`…Nostro2`). The checkout's `options` and `results` are dictionaries so that it can grow without one: unknown options are ignored, unknown results skipped. So is the query of `Transactions`: `stored` was added to it on 2026-11-19, and a nostrod from before ignores it and asks the bank, which is slower and no less right. A client must not lean on a new key for anything but speed. One meaning was narrowed all the same, on 2026-11-19, while no release had been published: `AddBunq`'s `environment` used to choose the environment over what the key says, and now only has a key of the other one refused. After a release that would have been `…Nostro2`'s to do.
9. **nostrod answers each caller for their own money, and asks polkit first.** The front maps a caller's uid, asked of the bus, to that uid's own worker process; nothing of one user's is ever in another's process. Every method has one polkit action, decided by what the call does (`View`, `Change`, `Pay`, `UnfreezeCard`, `BlockCard`, `Connectors`, `Checkout`), and the dialog's summary and details are built from the worker's own data after the call is read and checked, never from text the caller formatted: what the dialog shows is what gets paid. Before polkit's yes a worker reads nothing of the user's for the caller and asks the bank nothing: a call that has to look something up to word its question needs `View` first (`HandleLookup`), so it has two actions, and a caller who may not see the accounts cannot find out what is there, or have the bank asked, by trying to change it. The checkout, whose caller is an app, is the stated exception (see "Checkout" above). Every action is owned by `unix-user:nostro` in the policy, or polkit refuses nostrod's checks. Every method is `SD_BUS_VTABLE_UNPRIVILEGED`, since polkit decides, not sd-bus. It fails closed. Secure by default: as shipped only `View` passes without the user's password in an active session, and every other action asks for it every time (`auth_self`), `Change` too, down to a draft saved and a card frozen. That was decided on 2026-11-19; until then `Change` passed, on the reasoning that it pays nobody, which left any program of the user's free to cancel a scheduled payment or ask for money in their name. Loosening is an administrator's choice, made with a rule, and `ShouldServeEveryUser` holds the policy file to these defaults. No action keeps an authorization: polkit keeps one per process, so the CLI would ask every time anyway, and the app, which lives for hours, would not: an administrator's rule that keeps one (`auth_self_keep`) lets a running app pay for minutes without a password, and polkit's manual says a kept one holds whatever the next check's details are.
10. **The wire is a published contract.** `packaging/dbus/*.xml` is what nostrod serves (`ShouldServeEveryUser` compares them with its introspection), and apps in other languages generate their proxies from it. A method may be added; changing a method's signature or meaning means a new interface (`…Nostro2`). The checkout's `options` and `results` are dictionaries so that it can grow without one: unknown options are ignored, unknown results skipped. So is the query of `Transactions`: `stored` was added to it on 2026-11-19, and a nostrod from before ignores it and asks the bank, which is slower and no less right. A client must not lean on a new key for anything but speed. One meaning was narrowed all the same, on 2026-11-19, while no release had been published: `AddBunq`'s `environment` used to choose the environment over what the key says, and now only has a key of the other one refused. Four more were that day, after a security review and for the same reason: an e-mail address that the password dialog could not show as it is (`to`, `from`) is refused; a call that names an account, a card, a request, a draft or a connector, and is not a call to see it, needs `View` as well as its own action; the checkout's errors say less (no amount of the order on record, no call to the bank); and the policy has `Change` ask for the password in an active session, as every action but `View` does. After a release each would have been `…Nostro2`'s to do, or for the policy a change of defaults under users who had come to rely on the old ones.
11. **The app's logic is pure, and its window is thin.** `Nostro.Ui` and `Nostro.App` import no window library and read no device: a screen is a function from state to a frame, so a test builds it, reads what it says and taps it by name, and both stay at the coverage the library has. `Nostro.Ui.Shell`, `nostro-app.cpp` and the debug commands are the only code that needs a compositor. They decide nothing about money, are checked by looking ("Looking at the app"), and are outside the coverage figure. What would need a decision there goes into the toolkit or the app as a function a test can call. Crafter.Debug stays in the executable: `Debug::Use` reaches that configuration alone, and the window and the app only offer hooks.
12. **The app holds no secret and no say.** It has no key, no token and no file of its own, and its Flatpak no network. A key typed into it lives in a `Secret` field, which is drawn as dots, shown otherwise only as a fingerprint, never copied, and wiped when the form goes; it is passed to nostrod once, in a message marked sensitive. What moves money is confirmed in polkit's dialog, which nostrod words from its own data, and nowhere else: the pay form's button sends, and a program that drove the window would still meet the dialog. So what stands between a press and a payment is the system's policy for the `Pay` action, which asks for the password every time as shipped. Under an administrator's rule that answers it without asking, one press on Pay pays.
12. **The app holds no secret and no say.** It has no key, no token and no file of its own, and its Flatpak no network. A key typed into it lives in a `Secret` field, which is drawn as dots, shown otherwise only as a fingerprint (`Fingerprint`: how it begins and how long it is, and never how it ends, since the end of a key being typed by hand is what was typed last), never copied, and wiped when the form goes; it is passed to nostrod once, in a message marked sensitive. What moves money is confirmed in polkit's dialog, which nostrod words from its own data, and nowhere else: the pay form's button sends, and a program that drove the window would still meet the dialog. So what stands between a press and a payment is the system's policy for the `Pay` action, which asks for the password every time as shipped, as the policy for every other action but `View` does. Under an administrator's rule that answers it without asking, one press on Pay pays.
13. **The library is LGPL, the app is GPL.** LGPL-3.0-only: the module `Nostro`, `Nostro.Checkout`, the CLI, nostrod, their tests, the tests' fakes and the fake system, `project.cpp` and the packaging. A program under any licence can be built on the library and the checkout. GPL-3.0-only: `Nostro.Ui`, `Nostro.App`, `Nostro.Ui.Shell`, `nostro-app.cpp`, `Nostro.DebugCommands`, their seven tests and `tests/Support/Ui.inc`, the app's desktop entry and icon, and `docs/screenshots/`, the pictures of the app and the script that takes them: a program built from any of it is under the GPL as a whole. A new file gets the licence of what it is part of, in its first line. The dependency runs one way, and has to: nothing of the library imports or includes anything of the app, or the library could no longer be used under the LGPL. Code moves from the library into the app as it is; the other way it changes licence, which is Catcrafts' to decide for what Catcrafts wrote, and the author's for a patch that came in under the GPL alone. (Decided 2026-11-19.)
@ -282,8 +288,9 @@ The checklist, from the bunq connector:
- `connectors.json` is the crown jewels: the bunq API key or OAuth token, the installation and session tokens and the unencrypted RSA private key, as plain text. Its protection is `0600` in a `0700` directory, and installed, the directory of a system user of its own (`/var/lib/nostro`) under a service that keeps the rest of the system read-only to it; it is replaced by a synced rename, never rewritten in place. There is no encryption at rest: root, and a disk taken out of the machine, read it. Never print it, never log a token or a signature, never copy a real one into a scratch directory or a commit. The transaction tables are the user's financial history, kept private the same way by Crafter.DB.
- What nostrod does not stop: a program running as the user can still draw a dialog that looks like polkit's and ask for the password; only the system's own agent is the real one. On a session without a polkit agent (SSH, a TTY without one) nothing can confirm, so every call that needs a password is `Cancelled`. polkit logs the calling process's command line, which is why no secret is ever an argument.
- A worker makes itself undumpable, and the service sets `LimitCORE=0`: a core dump would hold the keys. A text that reaches a dialog goes through `Shown()`, so neither a payee's name nor a description can fake another amount or payee in it.
- The app is one of the programs nostrod keeps the user's bank from: it sees accounts and payments, which `View` allows any program of the user's in an active session, and nothing that could move money without the dialog. Its Flatpak has the compositor, the graphics device and `net.catcrafts.Nostro1` on the system bus, and no network, no files and no session bus beyond the portals. It makes itself undumpable, so another program of the user's cannot read a key out of it while it is typed. It writes no amount, IBAN or name to its log, which lands in the user's journal.
- What the shipped policy leaves open is looking: `View` needs no password in an active session, so any program of the user's there can read the accounts, payments, requests and cards. Everything else asks, `Change` included since 2026-11-19 (design rule 9). The README's "How Nostro runs" and "Security" say both plainly, and how a rule loosens it. polkit cannot tell the app from another program of the user's, so a rule that loosens an action loosens it for all of them; neither can nostrod, since whatever marks a process as the app (its executable, its Flatpak id, a unit's name) another program of the same user can wear, by starting the real app with its own code in it or on a display of its own.
- A worker makes itself undumpable, and the service sets `LimitCORE=0`: a core dump would hold the keys. A text that reaches a dialog goes through `Shown()`, so neither a payee's name nor a description can fake another amount or payee in it, start a line of its own, or leave an agent that reads its message as markup with nothing to show. What it cannot stop is a name that reads like part of the sentence ("Bob) from NL00… (Savings"): the summary puts the amount first and the paying account last for that reason.
- The app is one of the programs nostrod keeps the user's bank from: it sees accounts and payments, which `View` allows any program of the user's in an active session, and nothing that could pay or change anything at the bank without the dialog. Its Flatpak has the compositor, the graphics device and `net.catcrafts.Nostro1` on the system bus, and no network, no files and no session bus beyond the portals. It makes itself undumpable, so another program of the user's cannot read a key out of it while it is typed. It writes no amount, IBAN or name to its log, which lands in the user's journal.
- A build with `--debug-api` is none of that: every program of the user's can drive it and read what it shows, it logs what it is told, and a debugger can attach to it. It is for the made-up system and bunq's sandbox. `Ui_Type` refuses to type into a field that hides what it holds unless the text is a sandbox key (`sandbox_…`); nothing stops a hand from typing a real one into such a build, so do not. No Flatpak is made of it.
- The checkout answers a repeated order with its payment id without a dialog, so any app with access to the checkout can learn whether the user paid an order whose IBAN, reference and amount it knows (README, "Checkout for apps").
- A connector's `environment` decides between `api.bunq.com`, where `send` moves real money, and the sandbox. An API key says itself which it is of: a sandbox key starts with `sandbox_`, and anything else is production. Nobody chooses it: nostrod takes the key's own, and refuses an environment named otherwise before the key goes anywhere, so a real key is not sent to the sandbox by a slip (`OnAddBunq`); the CLI has no flag for it and the app's form no choice. An OAuth client has no such mark, so there the environment is named (`--sandbox`, the form's Production or Sandbox). Since 2026-11-19 production has been used to connect and to read accounts, payments and cards; these notes record no payment made on it, so try that with small amounts first.
@ -291,7 +298,7 @@ The checklist, from the bunq connector:
- A write is never replayed by the transport (fresh connection) and only resent by nostro after a 429, which bunq refuses before acting. An IBAN's check digits are verified before anything is sent.
- TLS is Crafter.Network's default `TLSClientCredentials{}`: the chain against the system store and the hostname. Do not reach for `insecureNoServerValidation`.
- The private key signs every request body (`SignBody`, RSA SHA-256). Key material lives in `Crypto::Key`s (freed with the last copy) for the process's life; there is no zeroisation.
- `project.cpp` executes the `project.cpp` of three unpinned dependencies (Crafter.Network, Crafter.DB, Crafter.LintRules) on every build, fetched from the Catcrafts Forgejo at HEAD, and the Flatpak build does the same with the network on; Crafter.Debug's build helper is the one that is pinned. The app's build adds Crafter.Graphics, which brings Crafter.Event, Crafter.Math, Crafter.Asset and the Khronos headers, unpinned, and its debug build Crafter.Debug's library with a Crafter.Network that has msquic in it. Pin a commit on each for a build that is reproducible and offline after the first fetch.
- `project.cpp` executes the `project.cpp` of each dependency on every build, and the Flatpak build does the same with the network on. Those it names itself are at a commit since 2026-11-19: Crafter.Network, Crafter.DB, Crafter.LintRules and Crafter.Debug's build helper ("Dev environment"). What still follows a branch, fetched from the Catcrafts Forgejo at HEAD: Crafter.Thread, which Crafter.Network names; in the app's build Crafter.Graphics, a checkout given with `--graphics=`, which brings Crafter.Event, Crafter.Math, Crafter.Asset and the Khronos headers, unpinned; and in its debug build Crafter.Debug's library with a Crafter.Network that has msquic in it. Pin those where they are named for a build that is reproducible and offline after the first fetch.
- `install.sh --repo` installs from an unsigned local repository, for a build of your own, and so does a bundle crafter-build made. A published Flatpak comes from the GPG-signed Catcrafts remote, which is how the README installs both: the remote `catcrafts`, added from `https://flatpak.catcrafts.net/catcrafts.flatpakrepo`, Crafter.Build's own remote. `install.sh` without `--repo` installs from that remote in the system installation, where nostrod runs from, and does not add it itself. On 2026-11-19 the remote did not carry nostro's two Flatpaks yet: the README describes the channel they are to be published on. The two `.flatpakref`s in `packaging/flatpak/` carry the same placeholder for the key as Crafter.Build's, for the publishing side to fill in.
- Input from the bank is parsed with nlohmann/json's `at()` and `get()`, which throw on a missing key or a wrong type: a malformed response is an exception, not undefined behaviour. `ParseAmount` and `ParseTimestamp` reject anything outside their grammar.
@ -314,6 +321,7 @@ The state of the code on 2026-11-19; each is a fact to work with.
- The notes of Crafter.Graphics, Crafter.Math and Crafter.Asset are in `AGENTS.md` only after a build of the app, and gone again after the next build of another product: crafter-build writes the section from what the build loaded.
- systemd's hardening and bubblewrap, which flatpak runs nostrod in, disagree in places, found on 2026-11-01 under `systemd-run --user`: bubblewrap needs `AF_NETLINK` (it brings up loopback), `@mount`, `unshare` and `setns`, and a `/proc` of its own; `RestrictSUIDSGID=` makes systemd answer `openat2()` with ENOSYS, which bubblewrap 0.13 does not fall back from. `nostrod.service` says which options are left out and why.
- polkit as seen on that day (polkit 127, Plasma): closing Plasma's dialog sends no `polkit.dismissed`, only `polkit.result` `auth_self`, so `Cancelled` is read from either; a kept authorization is the calling process's alone; the command line of the process asking is logged.
- Agents do not agree on what a message is. GNOME Shell's, Phosh's and LXDE's show it as plain text. polkit-gnome (the older GTK agent many desktops without one of their own start) and mate-polkit put it into Pango markup without escaping it, as read in their sources on 2026-11-19: a `<` starts a tag there, and a bare `&` makes the whole message fail to parse, which leaves the dialog without one. That is why `Shown()` replaces `&` as it does `<` and `>`, and cannot escape them instead: an agent that shows plain text would show the escape. How Plasma's agent reads its message was not established that day. Whatever is added to a summary goes through `Shown()`.
- sd-bus holds a vtable method's answer to the signature the vtable declares: an answer of another shape becomes `System.Error.ENOMSG`. A test that must send a malformed answer (`FakeCheckout` in `ShouldServeEveryUser`) registers a plain object (`sd_bus_add_object`) instead.
- A worker or nostrod killed with SIGKILL writes no coverage counts; both handle SIGTERM (systemd's stop signal too) by ending the loop, and the tests stop them that way.
- `--product=checkout` returns before the bank check, so it needs no `--banks=`; every other product does.