Security
What uftp verifies before it parses, how it bounds untrusted input, and what is left to your deployment: keys, TLS, DNSSEC and authorisation.
Verified before parsed#
open is the only path from received bytes to a message:
- It parses the small wrapper.
- It looks up the sender's keys.
- It verifies the Ed25519 signature strictly, over exactly the bytes received. A non-canonical signature and a small-order key are refused.
- Only then does it decode the inner XML.
The inner SenderDomain and role must equal the wrapper's. A message cannot claim to come from someone else.
Without the cs1 feature there is no open, and so no way from received bytes to a message.
Bounded input#
The XML reader refuses DTDs and entity declarations, so no external entities and no entity expansion. It also refuses processing instructions, non-UTF-8 documents, and characters XML 1.0 does not allow.
It enforces limits while it reads:
| Limit | Default | Hard cap |
|---|---|---|
| document size | 4 MiB | 64 MiB |
| element depth | 16 | 32 |
| elements | 250,000 | — |
Over HTTP, the length is checked from the headers before the body is read, and a body that is not its Content-Length is refused.
Answers that cannot be abused#
- Rejected responses go only to the verified sender. A signed message that names a third party as its sender or recipient cannot make your endpoint send that party anything.
- Refusal texts are escaped and bounded (see Rejections): no forged log lines, no bidirectional tricks, no amplification.
- Responses must answer what you sent, with the outbox. Without it, a participant could accept a request you never made.
- Replay memory is bounded per sender. One sender over its quota gets 429 and cannot evict anyone else.
Left to you#
The library does no I/O, so some things stay with your deployment:
- TLS. UFTP requires HTTPS.
- Key storage.
SigningKeyzeroes its memory on drop and never prints itself; where it lives is yours. - DNSSEC. If you resolve keys from DNS, use a validating resolver.
- Authorisation. Which participants may trade in your market. Refuse others with Barred Sender.
How this is checked#
Every point above has a test that would fail without it. The decoder is fuzzed, and mutation testing keeps the tests honest; see How it is tested.