# stream-output-safety-v2

> stream-output-safety-v2: 5 Keryn rules for typescript, javascript, python, java, csharp (3 warning, 2 info).

Source: https://keryn.dev/rules/stream-output-safety-v2/

5 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.stream.sse-direct-llm-stream-no-filter-ts

`info` typescript, javascript stream-output-safety

LLM streaming output is sent to SSE/HTTP response without visible moderation, escaping, filtering, timeout, or cancellation.

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: [sends](https://keryn.dev/docs/edges/edge-kinds/#sends) data leaves for another party.

[CWE-79](https://keryn.dev/taxonomies/cwe/#cwe-79-cross-site-scripting) [CWE-116](https://keryn.dev/taxonomies/cwe/#cwe-116-improper-encoding-or-escaping-of-output) [CWE-770](https://keryn.dev/taxonomies/cwe/#cwe-770-allocation-of-resources-without-limits-or-throttling) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling) [LLM10](https://keryn.dev/taxonomies/owasp-llm/#llm10-unbounded-consumption) [ASI08](https://keryn.dev/taxonomies/owasp-agentic/#asi08-cascading-failures) [ASI07](https://keryn.dev/taxonomies/owasp-agentic/#asi07-insecure-inter-agent-communication) [MEASURE](https://keryn.dev/taxonomies/nist-ai-rmf/#measure-measure) [MANAGE](https://keryn.dev/taxonomies/nist-ai-rmf/#manage-manage)

## seceng.stream.websocket-direct-llm-output

`info` typescript, javascript, python, java, csharp stream-output-safety

LLM output is sent directly over WebSocket without visible filtering, escaping, or policy checks.

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: [sends](https://keryn.dev/docs/edges/edge-kinds/#sends) data leaves for another party.

[CWE-79](https://keryn.dev/taxonomies/cwe/#cwe-79-cross-site-scripting) [CWE-116](https://keryn.dev/taxonomies/cwe/#cwe-116-improper-encoding-or-escaping-of-output) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling) [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.stream-html-markdown-raw-stream

`warning` typescript, javascript, python stream-output-safety

Streaming Markdown/HTML output appears to be rendered raw or passed to client before sanitization.

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-79](https://keryn.dev/taxonomies/cwe/#cwe-79-cross-site-scripting) [LLM05](https://keryn.dev/taxonomies/owasp-llm/#llm05-improper-output-handling) [ASI05](https://keryn.dev/taxonomies/owasp-agentic/#asi05-unexpected-code-execution) [MEASURE](https://keryn.dev/taxonomies/nist-ai-rmf/#measure-measure) [MANAGE](https://keryn.dev/taxonomies/nist-ai-rmf/#manage-manage)

## seceng.stream-partial-json-command-execution

`warning` typescript, javascript, python stream-output-safety

Partial streaming JSON or tool output appears to trigger commands/actions before complete 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; 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) [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.stream-sensitive-token-leak

`warning` typescript, javascript, python, java, csharp stream-output-safety

Streaming code may emit internal tokens, tool args, prompt fragments, or reasoning/scratchpad fields.

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-200](https://keryn.dev/taxonomies/cwe/#cwe-200-exposure-of-sensitive-information-to-an-unauthorized-actor) [LLM02](https://keryn.dev/taxonomies/owasp-llm/#llm02-sensitive-information-disclosure) [LLM07](https://keryn.dev/taxonomies/owasp-llm/#llm07-system-prompt-leakage) [ASI03](https://keryn.dev/taxonomies/owasp-agentic/#asi03-identity-and-privilege-abuse) [ASI02](https://keryn.dev/taxonomies/owasp-agentic/#asi02-tool-misuse-and-exploitation) [GOVERN](https://keryn.dev/taxonomies/nist-ai-rmf/#govern-govern) [MANAGE](https://keryn.dev/taxonomies/nist-ai-rmf/#manage-manage)
