catcrafts.net/tests/ShouldValidateForms
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jorijn van der Graaf f51105a768
checkout: an address field is one line, and the invoice prints it as text
The invoice is clearsigned, and its "Billed and shipped to" block is the
buyer's own words: name, street, postal code and city went into it as
typed. A name with a line break in it could write lines of its own into
a document the shop signs. One with no line break could still open a
heading ("# CREDIT NOTE") or, together with the street and the city, a
table, because each of those fields starts a line.

Checkout now refuses those four fields when they hold a line break or a
control character: the C0 and C1 controls, U+2028 and U+2029, and the
bidirectional embedding, override and isolate controls, which make a
line display in another order than it is stored. A tab is the
exception. A single-line input drops line breaks from a paste and keeps
tabs, so "Hoofdstraat<TAB>12" is a real buyer's address, and it is
stored with the space the tab stood for. Form::SingleLine is the one
definition of what counts.

The invoice builder applies the same function to whatever the record
holds, since a record can be older than the check or written by hand,
and prints the block indented four spaces. That is Markdown's literal
block: nothing in it is read as markup, and it reads the same as plain
text. The item in the amounts table is held to its cell too, because a
colour the catalogue no longer lists is printed as the ledger has it,
and checkout no longer stores a posted colour for a product that has no
variants.

ShouldBuildInvoices checks the property on the document (every line of
the block is blank or indented) rather than on particular strings, and
ShouldValidateForms pins the edges of each character range.

Found in the security review of 2026-11-26; the Markdown half by the
adversarial review of the first fix. No priced product is listed, so
none of it was reachable yet.

Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
2026-11-26 11:05:35 +01:00
..
main.cpp checkout: an address field is one line, and the invoice prints it as text 2026-11-26 11:05:35 +01:00