/** * Plain-text content sanitizer for community posts and comments (p8-012). * * Content model: community content is plain text. HTML is never stored. * The iOS client renders post/comment content with SwiftUI `Text()` (not a * WebView), so there is no render-time XSS surface — but we sanitize on * write as defense-in-depth against a future HTML render path. * * Strategy: strip all HTML tags and normalize whitespace. No allowlist * sanitizer is needed because no HTML survives storage at all. */ /** * Sanitize user-supplied post/comment content for storage. * * - Strips every HTML tag (opening, closing, self-closing, malformed). * - Removes HTML entities (e.g. `<` → `<`) so a double-encode trick * like `<script>` can't survive as a literal `<script>` that * a future HTML renderer would decode back to `