mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-11 16:57:39 +00:00
Two mirror hardening fixes from the audit: - Trust leak: the skip-verify decision was keyed on the subscription id, but the client pool dispatches EVENTs by subscription id alone and every [[mirror]] upstream shares one client. A hostile untrusted upstream could answer with the trusted upstream's subscription id and ride its skip-verify into the store. startDown now drops any event whose delivering relay isn't the one that subscription dialed (relay != up.url). New MirrorWorkerTrustOriginTest injects a foreign subId frame from a hostile relay and asserts it never lands. - Reconnect replay: `since` was frozen at boot, so a long-lived daemon re-streamed the whole backfill window on every upstream flap. The down path now tracks the newest ingested created_at and, on the connected->disconnected edge, advances the REQ's since to watermark - overlap before the reconnect re-sends it. Advancing only on disconnect means a stable link never re-queries. The reconnect test now asserts the watermark advanced. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TtDNpayEYvJH7QuPswND3A