AC-013 Contract caught CS-RESP-011

A secret field appears in a response

The response does not match the contract

How to run this card's commands yourself

1. The problem

In one sentence

A property that the spec marks writeOnly (a password, for example) comes back in a response.

A story

A user registers with a name and a password. The spec says password is writeOnly: it may be sent in a request and must never come back. The server saves the user and answers with the saved record, including "password": "hunter2". The answer is logged by a proxy, cached by a CDN and kept in the browser history.

Why it hurts

A secret in a response is copied to every place that touches the response: logs, caches, monitoring, screenshots.

  • For developers: it usually happens when the whole stored object is returned instead of a response model. Fixing one endpoint is not enough: look for every place the object is serialised.
  • For managers: this is a security incident, not just a bug. Credentials or personal data may be exposed, with the clean-up and notification work that follows. Say it early and plainly.
  • For DevOps: treat a failure of this check as a stop for the release. After a fix, check logs and caches for the exposed values.

Example

The spec fragment (UserDoc):

UserDoc:
  type: object
  required: [id, name]
  properties:
    id: { type: integer }
    name: { type: string }
    password: { type: string, writeOnly: true }

The response from GET /contract-fail/cases/resp-011-writeonly-leak:

{"id": 1, "name": "Ada", "password": "hunter2"}

How to detect it without clrsig

  • curl -s URL | jq 'keys' and look for fields that should never come back.
  • Search the code for places that return a database record or an entity object directly.

How to fix it

There are two usual causes:

  1. The code is wrong (almost always). Stop returning the field, and build every response from a model that lists the fields to send. Rotate the exposed secret.
  2. The spec is wrong. The field is meant to come back. Remove writeOnly from it. Think twice: a password should not.

Never silence the check.

AC-012 An extra field in a closed schema, AC-005 A required field is missing, AC-015 Fields renamed, removed or re-cased. Failure-catalog demo: FM-044-01. See also the site’s Sensitive Data Exposure in API Responses.

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

2. How clrsig helps

Check

CS-RESP-011 writeOnly property in a response (finding write-only-property). State: caught. Severity today: failure (exit code 1).

Command

--paths limits the run to this one GET, so nothing is written:

clrsig conform specs/contract-fail.yaml \
  -b http://localhost:8080/contract-fail \
  --env clrsig/environments/contract-fail.yaml \
  --paths /cases/resp-011-writeonly-leak --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 36 operations that --paths skipped are left out by grep -v '^ SKIP'; no line is edited.

contract-fail API  1.0.0
Base URL: http://localhost:8080/contract-fail
Limited by --paths /cases/resp-011-writeonly-leak

  FAIL  GET     /cases/resp-011-writeonly-leak  200  15ms
         ✗ Error at "/password": writeOnly property "password" in response
Value:
  "***"
         → [CS-RESP-011] "password" is a write-only property but the response contains it. Why: The spec marks "password" as writeOnly: it may be sent in a request but must never come back in a response (typically a password or secret), so returning it can leak it. Where: response body, field password (spec: GET /cases/resp-011-writeonly-leak → response 200 → body schema). Fix: Stop returning "password" from the server, or remove writeOnly from it in the spec if it is meant to be returned.

FAILED  37 operations  ·  0 passed  ·  1 failed  ·  36 skipped  18ms

The output does not print the password: the value shows as ***, because the name of the field marks it as a credential (CS-RUN-011). Masking follows rules about names and shapes, so a secret in a field with an ordinary name can still be quoted when it is the value that broke the spec (CS-GAP-017). Older versions of clrsig printed the value. If you used one against real data, upgrade, check the saved reports and CI logs, and rotate any exposed secret.

How to read it: the field is password, and the spec marks it writeOnly.

Where to look

  • Desktop app: Check Conformance lists the failure. Help, What We Check lists CS-RESP-011.
  • Reports: with --format json, the finding carries "checkId": "CS-RESP-011". In this run the JSON, JUnit, HTML and Markdown reports do not contain the password either. Masking can miss a secret, so still handle reports of sensitive operations with care.
  • GitHub Action: it runs the same command; take care where the report is stored.

How clrsig helps you fix it

It names the field, says why it is dangerous and offers both fixes. It cannot find secrets that the spec does not mark writeOnly.

Limits

  • Only fields marked writeOnly in the spec are found. A secret in a field with no mark is not seen.
  • It does not know what the field holds. It only knows that the spec says it must not be sent.
  • The schema assertion in a scenario does not run this rule.

More ways

Nothing yet.

3. Video brief for Google NotebookLM

VIDEO BRIEF — AC-013 · A secret field appears in a response
Length: 5 to 7 minutes. Language: English. Audience: developers, with a line each for managers and DevOps.
One idea: a field marked writeOnly may go into the server but must never come back out; if it does, treat it as a security incident.
Open with this story: A user registers with a name and a password. The spec says the password is write-only: it may be sent in a request and must never come back. The server saves the user and answers with the saved record, including the password. The answer is logged by a proxy, cached by a CDN and kept in the browser history.
Say these facts, in this order:
1. The schema marks password as writeOnly. The response contained it.
2. A secret in a response is copied to every place that touches the response: logs, caches, monitoring, screenshots.
3. It usually happens when the whole stored object is returned instead of a response model. Look for every place the object is serialised.
4. To find it without clrsig: list the keys of the body and look for fields that should never come back, and search the code for places that return a database record directly.
5. In the output, the line with the cross says the writeOnly property password is in the response. Under Value, the password is NOT printed: it shows as three asterisks, because the name of the field marks it as a credential. The line with the arrow says why it is dangerous and gives both fixes.
6. In this run the JSON, JUnit, HTML and Markdown reports do not contain the password either. Masking follows rules about names and shapes, so a secret in a field with an ordinary name can still be quoted when it is the value that broke the spec. Handle reports of sensitive operations with care.
7. Older versions of clrsig printed the value. If you used one against real data, upgrade, check saved reports and CI logs, and rotate any exposed secret.
8. The fix is almost always in the code: build every response from a model that lists the fields to send, and rotate the exposed secret. The other cause is a wrong spec; think twice before saying a password should come back. Never silence the check.
9. For managers: this is a security incident, not just a bug.
10. For DevOps: treat a failure of this check as a stop for the release, and after the fix check logs and caches for the exposed values.
Show on screen: the UserDoc schema with writeOnly; the response body with the example password; the command (clrsig conform specs/contract-fail.yaml -b http://localhost:8080/contract-fail --env clrsig/environments/contract-fail.yaml --paths /cases/resp-011-writeonly-leak --explain); and the output block, copied exactly from the card, with the three asterisks.
Name the check: CS-RESP-011, writeOnly property in a response. Say the clrsig version: v0.21.0.
Explain these words once: writeOnly (a field that may be sent to the server but never returned); response model (a fixed list of fields that a response is built from); masking (showing asterisks instead of a value); exit code (0 clean, 1 a finding, 2 the setup or the spec is broken).
Say what clrsig does not see here: only fields marked writeOnly in the spec are found; a secret in an unmarked field is not seen; masking follows rules and can miss a secret; the schema assertion in a scenario does not run this rule.
Safety line (if a write is shown): not needed, this command sends one GET.
Finish with three recap questions:
1. What does writeOnly mean? (The field may be sent but must never come back.)
2. Does the output of this check print the password? (No, it shows three asterisks. Masking can still miss other secrets.)
3. Does clrsig find secrets in fields the spec does not mark writeOnly with this check? (No.)
Tease the next video: AC-014 · Every error answers in a different shape.
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.