docs/BEST-PRACTICES.md said this repository had no fuzzing. It has one now, aimed at the only functions that take bytes somebody else chose: payloadToEnvelope parses the payload transport field, openSealed parses a sealed blob before anything has authenticated it, and bundleFromWire parses a key bundle the relay hands over. isSealed is in there too, because a predicate that throws crashes a caller.
It found a defect on the first run.payloadToEnvelope accepted base64 of valid JSON that is not an object. JSON.parse('null') returns null and a quoted string returns a string, and both went straight back to the caller:
payloadToEnvelope: accepted and returned a string on "ImEgc3RyaW5nLCBub3QgYW4gb2JqZWN0Ig=="
payloadToEnvelope: accepted and returned a object on "bnVsbA=="
e2e-client.js:2255 then calls isSealed on that value and the ratchet reads env.header, so the failure surfaced later as a TypeError about a property of null, or as undefined flowing on quietly. It now throws notAnEnvelope for null, for a primitive and for an array.
A thrown Error counts as a pass here, which is the distinction the suite exists to make: a parser refusing malformed input is doing its job. It fails on a RangeError from unbounded recursion or allocation, a non-Error throw, a case that takes longer than two seconds, and a malformed input that parses into something a caller would treat as valid. Prototype pollution gets its own check, because a successful one leaves no exception behind and the loops would score it as a pass.
The generator is seeded and prints its seed, so a failure is reproducible from the line.
Gate. 32,001 cases at seed 20261015 and 16,001 at seed 7, both 0 problems. The four existing suites are unchanged by the stricter parser: conformance 304 passed with 2 skipped, client 289, ratchet 35, vault 26, all 0 failures. Secret sweep clean across 90 files.
Not in npm test yet. Adding it there, or as a CI job, is a follow-up once the runtime is agreed: 8,000 cases per target takes about 45 seconds.
`docs/BEST-PRACTICES.md` said this repository had no fuzzing. It has one now, aimed at the only functions that take bytes somebody else chose: `payloadToEnvelope` parses the `payload` transport field, `openSealed` parses a sealed blob before anything has authenticated it, and `bundleFromWire` parses a key bundle the relay hands over. `isSealed` is in there too, because a predicate that throws crashes a caller.
**It found a defect on the first run.** `payloadToEnvelope` accepted base64 of valid JSON that is not an object. `JSON.parse('null')` returns null and a quoted string returns a string, and both went straight back to the caller:
```
payloadToEnvelope: accepted and returned a string on "ImEgc3RyaW5nLCBub3QgYW4gb2JqZWN0Ig=="
payloadToEnvelope: accepted and returned a object on "bnVsbA=="
```
`e2e-client.js:2255` then calls `isSealed` on that value and the ratchet reads `env.header`, so the failure surfaced later as a TypeError about a property of null, or as `undefined` flowing on quietly. It now throws `notAnEnvelope` for null, for a primitive and for an array.
**A thrown Error counts as a pass here**, which is the distinction the suite exists to make: a parser refusing malformed input is doing its job. It fails on a `RangeError` from unbounded recursion or allocation, a non-Error throw, a case that takes longer than two seconds, and a malformed input that parses into something a caller would treat as valid. Prototype pollution gets its own check, because a successful one leaves no exception behind and the loops would score it as a pass.
The generator is seeded and prints its seed, so a failure is reproducible from the line.
**Gate.** 32,001 cases at seed 20261015 and 16,001 at seed 7, both 0 problems. The four existing suites are unchanged by the stricter parser: conformance 304 passed with 2 skipped, client 289, ratchet 35, vault 26, all 0 failures. Secret sweep clean across 90 files.
Not in `npm test` yet. Adding it there, or as a CI job, is a follow-up once the runtime is agreed: 8,000 cases per target takes about 45 seconds.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
docs/BEST-PRACTICES.md said this repository had no fuzzing. It has one
now, aimed at the only functions that take bytes somebody else chose:
payloadToEnvelope parses the `payload` transport field, openSealed parses
a sealed blob before anything has authenticated it, and bundleFromWire
parses a key bundle the relay hands over. isSealed is in there too,
because a predicate that throws is a predicate that crashes a caller.
🔴 It found a defect on the first run. payloadToEnvelope accepted base64
of valid JSON that is not an object: `JSON.parse('null')` returns null
and a quoted string returns a string, and both went straight back to the
caller. e2e-client.js:2255 then calls isSealed on it and the ratchet
reads env.header, so the failure surfaced later as a TypeError about a
property of null, or as undefined flowing on quietly. It now throws
`notAnEnvelope` for null, for a primitive and for an array.
A thrown Error counts as a PASS in this suite, which is the distinction
it exists to make: a parser refusing malformed input is doing its job.
What it fails on is a RangeError from unbounded recursion or allocation,
a non-Error throw, a case that takes longer than two seconds, and a
malformed input that parses into something a caller would treat as
valid. Prototype pollution gets its own check, because a successful one
leaves no exception behind and the loops would score it as a pass.
The generator is seeded and prints its seed, so a failure is
reproducible from the line rather than from luck.
Gate: 32,001 cases at seed 20261015 and 16,001 at seed 7, both with 0
problems. The four existing suites are unchanged by the stricter parser:
conformance 304 passed with 2 skipped, client 289, ratchet 35, vault 26,
all 0 failures. Secret sweep clean across 90 files.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
docs/BEST-PRACTICES.mdsaid this repository had no fuzzing. It has one now, aimed at the only functions that take bytes somebody else chose:payloadToEnvelopeparses thepayloadtransport field,openSealedparses a sealed blob before anything has authenticated it, andbundleFromWireparses a key bundle the relay hands over.isSealedis in there too, because a predicate that throws crashes a caller.It found a defect on the first run.
payloadToEnvelopeaccepted base64 of valid JSON that is not an object.JSON.parse('null')returns null and a quoted string returns a string, and both went straight back to the caller:e2e-client.js:2255then callsisSealedon that value and the ratchet readsenv.header, so the failure surfaced later as a TypeError about a property of null, or asundefinedflowing on quietly. It now throwsnotAnEnvelopefor null, for a primitive and for an array.A thrown Error counts as a pass here, which is the distinction the suite exists to make: a parser refusing malformed input is doing its job. It fails on a
RangeErrorfrom unbounded recursion or allocation, a non-Error throw, a case that takes longer than two seconds, and a malformed input that parses into something a caller would treat as valid. Prototype pollution gets its own check, because a successful one leaves no exception behind and the loops would score it as a pass.The generator is seeded and prints its seed, so a failure is reproducible from the line.
Gate. 32,001 cases at seed 20261015 and 16,001 at seed 7, both 0 problems. The four existing suites are unchanged by the stricter parser: conformance 304 passed with 2 skipped, client 289, ratchet 35, vault 26, all 0 failures. Secret sweep clean across 90 files.
Not in
npm testyet. Adding it there, or as a CI job, is a follow-up once the runtime is agreed: 8,000 cases per target takes about 45 seconds.🤖 Generated with Claude Code