PR: #462: feat(agents): lock the safe agent-output renderer [Story-1828] by @ankitmaheshwari-com
View PR →
Story-1828 · app lane · RFD-SEC-001 D5 · security hardening

Lock the safe agent-output renderer

The agent brain is a trust boundary. An agent turn can carry an <img> tracking pixel, an external link, raw HTML, or a <script>. The renderer is safe today — renderAtlasMarkdown is a dependency-free whitelist that builds React nodes and never touches a raw-HTML sink. This story locks that invariant so the planned "rich-markdown" swap cannot silently re-open <img>/link exfiltration. A gate, not a ban.

What changed

The sanitizer contract

Allowed (whitelist)Forbidden (raw-HTML sink)
Bold, italic, paragraphs, line breaksdangerouslySetInnerHTML
Lists, tables, blockquotes, coderehype-raw
Links neutralized to inert text/chipMarkdown lib with no allowlist sanitizer
—Auto-fetch <img>, <script>, <iframe>

Verification

Files changed

6 file(s), +231 / -0 lines

Path Role + -
.github/workflows/ci.ymlWorkflow+7-0
docs/build-doctrine/agent-output-rendering.mdDocumentation+59-0
package.jsonConfig+1-0
scripts/check-render-safety.mjsScript+101-0
src/components/add-matter/step5-review/render-atlas-markdown.test.tsxComponent+58-0
src/components/add-matter/step5-review/render-atlas-markdown.tsxComponent+5-0