# response-schema-validation-v2

> response-schema-validation-v2: 7 Keryn rules for typescript, javascript, python, java, csharp (6 warning, 1 info).

Source: https://keryn.dev/rules/response-schema-validation-v2/

7 rules · Keryn Software Licence · rules 0.8.0 · [all packs](https://keryn.dev/rules/)

**How to read a rule**

- **Severity**: How bad the finding is if it is real: `error` fails a default gate, `warning` and `info` do not.

- **Confidence**: **P0** exploitable as written; **P1** dangerous in context; **P2** a heuristic or a posture check: confirm by reading the code.

- **False-positive risk**: **low**: an exact API or flag, so hits are almost always real; **medium**: the pattern is legitimate in many programs, so check each hit; **high**: it finds a lead to confirm, so expect benign hits.

- **Edge**: The relationship the finding sits on. **reaches**: content or traffic gets to a thing; **calls**: one thing invokes another; **reads**: one thing reads from another; **writes**: one thing writes to another; **sends**: data leaves for another party; **grants**: authority is given or left unchecked; **depends_on**: something relies on a component it does not verify; **trusts**: one party believes another without evidence. The boundary it crosses, when there is one: **user->prompt** (untrusted input reaching a prompt); **model->code** (model output reaching code, a shell, a query or a page); **secret->outside** (a secret leaving the trusted side); **supply-chain** (code, models or prompts pulled in from outside).

- **Taxonomy chips**: References for readers who work in OWASP LLM 2025, OWASP Agentic, CWE or NIST AI RMF. They say where a rule belongs, not that a framework is satisfied.

## seceng.schema.model-json-parse-without-validation-ts

`warning` typescript, javascript response-schema-validation

Model response is parsed as JSON and trusted without visible Zod/JSON Schema validation.

Confidence **P2**: a heuristic or a posture check: confirm by reading the code. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [reads](https://keryn.dev/docs/edges/edge-kinds/#reads) one thing reads from another.

[CWE-20](https://keryn.dev/taxonomies/cwe/#cwe-20-improper-input-validation) [CWE-915](https://keryn.dev/taxonomies/cwe/#cwe-915) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [LLM09](https://keryn.dev/taxonomies/owasp-llm/#llm09-misinformation) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation) [ASI09](https://keryn.dev/taxonomies/owasp-agentic/#asi09-human-agent-trust-exploitation) [MEASURE](https://keryn.dev/taxonomies/nist-ai-rmf/#measure-measure) [MANAGE](https://keryn.dev/taxonomies/nist-ai-rmf/#manage-manage)

## seceng.schema.model-json-parse-without-validation-python

`warning` python response-schema-validation

Model response is parsed as JSON and trusted without visible Pydantic/JSON Schema validation.

Confidence **P2**: a heuristic or a posture check: confirm by reading the code. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [reads](https://keryn.dev/docs/edges/edge-kinds/#reads) one thing reads from another.

[CWE-20](https://keryn.dev/taxonomies/cwe/#cwe-20-improper-input-validation) [CWE-915](https://keryn.dev/taxonomies/cwe/#cwe-915) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [LLM09](https://keryn.dev/taxonomies/owasp-llm/#llm09-misinformation) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation) [ASI09](https://keryn.dev/taxonomies/owasp-agentic/#asi09-human-agent-trust-exploitation) [MEASURE](https://keryn.dev/taxonomies/nist-ai-rmf/#measure-measure) [MANAGE](https://keryn.dev/taxonomies/nist-ai-rmf/#manage-manage)

## seceng.schema-model-output-controls-orm-filter

`warning` typescript, javascript, python response-schema-validation

Model-generated JSON controls ORM or database filter without visible allowlist/schema validation.

Confidence **P2**: a heuristic or a posture check: confirm by reading the code. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another.

[CWE-20](https://keryn.dev/taxonomies/cwe/#cwe-20-improper-input-validation) [CWE-639](https://keryn.dev/taxonomies/cwe/#cwe-639-authorization-bypass-through-user-controlled-key) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [LLM08](https://keryn.dev/taxonomies/owasp-llm/#llm08-vector-and-embedding-weaknesses) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation) [ASI06](https://keryn.dev/taxonomies/owasp-agentic/#asi06-memory-and-context-poisoning) [MEASURE](https://keryn.dev/taxonomies/nist-ai-rmf/#measure-measure) [MANAGE](https://keryn.dev/taxonomies/nist-ai-rmf/#manage-manage)

## seceng.schema-model-output-controls-action

`warning` typescript, javascript, python github-actions

Model-generated JSON controls action name, command, route, tool, or workflow transition without visible enum/schema validation.

Confidence **P2**: a heuristic or a posture check: confirm by reading the code. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another.

[CWE-20](https://keryn.dev/taxonomies/cwe/#cwe-20-improper-input-validation) [CWE-1426](https://keryn.dev/rules/?cwe=CWE-1426) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling) [ASI05](https://keryn.dev/taxonomies/owasp-agentic/#asi05-unexpected-code-execution) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation) [MEASURE](https://keryn.dev/taxonomies/nist-ai-rmf/#measure-measure) [MANAGE](https://keryn.dev/taxonomies/nist-ai-rmf/#manage-manage)

## seceng.schema-openai-json-mode-without-schema

`info` typescript, javascript, python openai

OpenAI JSON mode or json\_object response format is used without a strict schema validation layer.

Confidence **P2**: a heuristic or a posture check: confirm by reading the code. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [trusts](https://keryn.dev/docs/edges/edge-kinds/#trusts) one party believes another without evidence.

[CWE-20](https://keryn.dev/taxonomies/cwe/#cwe-20-improper-input-validation) [LLM09](https://keryn.dev/taxonomies/owasp-llm/#llm09-misinformation) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling) [ASI09](https://keryn.dev/taxonomies/owasp-agentic/#asi09-human-agent-trust-exploitation) [MEASURE](https://keryn.dev/taxonomies/nist-ai-rmf/#measure-measure)

## seceng.schema-structured-output-non-strict

`warning` typescript, javascript, python response-schema-validation

Structured output schema appears to allow additional properties or non-strict parsing for model-controlled data.

Confidence **P2**: a heuristic or a posture check: confirm by reading the code. False-positive risk **medium**: the pattern is legitimate in many programs, so check each hit.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another; it crosses the [`model->code`](https://keryn.dev/docs/edges/trust-boundaries/#model-to-code) boundary (model output reaching code, a shell, a query or a page).

[CWE-20](https://keryn.dev/taxonomies/cwe/#cwe-20-improper-input-validation) [LLM06](https://keryn.dev/taxonomies/owasp-llm/#llm06-excessive-agency) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation) [MEASURE](https://keryn.dev/taxonomies/nist-ai-rmf/#measure-measure)

## seceng.schema-model-score-controls-security-decision

`warning` typescript, javascript, python, java, csharp response-schema-validation

Model-generated score/classification appears to control security, fraud, access, compliance, or approval decision without visible deterministic policy gate.

Confidence **P1**: dangerous in context. False-positive risk **high**: it finds a lead to confirm, so expect benign hits.

Edge inspected: [calls](https://keryn.dev/docs/edges/edge-kinds/#calls) one thing invokes another.

[CWE-20](https://keryn.dev/taxonomies/cwe/#cwe-20-improper-input-validation) [CWE-285](https://keryn.dev/rules/?cwe=CWE-285) [LLM09](https://keryn.dev/taxonomies/owasp-llm/#llm09-misinformation) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation) [ASI09](https://keryn.dev/taxonomies/owasp-agentic/#asi09-human-agent-trust-exploitation) [MEASURE](https://keryn.dev/taxonomies/nist-ai-rmf/#measure-measure) [MANAGE](https://keryn.dev/taxonomies/nist-ai-rmf/#manage-manage)
