0262. OS entropy fill plugin
- Status: Accepted (maintainer, 2026-11-17); Forge P4, M-HTTP.12
- Date: 2026-11-17
- Plan: M-HTTP.12; hosting H3
Context
ADR-0205 requires direct OS entropy for bearer credentials,
sharing the port in ADR-0200 without OpenSSL or weak fallback.
ADR-0243:49 moves hosting's entropy need off the deferred R3b
signing path but supplies no port. The unchanged
hosting requirements still need it. The
platform/native and interpreter trees are frozen for Forge P4.
ADR-0247 prohibits implementing cryptography in Harness; reading
OS entropy is not implementing cryptography.
Decision
Provide plugins/entropy via FFI (ADR-0151) for
fills of 1..1024 bytes. Linux uses getrandom with
flags 0 (blocking until initialized); macOS uses
getentropy. Unsupported platforms fail at compile
time. No fallback or fabricated bytes are allowed. Reads are at
most 256 bytes, retry interruptions and short reads, and count
every call toward a 64-call bound. Exhaustion fails even if the
64th call completes the fill. Wipe and free partial buffers on
every failure.
A data-driven test hook injects errors or shortens real OS reads; it never fabricates bytes. It is for testing only.
Alternatives considered
- PlatformOp — requires changes in frozen trees; a later move requires a superseding ADR.
/dev/urandom— can fail open on fd exhaustion or chroot misconfiguration.arc4random_buf— offers no failure signal, preventing fail-closed behavior.- OpenSSL RAND — adds a dependency, and ADR-0205 forbids it.
- Harness DRBG — implements cryptography.
Consequences
Consumers must admit ffi in their capability
ceiling. The interpreter needs a C compiler for its FFI host
(ADR-0152). Platforms other than Linux and macOS cannot build this
plugin.