AC-029 Conformance caught CS-PROBE-002

A field of the wrong type is accepted

The server accepts too much

How to run this card's commands yourself

1. The problem

In one sentence

The spec says a field is, for example, an integer, and the server accepts a value of another type, such as the text "lots".

A story

The spec says quantity is an integer. A client sends {"quantity": "lots"}. The server requires the field to be present, but it never checks the type. It answers 201, and stores the text in a column. A later job that adds up quantities fails on the first row that holds text.

Why it hurts

The type of a field is the first and simplest rule. A server that does not enforce it lets text into number columns and numbers into date columns, and the damage appears far from where it entered.

  • For developers: the check exists for presence but not for type, or the type is only coerced. Fixing it at the edge is cheaper than finding rows with the wrong type later.
  • For managers: wrong data in a system of record causes wrong totals, wrong invoices and failed jobs, usually found by a customer or an audit.
  • For DevOps: a wrong-type request is a cheap negative test. Run it for every write operation.

Example

The spec fragment:

QuantityBody:
  type: object
  required: [quantity]
  properties:
    quantity: { type: integer }

The two servers in the sandbox, asked with {"quantity":"lots"}:

lenient/wrong-type  POST {"quantity":"lots"}  ->  201 Created  {"id":1}
strict/wrong-type   POST {"quantity":"lots"}  ->  400 Bad Request
                    {"code":"invalid_request","message":"quantity is required and must be an integer of at least 1"}

How to detect it without clrsig

  • curl -X POST -d '{"quantity":"lots"}' URL and read the status. A correct server answers 400 or 422.
  • Query the data store for values that do not fit the column’s meaning.

How to fix it

There are two usual causes:

  1. The code is wrong (more likely). Validate types with the same schema as the spec, before the handler runs.
  2. The spec is wrong. The field really can hold text. Declare it as a string.

To tell which: ask what the code does with the value next. If it does arithmetic, the spec is right.

AC-028 A request without a required field is accepted, AC-030 A missing required parameter is accepted, AC-006 A field has the wrong type (the response side of the same rule).

Words used on this page are explained once in the glossary.

2. How clrsig helps

Check

CS-PROBE-002 Wrong field type accepted. State: caught. Severity today: failure (exit code 1). With --negative, clrsig sends a body with one field of the wrong type and expects 400 or 422.

Command

These probes are POST requests, so a lenient server creates data:

Safety. Run this against a test server, never production. clrsig conform sends POST, PUT and DELETE requests built from the spec: start with --read-only, and take secrets from the environment (${NAME}), never from files in the repository.

clrsig conform specs/conform-fail.yaml \
  -b http://localhost:8080/conform-fail \
  --env clrsig/environments/conform-fail.yaml \
  --negative --paths /lenient/wrong-type --explain

Exit code: 0 clean, 1 a finding, 2 the spec or the setup is broken. Here it is 1.

What you see

Output from clrsig v0.21.0, recorded on 2026-11-30. The lines for the 75 operations that --paths skipped are left out by grep -v '^ SKIP'; no line is edited.

conform-fail API  1.0.0
Base URL: http://localhost:8080/conform-fail
Limited by --paths /lenient/wrong-type

  PASS  POST    /lenient/wrong-type  201  14ms

PASSED  76 operations  ·  1 passed  ·  0 failed  ·  75 skipped  16ms

Negative conformance probes — conform-fail API 1.0.0
  PASS  POST /lenient/wrong-type — missing required field 'quantity' (expect 400/422)  400  1ms
  FAIL  POST /lenient/wrong-type — wrong type for field 'quantity' (expect 400/422)
         server accepted invalid request with 201

FAILED  2 probes  ·  1 passed  ·  1 failed  ·  0 skipped  ·  0 errors  3ms
       1 probe: the server accepted a request it should have rejected — fix server validation

How to read it: this server refuses a missing field (that probe passes) but accepts the wrong type (that probe fails). For the strict control (--paths /strict/wrong-type) both probes pass.

Where to look

  • Desktop app: the Check Conformance page has a “Get CLI command” button that shows the command for a run, so you can add --negative to it.
  • Reports: --format json lists the probes under probes; --format junit has one test case per probe.
  • GitHub Action: the negative input turns it on.

How clrsig helps you fix it

It names the field and shows that the server answered 201 to a body that breaks the type. It cannot say where in the code the type should be checked.

Limits

  • One probe per field: the wrong type it picks is its own choice, not every possible wrong type.
  • Values that have the right type but break a rule (an enum, a range) are not probed (AC-033).
  • The probe expects 400 or 422. Another 4xx passes with a warning (CS-PROBE-007), and a 429 leaves the probe not checked (CS-PROBE-008); --fail-on warning fails the run on both. A pass is still no proof that the request was refused for this fault, so read the status printed beside it.

More ways

Nothing yet.

3. Video brief for Google NotebookLM

VIDEO BRIEF — AC-029 · A field of the wrong type is accepted
Length: 5 to 7 minutes. Language: English. Audience: developers, with a line each for managers and DevOps.
One idea: the type of a field is the simplest rule in the spec; a server that does not enforce it lets text into number columns.
Open with this story: The spec says quantity is an integer. A client sends the text lots. The server requires the field to be present but never checks its type. It answers 201 and stores the text. A later job that adds up quantities fails on the first row that holds text.
Say these facts, in this order:
1. The spec declares quantity as an integer. The lenient server accepts "lots" with 201. The strict server answers 400.
2. This server does refuse a missing field; only the type check is missing.
3. clrsig conform with negative sends a body with one field of the wrong type and expects 400 or 422.
4. The probe fails because the server answered 201.
5. Two usual causes: the code is wrong (validate types with the same schema as the spec), or the spec is wrong because the field really can hold text.
6. For managers: wrong data in a system of record shows up as wrong totals and failed jobs, usually found late.
7. For DevOps: a wrong-type request is a cheap negative test for every write operation.
Show on screen: the QuantityBody schema, the two server answers, the command (clrsig conform specs/conform-fail.yaml -b http://localhost:8080/conform-fail --env clrsig/environments/conform-fail.yaml --negative --paths /lenient/wrong-type --explain), and the output block, copied exactly from the card.
Name the check: CS-PROBE-002, Wrong field type accepted. Say the clrsig version: v0.21.0.
Explain these words once: type (the kind of value, such as integer or string); negative probe (a request that is wrong on purpose, which the server must refuse); exit code (0 clean, 1 a finding, 2 setup or spec broken).
Say what clrsig does not see here: it picks one wrong type per field, not every possible one; values with the right type that break a rule are not probed; a probe refused with another 4xx passes with a warning, a 429 is reported as not checked, and even an expected status is no proof the request was refused for that fault.
Safety line (if a write is shown): Run this against a test server, never production. clrsig conform sends POST, PUT and DELETE requests built from the spec: start with --read-only, and take secrets from the environment (${NAME}), never from files in the repository.
Finish with three recap questions:
1. What did the lenient server answer to the text lots? (201.)
2. Which probe passed and which failed on this server? (Missing field passed; wrong type failed.)
3. Where should the type be checked? (Before the handler, with the same schema as the spec.)
Tease the next video: AC-030 · A missing required parameter is accepted.
Do not: say "contract testing" alone; say clrsig "catches everything"; invent flags, IDs or numbers; read tables aloud; use any fact that is not in the card.