1. The problem
In one sentence
The server checks that fields are present and have the right type, but not the rules in the schema: a value outside an enum, a number over its maximum, or a field the schema does not allow.
A story
The spec says level is low or high, and percent is at most 100. The server checks only that level is a string and percent is an integer. A client sends {"level":"extreme","percent":5000}. The server answers 201. Later code that looks up a price by level finds nothing for extreme, and a progress bar shows 5000 percent.
A second case: the schema is closed (additionalProperties: false). A client sends {"name":"Ada","isAdmin":true}. The server accepts the extra field and may even store it.
Why it hurts
Enums, ranges and closed schemas are the business rules in the spec. A server that ignores them lets through values that every later part of the system assumes cannot exist. An unknown field that is accepted can become a way to set something the client was never meant to set (for example a role flag).
- For developers: type checks are easy and common; rule checks are skipped when validation is written by hand. Mass assignment (copying every field of a body into an object) turns unknown fields into a security problem.
- For managers: invalid states in the data, and in the worst case, a way for a user to change fields they should not. The cost is bad data and, sometimes, a security incident.
- For DevOps: negative tests for rules are cheap to write and rarely exist. Add them for operations that change data.
Example
The spec fragments:
LevelBody:
type: object
required: [level, percent]
properties:
level: { type: string, enum: [low, high] }
percent: { type: integer, minimum: 0, maximum: 100 }
ClosedBody:
type: object
additionalProperties: false
required: [name]
properties:
name: { type: string, minLength: 1 }
The lenient and strict servers in the sandbox, asked with {"level":"extreme","percent":5000} and with {"name":"Ada","isAdmin":true}:
lenient enum and range -> 201 Created
strict enum and range -> 400 Bad Request
lenient unknown field -> 201 Created
strict unknown field -> 400 Bad Request
How to detect it without clrsig
- Send a value just outside each rule with
curl -X POST -d '…' URL, and an extra field. A correct server answers400or422. - Read the handler: does it validate with the schema, or only look at types?
How to fix it
There are two usual causes:
- The code is wrong (more likely). Validate the whole body against the schema from the spec, including enums, ranges and
additionalProperties. Never copy a request body straight into a stored object. - The spec is wrong. The rule is not real (any level is fine). Relax it in the spec.
To tell which: ask whether later code relies on the rule. If it does, the server must enforce it.
Related problems
AC-028 A request without a required field is accepted, AC-029 A field of the wrong type is accepted, AC-007 A value breaks a rule in the schema (the response side). Failure-catalog demo: FM-022-06 (a case-insensitive enum accepted).
Words used on this page are explained once in the glossary.
2. How clrsig helps
Check
No built-in check: this is a known gap, CS-GAP-009, and the state is not caught. The negative probes send four kinds of bad request: a missing required field, a wrong type, a missing parameter or header, and missing credentials. They do not send enum violations, boundary values or unknown fields. The reliable answer is a scenario that sends the value and asserts a 400.
Command
First, what the negative probes say. These probes are POST requests, so a lenient server creates data:
Safety. Run this against a test server, never production.
clrsig conformsendsPOST,PUTandDELETErequests 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/enum-and-boundary --explain
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/enum-and-boundary
PASS POST /lenient/enum-and-boundary 201 15ms
PASSED 76 operations · 1 passed · 0 failed · 75 skipped 17ms
Negative conformance probes — conform-fail API 1.0.0
PASS POST /lenient/enum-and-boundary — missing required field 'level' (expect 400/422) 400 2ms
PASS POST /lenient/enum-and-boundary — missing required field 'percent' (expect 400/422) 400 1ms
PASS POST /lenient/enum-and-boundary — wrong type for field 'level' (expect 400/422) 400 1ms
PASS POST /lenient/enum-and-boundary — wrong type for field 'percent' (expect 400/422) 400 2ms
PASSED 4 probes · 4 passed · 0 failed · 0 skipped · 0 errors 7ms
All four probes pass (exit code 0). The server is lenient about the rules, and no probe tries a value outside them.
Now the scenario that does. Save it as loose-validation.yaml. It sends four POST requests:
schemaVersion: "1"
title: values outside the rules are refused
steps:
- label: lenient route, level outside the enum and percent over the maximum
request:
method: POST
url: "{{baseUrl}}/lenient/enum-and-boundary"
body: { type: json, content: '{"level":"extreme","percent":5000}' }
assertions:
- { type: status, operator: eq, expected: 400 }
failPolicy: continue
- label: strict route, level outside the enum and percent over the maximum
request:
method: POST
url: "{{baseUrl}}/strict/enum-and-boundary"
body: { type: json, content: '{"level":"extreme","percent":5000}' }
assertions:
- { type: status, operator: eq, expected: 400 }
failPolicy: continue
- label: lenient route, a field the closed schema does not allow
request:
method: POST
url: "{{baseUrl}}/lenient/unknown-fields"
body: { type: json, content: '{"name":"Ada","isAdmin":true}' }
assertions:
- { type: status, operator: eq, expected: 400 }
failPolicy: continue
- label: strict route, a field the closed schema does not allow
request:
method: POST
url: "{{baseUrl}}/strict/unknown-fields"
body: { type: json, content: '{"name":"Ada","isAdmin":true}' }
assertions:
- { type: status, operator: eq, expected: 400 }
failPolicy: continue
clrsig run loose-validation.yaml \
--env clrsig/environments/conform-fail.yaml \
--spec specs/conform-fail.yaml
Exit code: 0 all steps pass, 1 a step failed, 2 the scenario or the setup is broken. Here it is 1.
What you see
Output from clrsig v0.21.0, recorded on 2026-11-30:
Scenario: values outside the rules are refused
FAIL lenient route, level outside the enum and percent over the maximum 201 13ms
✗ status eq 400: expected "400"; got "201"
PASS strict route, level outside the enum and percent over the maximum 400 2ms
✓ status eq 400
FAIL lenient route, a field the closed schema does not allow 201 1ms
✗ status eq 400: expected "400"; got "201"
PASS strict route, a field the closed schema does not allow 400 3ms
✓ status eq 400
FAILED 2 passed, 2 failed, 0 skipped (2/4 assertions passed) 27ms
How to read it: the two lenient steps fail because the server answered 201 to a value outside the rules and to an unknown field. The two strict steps pass.
Where to look
- Desktop app: open the scenario and run it; each step shows its assertion result.
- Reports:
--format jsonandjunitonclrsig runlist the failed assertions. - GitHub Action: use
command: runwith thescenario,envandspecinputs;specreplaces the scenario’sspecFile. Older releases of the Action ignoredspecwithrun; if you use one, addspecFile: specs/conform-fail.yamlto the scenario instead (the path is relative to the scenario file) (setup and upgrading).
How clrsig helps you fix it
The failed steps name exactly which rule and which route. They do not say why the server accepts the value. Add one step per rule you care about.
Limits
- This is a known gap: the built-in probes do not send enum violations, boundary values or unknown fields. You write each case.
- A step with a fixed bad value tests one case. For a range, test the edges: the last valid value and the first invalid one.
More ways
Nothing yet.
3. Video brief for Google NotebookLM
VIDEO BRIEF — AC-033 · Loose validation: values outside the rules and unknown fields are accepted
Length: 5 to 7 minutes. Language: English. Audience: developers, with a line each for managers and DevOps.
One idea: the rules in the schema are the business rules; a server that checks only presence and type lets invalid states into your data.
Open with this story: The spec says level is low or high, and percent is at most 100. The server checks only that level is a string and percent is an integer. A client sends level extreme and percent 5000. The server answers 201. Later code that looks up a price by level finds nothing, and a progress bar shows 5000 percent.
Say these facts, in this order:
1. The lenient server accepts a value outside an enum and a number over its maximum, and a field the closed schema does not allow.
2. The strict server refuses all three with 400.
3. An accepted unknown field can become mass assignment: a way to set something the client was never meant to set, such as a role flag.
4. The built-in negative probes send four kinds of bad request and do not send enum violations, boundary values or unknown fields, so all four probes pass here; this is a known gap, CS-GAP-009.
5. The reliable answer is a scenario that sends the value and asserts a 400. Two of four steps fail on the lenient server.
6. Two usual causes: the code validates only types and presence (validate the whole body against the schema), or the spec is wrong and the rule is not real.
7. For managers: invalid states in the data, and sometimes a way for a user to change fields they should not.
8. For DevOps: add negative tests for rules to operations that change data; test the edges of a range.
Show on screen: the two schemas, the four server answers, the scenario YAML, the commands (the negative conform run and clrsig run loose-validation.yaml --env clrsig/environments/conform-fail.yaml --spec specs/conform-fail.yaml), and the two output blocks, copied exactly from the card.
Name the check: none built in; this is the known gap CS-GAP-009. Say the clrsig version: v0.21.0.
Explain these words once: enum (a fixed list of allowed values); closed schema (a schema that forbids fields it does not list); mass assignment (copying every field of a request into a stored object); negative probe (a request that is wrong on purpose, which the server must refuse); scenario (a script of steps with your own checks, called assertions); exit code (0 clean, 1 a finding, 2 setup or spec broken).
Say what clrsig does not see here: the built-in probes do not send enum violations, boundary values or unknown fields; you write each case as a scenario step.
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. Name two rules a type check does not enforce. (An enum and a range, or a closed schema.)
2. Why is an accepted unknown field a security risk? (It can set something the client should not set.)
3. What is the recommended check for this gap? (A scenario that sends the value and asserts a 400.)
Tease the next video: AC-034 · The wrong HTTP status for a business error.
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.