# Findings against 9f4fe9a ## TID constructor output rejected by parser The generator draws the documented 53-bit timestamp and 10-bit clock. A timestamp of `6 << 50` formats with leading `a`, but `Timestamp.fromStr` tests the ASCII 0x40 bit and rejects it. This is a reachable public constructor/parser mismatch, though these timestamps are far beyond current wall-clock dates. Reproduced with native Hegel and seed 2, 100 cases: ```sh PBT_TARGET=syntax HEGEL_ZIG_REPLAY=AXicY2EAAi5GEMnMAGazM8CABFQCAASQAEc= zig build pbt-codecs -Dhegel ``` The [TID specification](https://atproto.com/specs/tid) describes a 53-bit timestamp and separately permits leading `234567abcdefghij` syntactically. zat's `u63` representation can represent leading `234567ab`. The constructor roundtrip fix must address that range without truncating higher leading values. Supporting the wider syntax range would require a separate representation decision. ## DPoP JSON does not escape nonce strings `createDpopProof` interpolates `nonce` into JSON. A nonce containing a backslash or quote changes the parsed value or makes the signed payload invalid JSON. The proof helper is public and the OAuth request path supplies server nonce headers to it. The same interpolation pattern affects other string claims in DPoP proofs and client assertions. Generated control characters test the public helper, not what is legal in an HTTP header. Reproduced with native Hegel and seed 1, 30 cases, shrunk to one proof operation: ```sh HEGEL_ZIG_REPLAY=AXicY2cAAi5GBgyKkRHCYGaEijABAAaFAEc= zig build pbt-runtime -Dhegel ``` ## Firehose commit CAR omits the commit CID root When a commit event carries no `blocks`, the encoder synthesizes a CAR whose roots are the first record's CID, or nothing when there are no record ops. `com.atproto.sync.subscribeRepos#commit` requires the commit block CID to be the first root, and zat's own `car.read` rejects a rootless header as `InvalidHeader`. The structured property shrank to an empty commit: ```sh PBT_TARGET=structured HEGEL_ZIG_REPLAY=AXic42QAAi5GEMnMgGATTwEADdcAZQ== zig build pbt-codecs -Dhegel ``` Found at `a2713ac` with seed 1, 100 cases. The README's seed 2 run had not reached it. The fix roots the CAR at the commit CID. The encoder has that CID but not the commit block, which the lexicon also requires in the CAR, so a synthesized CAR is still not a verifiable commit; producers must pass blocks. ## XRPC retries ignore Retry-After in its HTTP-date form RFC 9110 permits `Retry-After: `. zttp parses it into `retry_after_at`; `RetryPolicy.delayMillisAt` read only the delta form and `RateLimit-Reset`, so a 429 asking for a delay by date fell back to exponential backoff. The XRPC simulation shrank it to one GET with a zero base delay, retried after 0 ns instead of the requested second: ```sh HEGEL_ZIG_REPLAY=AXicE2cAAi5GBjDFAiI/BqdCBBjh4mCKEcZnRGgAUUwoPEZsPBYUHpq5+CgAQfACuQ== zig build pbt-xrpc -Dhegel ``` `RateLimit-Reset` remains an absolute Unix time in zat. A small delta-form reset, as in the IETF draft, falls back to backoff; zttp's `delaySeconds` would read it as a delta. That is a policy choice, not changed here. ## zttp returns bodies cut short of Content-Length (fixed in zttp 0.3.0) std.http reports a connection that closes before `Content-Length` bytes as an ordinary end of stream, and zttp v0.2.0's `streamBody` returned the short body as success. A truncated `getRepo` CAR that ends on a block boundary still parses. The fix is zttp `aa459a4` on `fix/content-length-truncation`; zttp 0.3.0, which zat now pins, fails such a body with `ResponseTruncated`, and `pbt/xrpc.zig` sets `transport_reports_truncation = true`. ## Open: XRPC does not retry a GET whose body was truncated `isRetryableTransportErrorForMethod` retries a GET after `ReadFailed` or a connection reset, but not after zttp 0.3.0's `ResponseTruncated`, which is the same interruption detected at the Content-Length check. A truncated GET is safe to repeat. The campaign models the current behavior (not retried) until this is decided. ## DID resolution accepts a document declaring another DID The DID specification says the document `id` should always be verified against the DID used for resolution. `DidResolver` returned any document the PLC directory or did:web host served. The identity simulation shrank it to one resolution answered with another DID's document: ```sh HEGEL_ZIG_REPLAY=AXic42IAAi5GBjjFiMJjYITxGbEqYwYADooAaw== zig build pbt-identity -Dhegel ``` ## DoH address answers that are not IP literals become the dial host `checkDnsAnswers` rejected only answers that parsed as non-routable IPs. An A answer such as `localhost.localdomain` passed and became the dial host, which the system resolver resolves at connect time. Cloudflare renders A data as dotted quads, so reaching this needs a misbehaving DoH endpoint: ```sh HEGEL_ZIG_REPLAY=AXic42EAAi5GBjjFiMJjYITygTSKBDOKak6oHAAWSwCN zig build pbt-identity -Dhegel ``` ## 3fff::/20 documentation space passed as routable RFC 9637 (2024) reserved `3fff::/20` for documentation; the IANA registry marks it not globally reachable. It lies inside `2000::/3`, which the check allowed: ```sh HEGEL_ZIG_REPLAY=AXic42EAAi5GBjjFiMJjYITygTSKBDOKakGoHAAWiwCV zig build pbt-identity -Dhegel ``` The identity blobs were recorded before the generator gained a routable-only draw, so they may no longer replay the same history; each fix carries a deterministic unit regression. ## Keepalive setup panics on a socket the peer already reset Found by reading, not by a campaign: building the firehose simulation showed that `configureKeepalive` called `std.posix.setsockopt` on the connection, which treats BADF, NOTSOCK, and INVAL as unreachable. A peer that resets between the WebSocket handshake and keepalive setup makes macOS return INVAL, a panic in safe builds. websocket.zig had fixed the same race in its own timeouts. The fix has a deterministic regression on a closed socket. ## websocket.zig drops a handshake header split mid-CRLF (fixed in websocket.zig 0.3.0) When a read ended between a header line's `\r` and `\n`, the client's reply parser advanced past the line before breaking to read more, so the line was never parsed and a valid 101 failed with `InvalidHandshakeResponse`. The firehose simulation's random partial reads hit it in about half the cases. The fix is websocket.zig `2dffa90`, released in 0.3.0 as `d498f53`; zat pins 0.3.1, so `Network.split_upgrade_crlf` is true and the simulation splits handshake reads anywhere. ## Open: zttp replays a DPoP proof after a dead connection `dpopRequest` with GET hands zttp a request whose `DPoP` header is single-use. When the connection resets before a response head, zttp's dead-connection replay resends the identical proof. A reset does not prove the server never processed the request, and RFC 9449 ยง11.1 (DPoP Proof Replay) is why DPoP servers reject a `jti` they have already seen; the replay then fails as a replay instead of retrying. The OAuth simulation reaches it in one step: ```sh HEGEL_ZIG_REPLAY=AXicE2AAAi5GBjDFAiI/BqdCBBjh4sgUI0yYESrCTjTFAADDywKF zig build pbt-oauth -Dhegel ``` Not fixed: it needs either a per-request way to opt out of zttp's replay or a zat retry that mints a fresh proof. `pbt/oauth.zig` counts the duplicate only when a reset preceded it and fails on any other reused `jti`. ## Not a defect: zttp replays idempotent requests after a dead connection A GET whose connection resets before a response head is replayed up to `dead_connection_attempts` (3) times inside one `fetch`. `RetryPolicy.none()` therefore bounds zat's attempts, not the requests a resetting server sees. The XRPC model includes the replay layer. None of the findings depend on live services. No claim is made that any is an exploitable vulnerability. Mutation calibration and broader campaigns remain.