Public internet UDP service exposed on a port (commonly 443). Likely threats:
- Handshake floods / connection churn (CPU exhaustion)
- Session floods (memory exhaustion)
- Stream-open floods (state explosion)
- Slow-read / never-read (buffer bloat)
- Datagram bursts (event loop / JS callback storms)
- Malformed / adversarial traffic triggering panics
Canonical release truth: docs/release-status.json. This document defines the security controls that feed that manifest.
- Safe defaults
- TLS verification enabled by default for client.
insecureSkipVerifyrequires explicittls.insecureSkipVerify: true; emits warning log when used. Dev only — never use in production.- The root
createServer()refuses to invent a certificate in production. With an emptytls.certPemortls.keyPemit serves a freshly generated self-signed certificate (SANslocalhost,127.0.0.1,::1, valid 14 days, a new key every start) so local development works without a PEM pair; whenNODE_ENV=productionit throwsE_TLSinstead, unlesstls.allowSelfSigned: trueopts back in. Clients will not trust that certificate withoutinsecureSkipVerifyor a pinnedserverCertificateHashesentry, and it cannot carry SNI entries./portablenever takes this path: it rejects an empty PEM pair on both backends unless the wasm backend's ownallowSelfSignedis set. - Native diagnostics are redacted by default (log payload/message/session metadata and panic details).
createServer({ debug: true, ... })turns redaction off: log events then carry the full message plussessionId,peerIpandpeerPort. Use it only in trusted dev/debug environments, and treat its logs as containing client IP addresses.
- Bounded resources
- All buffering is bounded and accounted for.
- There is always a cap that prevents unbounded memory growth.
- Graceful shedding
- When overloaded, reject new handshakes/sessions/streams first.
- If a client is abusive, close that client before impacting others.
- Timeouts
- handshakeTimeoutMs (default 10s): one budget per incoming connection, from
its first Initial packet to the answer to its CONNECT request (QUIC + TLS +
CONNECT together). A handshake that runs out is dropped, gives back its
maxHandshakesInFlightslot and is counted inlimitExceededCount. - idleTimeoutMs (default 60s)
- backpressureTimeoutMs (default 5s)
- Limits
- maxSessions, maxHandshakesInFlight
- max streams per session and global
- maxQueuedBytes global/per-session/per-stream
- maxDatagramSize cap
- Rate limits per peer IP and per prefix
- RateLimitOptions: per-IP handshakesBurst, per-prefix handshakesBurstPerPrefix (/24 IPv4, /64 IPv6). Both also cap the sessions open at once from that IP or prefix (defaults 40 and 100)
- Over-rate traffic is refused, not punished: a handshake is refused, a stream open is reset, and a datagram over the ingress rate is dropped and counted in
rateLimitedCountanddatagramsDropped. The session survives, on both the native and wasm engines. - The handshake token bucket and the per-IP / per-prefix session caps are
charged once the QUIC and TLS handshake has finished and the CONNECT
request has been read, and a refused peer gets HTTP 429 (
E_RATE_LIMITED). They are not charged earlier on purpose: the server sends no QUIC Retry, so the source address of an Initial is unvalidated and spoofable, and charging it would let anyone drain a victim's budget.
- Connection churn protection
- maxHandshakesInFlight (default 200) caps handshakes in progress, counted from the first Initial packet, before any cryptographic work. Overflow is refused with QUIC CONNECTION_REFUSED.
- handshakeTimeoutMs bounds how long each of those slots can be held. This pair, not the per-IP buckets, is what bounds pre-handshake work: a source that sends Initials and never finishes (one packet each is enough) can keep the cap occupied, but each packet holds a slot for at most handshakeTimeoutMs. Lower handshakeTimeoutMs to shrink that window.
- Per-IP and per-prefix limits prevent single-source exhaustion of sessions
- Panic containment
- Rust panics must be caught at task boundaries where possible
- convert to E_INTERNAL and close affected session/server
- Run behind a UDP-capable firewall with explicit allow rules.
- Monitor:
- rateLimitedCount
- limitExceededCount
- datagramsDropped
- queuedBytesGlobal
- backpressureTimeoutCount
- If queuedBytesGlobal climbs and stays high (it sums separately capped
receive and send counters; see the queued-bytes alert in docs/OPERATIONS.md):
- decrease per-session limits
- decrease stream highWaterMarks
- shed stale datagrams in the application: there is no drop-policy option.
Incoming datagrams are already dropped when the receive budget is full
(
E_QUEUE_FULL, counted indatagramsDropped); outgoing sends wait and then fail withE_BACKPRESSURE_TIMEOUT, so stop sending what is no longer useful rather than queueing it - scale horizontally
- Pin wtransport (a vendored fork; see docs/FORK_MAINTENANCE.md) and the transitive QUIC/H3 dependencies (see Cargo.lock).
- Monthly dependency update cadence; security patches applied promptly.
- Respond to CVEs quickly; publish security advisories if needed.
- Report vulnerabilities via GitHub Security Advisories or a dedicated contact (see CONTRIBUTING).
- CodeQL and Trivy findings are triaged in PRs;
CRITICAL/HIGHare blocking by default. - P3.2: Release workflow runs security gates (cargo audit, Trivy fs + lib, CodeQL) before build; release is blocked on any CRITICAL/HIGH finding.
- Any suppression must include:
- clear justification,
- scope (exact package/path/CVE),
- expiration/revisit date.
- Suppressions should be minimal and temporary; broad/global ignores are not allowed.
- When a finding is accepted temporarily, track it in an issue with owner + target fix release.
NODE_ENV=production: the rootcreateServer()rejects an emptytls.certPem/tls.keyPemwithE_TLSinstead of serving a generated self-signed certificate (see "Safe defaults");tls.allowSelfSigned: trueoverrides it. This is the only place the library readsNODE_ENV.
WEBTRANSPORT_LOG_EXPECTED_CHANNEL_CLOSES=1: enables logging of expected (non-error) channel close events. Useful for debugging teardown ordering, but may produce noisy logs in production. Does not affect security enforcement.WEBTRANSPORT_SUPPRESS_INSECURE_SKIP_VERIFY_WARN=1: suppresses the warning log emitted wheninsecureSkipVerifyis used. Should only be set in CI/test environments.WEBTRANSPORT_SUPPRESS_LOG_CALLBACK_WARN=1: suppresses thelog callback failedwarning printed when yourlogcallback throws. Does not affect security enforcement. These variables control diagnostic verbosity only; they do not bypass rate limits, TLS verification, or resource caps.
Off by default on both sides. A server opts in with createServer({ enable0Rtt: true })
and a client with connect(url, { enable0Rtt: true }) (incompatible with
allowPooling). A resuming client's CONNECT can then arrive as TLS early data, which an
attacker who captured it can replay.
- Session delivery is deferred by default. A 0-RTT session reaches
onSessiononly once the handshake is confirmed and the request is no longer replayable.allowEarlySession: truedelivers it earlier; set it only when everythingonSessiondoes beforesession.handshakeConfirmedis true is strictly idempotent, and gate side effects on that flag. - Visibility. Sessions report
has0Rtt(early data was used),accepted0RttandhandshakeConfirmed. - Tickets are per process. Resumption state lives in memory; a restart or a request
landing on another instance falls back to a full handshake.
exportTicketVault/importTicketVaultmove tickets between client identities inside one process only.
Opt-in via endpoint option enable0Rtt (default false). When enabled, the
wasm stack configures rustls/quinn-proto for TLS 1.3 early data:
- Server:
max_early_data_size = u32::MAX(QUIC requirement) with a stateful session store (InMemoryTicketStore). Stateless ticketing is intentionally not used; rustls only accepts early data on the stateful path. - Client:
enable_early_data = truewith the same style of ticket store so a later connect can offer 0-RTT when a ticket is present.
- Ticket single-use (server): presenting a stateful session ticket consumes
it (
StoresServerSessions::take). A naive replay of the same ticket against this process should fail resumption / early-data acceptance once the ticket is spent. - Transport-parameter / ALPN consistency: quinn/rustls reject 0-RTT when resumed parameters are incompatible (covered by unit tests); the handshake falls back to 1-RTT.
- Application-data replay: 0-RTT stream/datagram payloads can still be replayed by an on-path attacker to the original server within the ticket lifetime. Treat early application data as at-most-once / replay-tolerant only (same rule as HTTP early data). Do not put non-idempotent WT session setup or mutating RPCs solely in 0-RTT.
- Cross-process / multi-instance anti-replay: the in-memory store is per-endpoint process. Shared anti-replay across horizontally scaled wasm hosts (or durable JS-backed stores) is not implemented yet; a future JS ticket-store bridge must supply coordinated single-use semantics if required.
- Disabled by default: with
enable0Rtt: false, early data is not offered or accepted even if residual tickets exist in a shared store. - CONNECT / app policy: wait for 1-RTT (post-handshake) before non-idempotent
WebTransport CONNECT or application RPCs unless an explicit, documented
exception allows early data. Export
has0Rtt/accepted0Rttso hosts can gate sends. In-process anti-replay uses the RustInMemoryTicketStore::takepath. JSTicketStoreHostparticipates on the hydrate/dump path around connect/close (opaque process-local vault blobs keyed by server name); it is not on the rustls hot path. Durable IndexedDB / cross-process ticket serialization remains out of scope. Do not reuse a taken ticket.
Private key PEM strings are parsed into PrivateKeyDer and stored in standard Rust heap allocations which are not zeroed on deallocation. In a process crash (core dump, swap file), key material could theoretically be recoverable from process memory. This is consistent with most non-HSM TLS libraries. For deployments requiring HSM-level key protection, use external key management with TLS termination at a trusted proxy.