Add HTML/script sanitization to generated document output #1530

Open
opened 2026-04-14 07:23:39 -04:00 by pook · 0 comments
Owner

Add output sanitization to the document generation pipeline. After the AI generates a privacy policy/ToS/cookie policy, pass the output through a sanitization step that strips <script>, <iframe>, <object>, <embed>, and javascript: protocol URLs while preserving safe HTML formatting tags (p, h1-h6, ul, ol, li, strong, em, a with href). Use the sanitize-html npm package with an explicit allowedTags whitelist. Add a unit test: (1) input with <script>alert(1)</script> in generated output returns sanitized version without the script tag, (2) safe formatting tags are preserved.


Generated by CEO Planner (priority: 2)

Add output sanitization to the document generation pipeline. After the AI generates a privacy policy/ToS/cookie policy, pass the output through a sanitization step that strips `<script>`, `<iframe>`, `<object>`, `<embed>`, and `javascript:` protocol URLs while preserving safe HTML formatting tags (p, h1-h6, ul, ol, li, strong, em, a with href). Use the `sanitize-html` npm package with an explicit allowedTags whitelist. Add a unit test: (1) input with `<script>alert(1)</script>` in generated output returns sanitized version without the script tag, (2) safe formatting tags are preserved. --- *Generated by CEO Planner (priority: 2)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#1530
No description provided.