Commit Graph
9 Commits
Author SHA1 Message Date
retoorandClaude Sonnet 5 c20078dd79 fix(runtime): cap H2 control-frame output to stop PING-flood DoS/crash
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>
2026-10-25 20:27:04 +01:00
retoor 16a0bb0de4 expose: idempotent store Open, pg cleanup on failed connect + fallback proof 2026-10-24 01:00:09 +02:00
retoor 4996068f42 expose: thread-safe cells, concurrency + backend proof
- CellForPtr returns shared_ptr; fast path keeps no vector refs (fixes race)
- test: 16x1000 concurrent Notes exact, sqlite/postgres Backend(), DatabaseUrl default
- runtime_tests: 134 passed (incl H2 hpack/flow/stream/connection)
2026-10-24 00:47:26 +02:00
retoor 2488651d81 expose: kb/s windowed rates + zero-cost Note proof
- Collector: timestamped ring (deque, 60s prune under lock); RateIn/Out KB/s
- Query text/JSON gain kb_s_in/kb_s_out columns
- test: assert rates non-zero after traffic, disabled fast-path takes no lock
- full realtime suite green (13 binaries, 0 fail)
2026-10-24 00:40:16 +02:00
retoor 7d968fb7a0 feat: auto-flush stats timer, .env.json defaults, expose round-trip+timer tests 2026-10-24 00:36:36 +02:00
retoor 0bd9dcd584 fix: stats flush ensures schema, query flushes pending, add sqlite round-trip test 2026-10-24 00:35:10 +02:00
retoor 3c4334cec9 feat: implement MoloApp plans 01-15 with integration
Full C++23 framework tree: runtime, observability, security,
data, app, realtime, supervisor, clients, CLI, example plus
enterprise tenancy, audit, operability, governance,
supplychain. Postgres via docker compose for tests.
2026-10-23 18:20:04 +02:00
retoor 54068f1953 docs: split plan into numbered detailed files with research
Ten sequential spec files plus index covering runtime,
observability, security, data, routing, realtime, supervisor,
clients, CLI ops, and workflow, each with best practices,
structure, rules, guidelines, specs, and cross-references.
2026-10-23 14:22:29 +02:00
retoor 7a50afe969 docs: define MoloApp C++23 framework plan
Scope covers HTTP/1.1+HTTP/2, WebSockets, Socket.IO, ORM with
prod self-healing, realtime clients, observability, supervisor,
AI harness CLI, and living example project.
2026-10-23 14:09:07 +02:00