Skip to content

Hold the resolver's budget, keep composed stores alive, and bound idle reads in the adapters - #225

Merged
Xor-el merged 2 commits into
deep-audit-fixesfrom
audit-api-adapters
Oct 7, 2026
Merged

Xor-el merged 2 commits into
deep-audit-fixesfrom
audit-api-adapters

Conversation

@Xor-el

@Xor-el Xor-el commented Oct 7, 2026

Copy link
Copy Markdown
Owner

API and adapter fixes from the closing audit.

  • A composed trust store keeps the stores it was built from. The config memo signs a custom store by address and the union dropped it, so after a reload the allocator could give a new store the old address and the memo would hand back the config frozen with the old roots, including a CA the operator had removed.
  • The verdict deadline the host sets (VerdictDeadlineMs) was stored and never read. It now travels to the resolver in the verdict context; the live revocation checker and the OS live resolver both work within the tighter of it and their own budget.
  • The builder allowed an ALPN list of up to 65533 bytes, which the ClientHello's extensions block cannot always carry, so some accepted lists failed every handshake. The cap is 16384 bytes for both roles, and a test checks that the largest list encodes.
  • Indy checks ReadTimeout only before a read, so bytes that yield no application data (the server's session tickets, a key update) kept a timed read going forever, which is a cheap way to pin a worker thread. The read is now bounded by the same timeout and reports it as Indy's own timeout, so ReadLn returns an empty line with ReadLnTimedOut set. The loopback example covers it and hangs without the fix. An explicit timeout passed per call is not seen by the adapter, which reads the IOHandler's ReadTimeout.
  • mORMot: a receive that wakes with nothing to read no longer outlives the handshake deadline, CipherList is refused instead of silently dropped, and DisableTls13 now offers TLS 1.2 alone (a new Tls12Only option shared by the adapters' option record).
  • Synapse: UseSystemTrust is documented as a client-role source only, which is what the build does.

Tests: FPC x86_64 and i386 1464, Delphi Win32 1464, BoGo portable clean. The FclNet, Indy, mORMot and Synapse loopback examples build and pass under FPC. The Delphi builds of the Indy, mORMot and Synapse adapters were not run.

Xor-el added 2 commits October 7, 2026 01:24
…e reads in the adapters

- A composed trust store now keeps the stores it was built from. The config
  memo signs a custom store by address, and the union dropped it, so after a
  reload the allocator could hand a new store the old address and the memo
  would return the config frozen with the old roots.
- The verdict deadline the host sets (VerdictDeadlineMs) was stored and never
  read. It now reaches the resolver in the verdict context, and the live
  revocation checker works within the tighter of that and its own budget.
- The builder capped the ALPN list at 65533 bytes, which the ClientHello's
  extensions block cannot always carry, so some accepted lists failed every
  handshake. The cap is 16384 bytes, with a test that the largest list encodes.
- Indy checked ReadTimeout only before a read, so bytes that yield no
  application data (the server's session tickets, a key update) kept a timed
  read going forever. The read is now bounded by the same timeout and reports
  EIdReadTimeout. The loopback example covers it.
- mORMot: a receive that wakes with nothing to read no longer outlives the
  handshake deadline, CipherList is refused instead of silently dropped, and
  DisableTls13 now offers TLS 1.2 alone.
- Synapse: UseSystemTrust is documented as a client-role source only, which
  is what the build does.
…esolver the park budget

- An idle Indy read that gave up on ReadTimeout raised EIdReadTimeout from the
  receive, which broke callers that expect Indy's own timeout to be quiet
  (ReadLn returns an empty line with ReadLnTimedOut set). The receive now
  fails with the timeout code Indy maps to its own, so each caller raises or
  swallows it as it would for a timeout it detected itself. The loopback
  example checks ReadLnTimedOut and waits on readiness rather than sleeping.
- The OS live revocation resolver takes the tighter of its own budget and the
  one the host set for the park, as the portable checker does.
- Release the transport and clock in the new cap test, and reword the ALPN
  cap message and the Synapse system-trust note.
@Xor-el
Xor-el merged commit 0e2cad5 into deep-audit-fixes Oct 7, 2026
15 checks passed
@Xor-el
Xor-el deleted the audit-api-adapters branch October 7, 2026 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant