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

@ -404,7 +404,8 @@ namespace {
Shows(d.ui, "The API key, from the bunq app", "a form without a key says so");
Equal(d.app.Screen(), std::string("add:bunq:key"), "and asks nostrod nothing");
Type(d, "key.key", aliceKey);
Shows(d.ui, std::format("Typed: {}", Fingerprint(aliceKey)), "what was typed is told by how it begins and ends");
Shows(d.ui, std::format("Typed: {}", Fingerprint(aliceKey)), "what was typed is told by how it begins and how long it is");
Hides(d.ui, aliceKey.substr(aliceKey.size() - 4), "and not by how it ends, which is what was typed last");
Hides(d.ui, aliceKey, "and never shown");
Hides(d.ui, "The API key, from the bunq app", "the error goes once there is a key");
Check(!Has(d, "key.ips"), "the allowed addresses are tucked away");
@ -540,9 +541,20 @@ namespace {
Shows(d.ui, "Bob's", "and what is shown is what there is");
// And once more while they are read again: the reading gives up, and says so.
before = Answers(d, "Connectors ok");
const auto viewChecks = [&bus] {
std::lock_guard lock(bus.mutex);
return std::ranges::count_if(bus.checks, [](const Fake::PolkitCheck& check) { return check.action == Bus::actionView; });
};
const std::ptrdiff_t viewed = viewChecks();
Tap(d, "bar.refresh");
Check(RunUntil(d.loop, [&d, before] { return Answers(d, "Connectors ok") > before; }), "the connections are read");
// Removing a connection looks it up first, for which nostrod asks polkit whether the caller may see: that is
// answered at once here, once the app's reading of the accounts is at polkit, which answers that a second
// later whatever it is set to meanwhile.
Check(RunUntil(d.loop, [&viewChecks, viewed] { return viewChecks() >= viewed + 2; }), "and the accounts are being read");
SetPolkit(bus, Fake::Polkit::Allow, Bus::actionView);
other.RemoveConnector("Bob");
SetPolkit(bus, Fake::Polkit::Slow, Bus::actionView);
Check(RunUntil(d.loop, [&d, before] { return Answers(d, "Connectors ok") > before + 1; }), "and read again");
other.AddBunq("key-bob", "*", "");
Settle(d);
@ -839,7 +851,7 @@ namespace {
Equal(Action(bus), std::string(Bus::actionPay), "after the password for paying");
Press(d, "done.close");
// A draft: made now, paid once someone accepts it, and no password for making it.
// A draft: made now, paid once someone accepts it. Making one is a change, and is confirmed like any.
Tap(d, "home.pay");
Type(d, "pay.to", "+31612345678");
Shows(d.ui, "Phone number", "a phone number is known for one");
@ -849,8 +861,8 @@ namespace {
Bottom(d);
Equal(d.ui.Find("pay.submit")->label, std::string("Save as draft"), "and the button says that it saves one");
Tap(d, "pay.submit");
Shows(d.ui, "Saving a draft of €2.00 to +31612345678", "a draft is saved at once");
Shows(d.ui, "One moment.", "and needs no password, so the wait says nothing of one");
Shows(d.ui, "Saving a draft of €2.00 to +31612345678", "a draft is saved from the form's button, with no question of the app's before it");
Shows(d.ui, "Confirm it in your system's password dialog.", "and confirmed where every change is");
Settle(d);
Shows(d.ui, "Drafted €2.00 to +31612345678", "and is made");
Shows(d.ui, "It is paid once it is accepted", "with what that means");
@ -901,24 +913,30 @@ namespace {
const std::string page = std::format("account:{}", aliceMain);
Tap(d, "home.request");
Equal(d.app.Screen(), std::string("request"), "asking starts from the accounts");
Tap(d, "request.review");
Bottom(d);
Shows(d.ui, "Your bank asks them where it can reach them", "what asking does is said on the form");
const Region* submit = d.ui.Find("request.submit");
Check(submit != nullptr && submit->label == "Ask", "whose button is named for what it does");
Tap(d, "request.submit");
Shows(d.ui, "Enter an amount", "a form that is empty says what it lacks");
Equal(d.app.Screen(), std::string("request"), "and asks nostrod nothing");
Top(d);
Tap(d, "request.into");
Tap(d, std::format("pick.{}", aliceMain));
Type(d, "request.from", bobIban);
Tap(d, "request.review");
Tap(d, "request.submit");
Shows(d.ui, "The name of the account's holder", "an IBAN needs a name here too");
Type(d, "request.name", "Bob");
Type(d, "request.amount", "5");
Type(d, "request.description", "back");
Tap(d, "request.review");
Equal(d.app.Screen(), std::string("request+review"), "a request is reviewed");
Shows(d.ui, "Ask Bob for €5.00?", "as what it is");
Shows(d.ui, std::format("Main · {}", GroupIban(aliceMain)), "and into which account");
Hides(d.ui, "Your system asks for your password", "it needs no password");
Tap(d, "review.back");
Tap(d, "request.review");
Press(d, "review.confirm");
// The button sends what is filled in, as the pay form's does: there is no review of the app's own, since the
// system's password dialog is what confirms a request.
Bottom(d);
Tap(d, "request.submit");
Equal(d.app.Screen(), std::string("request+working"), "a request is sent by the form's button, with no question of the app's before it");
Shows(d.ui, "Asking Bob for €5.00", "the change under way is shown as what it is");
Shows(d.ui, "Confirm it in your system's password dialog.", "with where to confirm it");
Settle(d);
Shows(d.ui, "Asked Bob for €5.00", "the request is made");
Equal(Action(bus), std::string(Bus::actionChange), "as a change that moves no money");
Shows(d.ui, "https://bunq.me/t/", "with the link anyone can pay through");
@ -940,10 +958,11 @@ namespace {
Tap(d, "home.request");
Type(d, "request.from", "+31612345678");
Type(d, "request.amount", "3");
Tap(d, "request.review");
Shows(d.ui, "Ask +31612345678 for €3.00?", "someone asked by phone number is named by it");
bunq.Fail(Fault{.method = "POST", .path = "/user/", .status = 500, .body = R"({"Error":[{"error_description":"Hiccup."}]})"});
Press(d, "review.confirm");
Bottom(d);
Tap(d, "request.submit");
Shows(d.ui, "Asking +31612345678 for €3.00", "someone asked by phone number is named by it");
Settle(d);
Shows(d.ui, "It may have been done", "a request without a clear answer may have been made");
Check(Has(d, "problem.activity"), "and the account is a press away");
Press(d, "problem.close");
@ -976,6 +995,7 @@ namespace {
Tap(d, "detail.revoke");
Equal(d.app.Screen(), std::format("{}+confirm", page), "taking it back is asked about first");
Shows(d.ui, "Revoke the request to Bob?", "by name");
Shows(d.ui, "Your system asks for your password", "and with where it is confirmed: no change is made without the password");
Tap(d, "confirm.no");
Equal(d.app.Screen(), page, "and can be thought better of");
Tap(d, row);
@ -1023,7 +1043,7 @@ namespace {
Tap(d, Row(d, "incoming.", 1));
Tap(d, "detail.reject");
Shows(d.ui, "Reject the request from Dave?", "rejecting is asked about first");
Hides(d.ui, "Your system asks for your password", "and needs no password");
Shows(d.ui, "Your system asks for your password", "and needs the password too, as every change does");
Press(d, "confirm.yes");
Shows(d.ui, "Request rejected", "a request rejected is said");
Shows(d.ui, "Rejected · rent", "and listed as such");
@ -1166,7 +1186,7 @@ namespace {
Check(Has(d, "detail.freeze") && !Has(d, "detail.unfreeze") && Has(d, "detail.lost") && Has(d, "detail.stolen"), "a card in use can be frozen or reported");
Tap(d, "detail.freeze");
Shows(d.ui, "Freezing card •••• 1234", "freezing is under way at once");
Shows(d.ui, "One moment.", "without a password");
Shows(d.ui, "Confirm it in your system's password dialog.", "and is confirmed there, as unfreezing is: the app freezes no card by itself");
Settle(d);
Shows(d.ui, "Card •••• 1234 is now Deactivated", "a frozen card is said");
Equal(Action(bus), std::string(Bus::actionChange), "as a change");
@ -1417,7 +1437,7 @@ namespace {
Type(d, "oauth.client", "fake-client");
Type(d, "oauth.redirect", "http://127.0.0.1/cb");
Type(d, "oauth.secret", "fake-secret");
Shows(d.ui, "Typed: ••••", "the secret is told by nothing of itself");
Shows(d.ui, "Typed: 11 characters", "the secret is told by nothing of itself but how long it is");
Hides(d.ui, "fake-secret", "and never shown");
Bottom(d);
Tap(d, "oauth.environment.1");