Skip to content
Go back
Spate

An at-least-once ETL pipeline framework written in Rust.

Multi-record S3 notification fuzzing in Spate

s3: fuzz the notification decoder

Spate's S3 source fuzzed its notification decoder one record at a time, so no fuzz target predicted what a message of several records does. A new target builds such messages and predicts which records are read, dropped or rejected.

Status
Merged
Merged
24 Oct 2026
Area
S3 source
Rust
Diff
465 lines added and 0 removed across 4 files

The problem

Spate’s S3 crate reads objects from storage into a pipeline. One way it finds them is a storage notification, a JSON message that a store sends to a queue or topic when an object changes. A message can carry several records. The decoder reads each record, drops it or fails the whole message, and anyone who can publish to the queue chooses the bytes it receives.

Nothing was known to be broken, and notifications hadn’t reached a release yet. A hand probe recorded in the issue found no panic, and unit tests pinned each rule. A fuzz target is a test that generates its own inputs for as long as it runs, and when the issue was opened none reached this decoder. s3_unit_decode arrived while my branch was open. It tried raw bytes and one generated record per run, and checked only the parts that came back, so a record wrongly dropped or refused went unnoticed.

What I changed

I ran the target for 300 seconds, which was 586,413 runs with no crash. To check that it could catch a bug, I lowered the decoder’s versionId cap to 1,000 bytes, and the target failed within 120 seconds.

Judgement calls

The target predicts outcomes instead of checking properties. A property check only sees what comes back, so it can’t notice a record that vanished. My target starts from the key it means, encodes it and knows what the decoder must return. The cost is that the prediction has to follow the decoder’s order. A zero-size record for another bucket fails its message, while a zero-size record with an unusable key is dropped, because the size check runs first. A decoder change can therefore need a target change, and #1461 needed one three days later.

I left two rules uncopied. addressable is object_store’s rule, so a copy could drift. ETag validity comes from the http crate, which replaced my first version’s hand-written check. The target can’t catch a bug in addressable, so that rule still relies on the listing tests.

I dropped the raw-bytes arm the issue asked for. The issue specified two arms, one for arbitrary bytes and one for built messages. While my branch was open, #1344 merged and added s3_unit_decode, which already fuzzes raw bytes against the same decoder. A second arm would have repeated that check. The same pull request taught the decoder versionId and spateReEnqueues, so I extended the target to cover both. That includes versionId values of 1,000 to 1,049 bytes, either side of the 1,024 cap.

What review changed

Nothing in this pull request changed. The maintainer approved it and left two points for later.

The first was a gap the target shared with the unit tests. With the created-event check loosened to contains("ObjectCreated:"), the spate-s3 suite still passed and the target found nothing in two 120-second runs, because it only writes that text at the start of a name or after one s3:. A name like xObjectCreated:Put would then read as a created object, though no store sends one. The maintainer filed an issue and I closed it the same day in #1364, with three new names in a unit test. The target itself still reaches such names only by chance.

The second was that the fuzz_seams header doesn’t describe a one-call export like addressable. The maintainer kept that wording question for themselves.

Outcome

Merged on 24 October 2026, closing #1289. A later decision record, ADR-0082, cites the target among the checks that confirm it.

Timeline

  1. 24 Oct 2026
    Pull request opened
  2. 24 Oct 2026
    Merged the same day
  3. 1 Nov 2026
    Released in Spate v0.4.0

All open source work →All case studies →