MOLO-H2-004 (CVE-2019-9511/9512/9515/9518 class): a client that floods
PING frames without draining its socket crashed runtime_interop_server
after ~100-150k frames. Root cause, confirmed with an ASan build, is a
stack overflow, not heap growth: EventLoop::post()/the Task<T>
continuation resume synchronously when work is already buffered, so
H2Connection::ReadLoop's frame loop never returns to
EventLoop::run_once()'s flat dispatch while a burst of already-read
frames remains; each frame nests the native stack one level deeper
(ReadLoop -> Ensure -> ReadLoop -> ...) until it overflows.
ReadLoop now forces a co_await loop().yield() every
caps::kH2FramesPerYield frames, unwinding the stack back to
run_once() regardless of burst size.
Separately, EnqueueControl/EnqueueData/CompleteResponse had no ceiling
on out_queued_bytes_ for H2, unlike the H1 path's out_.size() check in
runtime/http/connection.cpp. Added EnforceWriteCap(), using a new,
tight caps::kH2MaxPendingControlBytes for control output (PING/SETTINGS
acks, RST, WINDOW_UPDATE, GOAWAY) and the existing kWriteBufferCeiling
for DATA/response output, same as H1. Because the kernel's own TCP send
buffer keeps draining small control frames even while the peer never
reads, out_queued_bytes_ alone can stay near zero through a flood, so
also added a monotonic caps::kH2MaxControlFramesPerConnection rate cap
in EnqueueControl as the mechanism that actually bounds this class of
abuse; exceeding either cap drops the connection via Fatal().
audit/MOLO-H2-004 now PASSes repeatably: the connection is cut well
before all 300k PINGs are accepted, and the server stays up with
bounded RSS. All 134 runtime unit tests (including the H2 suite)
still pass.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
H2Connection accepted an unbounded number of client-initiated
HEADERS(END_HEADERS|END_STREAM)+RST_STREAM(NO_ERROR) pairs on one
connection: kH2MaxConcurrentStreamsDefault never engages because each
stream is torn down (dispatched and erased) before the next HEADERS
arrives. Add caps::kH2MaxStreamResetsPerConnection (200) and a
per-connection client_resets_ counter in OnRst; once a connection's
lifetime count of client RST_STREAM frames exceeds the cap, close it
with GOAWAY(ENHANCE_YOUR_CALM) via the existing Fatal() path, same as
other protocol-limit violations in this file.
The counter increments unconditionally for every valid RST_STREAM
frame, not only ones matching a still-open stream: this server's
coroutine dispatch runs synchronously inline (lazy Task resumed via
EventLoop::post on the loop thread) for fast handlers, so the matching
stream is frequently already completed and erased by the time the
paired RST_STREAM is parsed, which would otherwise let the attack
bypass a naively-scoped counter.
audit/MOLO-H2-001 (Rapid Reset) now PASSes; audit/MOLO-H2-002
(MadeYouReset) continues to PASS via its separate existing
flow-control-error path, unaffected by this change.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
kH2HeaderListMax only bounded accumulated header bytes across HEADERS plus
CONTINUATION frames, so an attacker could flood zero-length CONTINUATION
frames on an open header block (CVE-2024-27316 class) forever without
tripping the byte cap, each still costing a 9-byte frame parse. Add an
independent kH2MaxContinuationFramesPerHeaderBlock cap in caps.h and
enforce it in H2Connection::OnContinuation, closing the connection via the
same Fatal(kCompressionError) GOAWAY path already used for the byte cap.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
body_.size() + size could wrap size_t when an attacker-controlled chunk
size (up to 0xFFFFFFFFFFFFFFFF) was added to an already non-empty body,
making the body_cap_ comparison pass when it should reject with 413.
Check the remaining budget instead of the sum: reject if body_ already
exceeds the cap, or if the declared chunk size exceeds what's left.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Table driven REST (509 rows verified against vendor specs by tools/check_spec.py),
WebSockets over the src/google/live client, neutral SpeechSynthesizer /
SpeechRecognizer seam, /ai/audio demo with dry runs, 110 package tests and 5
route tests. PlayHT has no public API; LeMUR is gone from AssemblyAI's spec.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Directory and document cache with caps, parameter and body validation before
traffic, path/query/repeated/regional handling, key-or-OAuth choice, paging,
long-running wait, whole-directory checker script, demo at /google/discovery.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Package molo::perplexity covering all 39 operations of the five published
OpenAPI documents, PerplexityChatModel, demo routes under /ai/perplexity,
check_spec.py, SPEC.md, 46 unit cases and 111 route checks.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Package src/vendors/cohere (molo::cohere): Chat v2 with streaming, tools,
thinking and citations; embed, rerank, classify, tokenize, detokenize,
parse, transcription; datasets, embed jobs, batches, connectors,
fine-tuning, models, check-api-key; legacy v1 chat/generate/summarize;
CohereChatModel : ChatModel. All 42 operations of cohere-openapi.yaml are
in one call table, verified by tools/check_spec.py. Demo routes under
/ai/cohere, 51 unit tests and 2 route tests; live tests are opt-in.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Adds molo::google::apis (api_catalog) as the code source of truth,
src/google/APIS.md, a Required APIs section per module SPEC, and the
vendor key consoles in src/llm/SPEC.md. Placeholder project example-214512124.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>