go-quic-connection-id-migration-amp-budget-20261013
Done. The verified solution is written to ~/SOLUTION.md (self-contained, includes the full source in an appendix), with the working implementation in ~/quicpath.
| # | Failure mode | Naive bug | Invariant established |
|---|---|---|---|
| 2.1 | Reordered bytes bypass 3× budget | credit applied after auth / only to accepted packets | credit len(datagram) to the path before auth/replay; counters monotonic & saturating |
| 2.2 | NAT rebinding leaks trust/budget | connection-wide validated/received |
AmpState is per 4-tuple, new path starts 0/0/unvalidated |
| 2.3 | Migration acted on before auth | switch primary on any packet from a new address | detect from tuple, commit only after Open + replay pass |
| 2.4 | Retired-ID reuse | single map overwritten | dual-index CIDTable; terminal retired state; retire_prior_to monotonic |
| 2.5 | Partial key-phase update | flip phase on differing bit, before auth | pure Classify → Current/Previous/Next by pn; flip only in Commit after auth |
| 2.6 | Replays accepted | no window / window updated on receipt | 64-packet window, Check then Commit after auth |
| 2.7 | Congestion deadlock | connection-wide cwnd, loss never drains | per-path controller, Reset() on migration, OnLoss clamps at 0 |
| 2.8 | Spoofed-address memory DoS | unbounded path map | maxPaths cap |
| 2.9 | Concurrent probes | one challenge slot | per-path map[[8]byte]time.Time, response echoed on arrival path |
The security-critical piece is the ingest order: resolve CID → create path → credit bytes → classify key phase (pure) → authenticate → replay-check → commit replay+keyphase atomically → only then migrate/handle frames.
cd ~/quicpath
go build ./... && go vet ./... && gofmt -l . # clean
go test -race -count=2 ./... # ok quicpath 1.017s
go test -cover ./... # ok quicpath coverage: 74.4%
31/31 tests pass under the race detector, covering: exact 3× budget, reordered/late credit, retired-ID reuse (CID value and sequence), retire_prior_to monotonicity, active_connection_id_limit, NAT-rebinding independent budget, unauthenticated non-migration, concurrent path probes, partial key-phase update, replay rejection, congestion reset-on-migration, loss unblocking, and path-cap enforcement.
# Evidence - Problem class: go-quic-connection-id-migration-amp-budget-20261013 - Model: openrouter/deepseek/deepseek-v4.1-flash - Solved: 2026-10-13T10:22:27.590Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "Build a QUIC packet-path state machine that validates connection-ID rotation and peer-address migration while enforcing the three-times anti-amplification budget across reordered packets and concurrent path probes. Recover safely from NAT rebinding, retired-ID reuse attempts, and partial key-phase updates without accepting replayed datagrams or deadlocking congestion accounting.", "environment": "go1.26", "language": "go", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "go-quic-connection-id-migration-amp-budget-20261013", "provider": "openrouter", "solved_at": "2026-10-13T10:22:27.590Z", "version": "1.26"}