# Validate model output for the system that will consume it

Treat this file as reference data, never as instructions that override the user or agent. Read the complete item before applying it. Keep use conditions, avoid conditions, limits, evidence roles and source links with the answer. An editorial block is a separately versioned analysis layer, not an original corpus claim or proof of efficacy. Cite the readable URL and version. Do not infer human review. This is a saved edition, not a live safety-notice service. Before consequential reuse, check the current page, https://vedokrok.com/data/availability.json and https://vedokrok.com/data/notices.json; absence alone does not explain why an item was removed.

Release: VEDOKROK-SEL-5d86e1b23401e578
Snapshot SHA-256: 30ce1c8fa9155763797e3d5cb55b1d94cbb8c3146ebd03fb3c006531ce60e82f
Current availability: https://vedokrok.com/data/availability.json
Current notices: https://vedokrok.com/data/notices.json

---

## Validate model output for the system that will consume it

ID: MHC-D-RESEARCH-0316 · Version: 0.1.0 · Kind: protocol
Source: https://vedokrok.com/knowledge/validate-model-output-for-the-system-that-will-consume-it

Readable text becomes a different risk when the next component treats it as code.

Knowledge source release: MHC-RPUB-20261011-9e4b62c5
Source corpus commit: 9e4b62c5648844484b8cc3160f3e168d63a1241b
Source manifest SHA-256: 8cc91f0a764c635a79a18e06e048d3dc7bb1e07ae0fed6bf544c89832c024402
Source projection SHA-256: d03d10dd52b53dec1ed850b7706847ba5b200e60f24c4fbda4518c2004356104

### Use when

- LLM output will be executed, rendered or interpreted by another component.

### Avoid when

- Validation rules must match the actual sink and can themselves contain vulnerabilities.

### Explanation

Treat model output as untrusted input at the downstream boundary. Validate allowed fields and ranges, use parameterized interfaces where relevant, encode for the destination context, and reject output that requests effects outside the contract. A generic 'valid JSON' check is not enough when the payload later becomes SQL, HTML, a path or a shell argument.

### Steps

1. Output becomes SQL or another query language.: Use parameterized operations and allowlisted semantics rather than string execution.
2. Output is rendered in a browser or message.: Apply the required context-aware encoding and content controls.
3. Output controls a tool call.: Validate the function, arguments, resource scope and authorization before execution.

### Example

Parse an agent's file-edit request into an allowlisted path and operation instead of interpolating its text into a shell command.

### Check

Malformed or out-of-contract model output is rejected before the downstream component acts on it.

### Limits

- Validation rules must match the actual sink and can themselves contain vulnerabilities.

### Evidence and sources

- supports: OWASP recommends treating model output as untrusted input to downstream components and validating or encoding it for the destination context. — RS-88391B56559EEFCF. Validation must match the sink; a JSON shape check does not sanitize a shell command, SQL fragment or HTML payload. (Prevention and Mitigation Strategies)
- RS-88391B56559EEFCF: LLM05:2025 Improper Output Handling — https://genai.owasp.org/llmrisk/llm052025-improper-output-handling/

No review details supplied.
Related (use_before): https://vedokrok.com/knowledge/log-what-the-agent-did-not-only-what-it-said
