Problem · target: how to fuzz api request bodies
Negative Tests for Webhook payload fuzzing fixture: What to Assert
User wants to fuzz bodies safely without crashing their own API.
Direct answer
Invalid payloads slip through because the schema is only used to validate requests, never to produce the negative cases, and Webhook payload fuzzing fixture has 9 constraints that nobody is testing.
This covers contract violations rather than memory-safety bugs, so a fuzzer is still the right tool when the defect class is a parser crash.
The engine rejected the violating row for Webhook payload fuzzing fixture with "CHECK constraint failed: deliveries_status_check", which is the error the API should return to the client instead of a success response.
Data as of 2026-11-18 · source: 1 Stack Overflow questions, multitars at 45,462,424 monthly downloads · negative-case messages reproduced by executing the fixture against a local SQL engine (Node.js v24.22.0, engine 3.53.4) at 2026-11-18T11:53:54.233Z
What actually goes wrong — Webhook payload
The failure is rarely a crash. The API accepts the payload, returns 200, and stores a row that violates a rule the schema promised to enforce. For Webhook payload fuzzing fixture, the reference engine rejected the bad row with "NOT NULL constraint failed: endpoints.url" — that is the message the API should have surfaced to the client instead of a success response.
The four failure modes
Invalid payloads cluster into four families, and the Webhook payload fuzzing fixture exercises all of them. Missing required fields, wrong types, out-of-range values and values outside a declared enum. Each family maps to a distinct engine error, and each family needs a distinct assertion in the test suite.
What the boundary probes look like
For Webhook payload fuzzing fixture, the range probe on deliveries.status sits one step outside the boundary. The constraint is status IN ('pending','delivered','failed') and the probe value is not_a_real_member. The engine said "CHECK constraint failed: deliveries_status_check". A test that asserts a 4xx response for this value is asserting that the constraint the schema declares is actually enforced at the edge.
The assertion you actually want
Assert on the response code and on the error body, not on the absence of a crash. For the Webhook payload fuzzing fixture, the assertion that catches a regression is a request carrying status=not_a_real_member, expecting a 4xx status and an error body that names the field. A test that only asserts "the request failed" passes even when the API fails for the wrong reason.
Where a fuzzing tool is the wrong answer
Unstructured fuzzing finds crashes, which is a different job from finding contract violations. For Webhook payload fuzzing fixture, a schema-derived negative set covers the cases a fuzzer would take hours to stumble into, and each one has a deterministic expected response. Reach for a fuzzer when the bug class is a parser crash, not when the bug class is a contract the API forgot to enforce.
| Failure class | Column | SQLSTATE | Error name | Engine message (verbatim) |
|---|---|---|---|---|
| Missing required field | endpoints.url | 23502 | not_null_violation | NOT NULL constraint failed: endpoints.url |
| Out-of-contract value | deliveries.status | 23514 | check_violation | CHECK constraint failed: deliveries_status_check |
| Dangling foreign key | deliveries.endpoint_id | 23503 | foreign_key_violation | FOREIGN KEY constraint failed |
| Table | Column | Declared rule | Probe value | Why it is invalid |
|---|---|---|---|---|
| deliveries | status | one of pending, delivered, failed | not_a_real_member | not a declared member |
| deliveries | status | one of pending, delivered, failed | PENDING | wrong case |
npx --yes @wenlu8848/schemaseed generate --input ./prob_fuzz.openapi.yaml --out ./seed --formats json --count 10 --seed 42
Download prob_fuzz.openapi.yaml
[
{
"id": "f4da9394-22be-4ce4-af70-37af1268c8f2",
"endpoint_id": {
"id": "a5ac4a54-f855-47e6-ad28-680c435aa3e1",
"url": "https://example.org/lumen/385",
"secret": "milo.lund@test.dev"
},
"payload": {},
"status": "pending"
},
{
"id": "94137986-a320-43bc-891a-9d52f69b9f75",
"endpoint_id": {
"id": "a4bae9c3-be4a-4e82-9a51-6c8bdc756084",
"url": "https://test.dev/lumen/938",
"secret": "lena.engel@example.net"
},
"payload": {},
"status": "failed"
},
{
"id": "076009bf-0220-4b80-aa70-d93c00c3522d",
"endpoint_id": {
"id": "909f0839-2de5-4d3e-a3b2-2c56be760a10",
"url": "https://test.dev/grove/190",
"secret": "Auckland, Harbor Road 29"
},
"payload": {},
"status": "pending"
},
{
"id": "640b0ab0-c9ab-42d0-b69d-c03c68149a33",
"endpoint_id": {
"id": "a4be6299-44b3-4371-9b33-0bf86e74b051",
"url": "https://test.dev/meadow/261",
"secret": "delta nimbus"
},
"payload": {},
"status": "delivered"
},
{
"id": "9e99332f-50d6-4d38-9a9f-e18c0fc10660",
"endpoint_id": {
"id": "ed5be83d-3bdd-409e-b86a-5fb359326975",
"url": "https://example.com/kelp/15",
"secret": "grove-juniper-929"
},
"payload": {},
"status": "failed"
},
{
"id": "dd4ea8da-2f93-42b9-b0e7-f3909ab92e55",
"endpoint_id": {
"id": "f0bab941-9f9c-4f08-998f-a9191e16e5a5",
"url": "https://example.net/juniper/64",
"secret": "ember-indigo-620"
},
"payload": {},
"status": "delivered"
},
{
"id": "95d49ff7-69b7-411f-8466-74a62c673569",
"endpoint_id": {
"id": "fb20eede-abd5-4ab9-8ece-0bc67f420fa8",
"url": "https://example.org/vertex/683",
"secret": "pebble-onyx-235"
},
"payload": {},
"status": "pending"
},
{
"id": "2563cb35-d17f-459f-89b6-9ccd93d55a5e",
"endpoint_id": {
"id": "bdd0340f-e9a3-439c-a58d-0a9d85697943",
"url": "https://example.com/lumen/443",
"secret": "Fay Kaur"
},
"payload": {},
"status": "delivered"
},
{
"id": "543343ad-8925-47e9-8fa2-8c058558d24e",
"endpoint_id": {
"id": "bf56c22a-c796-47ae-8c8c-5c5e1fe30ffa",
"url": "https://test.dev/kelp/234",
"secret": "Nairobi, Elm Avenue 243"
},
"payload": {},
"status": "delivered"
},
{
"id": "c827e3d8-4d6d-47c4-b765-1fa31d00b641",
"endpoint_id": {
"id": "db81256e-cc73-477d-ac70-26a345fb75f2",
"url": "https://mail.example/meadow/553",
"secret": "Iris Jansen"
},
"payload": {},
"status": "failed"
}
]
Frequently asked questions
- How many invalid cases do I actually need?
- One per constraint class, not one per field. The Webhook payload fuzzing fixture declares its rules across 2 tables and 7 columns, and the table above lists the probe value for each.
- Should I fuzz instead?
- Only for crashes. A schema-derived negative set covers every declaration in Webhook payload fuzzing fixture deterministically, with an expected response for each.
- What status code should the API return?
- Your API decides that, consistently. The generator hands you the violating value and the constraint it breaks — deliveries.status on this fixture — so the assertion can name the field.
- Do I need to write the assertions by hand?
- No. The negative instances come from the schema. For Webhook payload fuzzing fixture the first probe is deliveries.status = not_a_real_member, and the engine replied "CHECK constraint failed: deliveries_status_check".
Run it against your own schema
SchemaSeed is MIT licensed and free: unlimited local generation, no account, no telemetry and no usage limit. It reads your schema file on your own machine, so nothing is uploaded anywhere. If it saves you time, you can support the project.
Get SchemaSeed — free Support the project
Questions: support@schemaseed.drz8848.win