llm05-output-to-html
4 rules · Keryn Software Licence · rules 0.8.0 · all packs
How to read a rule
- Severity
- How bad the finding is if it is real:
errorfails a default gate,warningandinfodo 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.llm05.react-dangerously-set-inner-html
Section titled “seceng.llm05.react-dangerously-set-inner-html”warning javascript, typescript react
Model-controlled, retrieved, or tool-controlled content may be rendered through dangerouslySetInnerHTML. Confirm whether the source is trusted and sanitized.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
Fix: Render untrusted output as React text children. If rich HTML is required, pass it through a maintained HTML sanitizer before assigning it to dangerouslySetInnerHTML.
References: https://react.dev/reference/react-dom/components/common#dangerously-setting-the-inner-html
Also reported under the older id seceng.react.ai-dangerously-set-inner-html.
seceng.llm05.inner-html-assignment
Section titled “seceng.llm05.inner-html-assignment”warning javascript, typescript llm05-output-to-html
Assignment to innerHTML or outerHTML may render model, retrieved, or tool output as executable HTML. Confirm sanitizer use and source trust.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
Fix: Use textContent for plain text. If rich HTML is required, sanitize it before assigning it to innerHTML or outerHTML.
References: https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML#security_considerations
seceng.llm05.marked-html-enabled
Section titled “seceng.llm05.marked-html-enabled”warning javascript, typescript llm05-output-to-html
Markdown rendering appears to allow raw HTML. If model or retrieved content reaches this renderer, this can become XSS.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: writes one thing writes to another.
Fix: Sanitize the HTML produced by Marked before inserting it into the document. Apply the sanitizer after Markdown rendering so it also checks the markup emitted by the renderer.
References: https://marked.js.org/#usage
seceng.llm05.vue-v-html
Section titled “seceng.llm05.vue-v-html”warning generic llm05-output-to-html
Vue v-html renders raw HTML. Confirm model, retrieved, or tool output cannot reach this sink without sanitization.
Confidence P1: dangerous in context. False-positive risk high: it finds a lead to confirm, so expect benign hits.
Edge inspected: calls one thing invokes another.
Fix: Render untrusted output with Vue text interpolation. If rich HTML is required, sanitize it before passing it to v-html.
References: https://vuejs.org/guide/best-practices/security.html#html-injection