# Security Policy ## Supported Versions Use this section to tell people about which versions of Wiki-Go are currently being supported with security updates. | Version | Supported | | ------- | ------------------ | | latest | :white_check_mark: | ## Reporting a Vulnerability We take the security of Wiki-Go seriously. If you believe you've found a security vulnerability, please follow these steps: 1. **Do not disclose the vulnerability publicly** or on the public issue tracker. 2. Submit your findings through our [contact form](https://leomoon.com/contact). 3. Allow time for us to review and address the vulnerability before any public disclosure. 4. We'll respond as quickly as possible to acknowledge receipt of your report. ## Security Features Wiki-Go includes several security features: - **Password Storage**: All passwords are hashed using bcrypt with appropriate cost factors. - **Authentication**: Session-based authentication with secure, HTTP-only cookies and hashed token persistence. - **TLS Support**: Built-in TLS support for encrypted connections. - **Role-Based Access Control**: Fine-grained permissions through admin, editor, and viewer roles. - **Path-Based Access Rules**: Granular document access control using glob patterns, access levels, and group membership. - **Safe Markdown Rendering**: User-authored inline HTML, CSS, and JavaScript are not supported in Markdown documents or comments. - **Trusted Markdown Extensions**: Wiki-Go extensions render through typed components that escape text, normalize identifiers, and validate URLs before producing markup. - **SVG Upload Protection**: SVG uploads are parsed through a strict XML allowlist even when general MIME checking is disabled. - **Content Security Policy**: Wiki-Go enforces a restrictive page policy that allows scripts only from approved application sources and blocks inline script handlers. - **File Upload Validation**: MIME type checking protects uploaded files, with SVG safety checks remaining mandatory when general MIME checking is disabled. - **Private Wiki Mode**: Option to require authentication for all pages. - **Login Rate Limiting**: Built-in protection against brute force attacks by temporarily banning IP addresses after multiple failed login attempts, with exponential backoff. - **Session Revocation**: Security-sensitive account changes revoke the affected user's active sessions in memory and persistent storage. - **Trusted Proxy Boundary**: Forwarded client IP headers are ignored unless the direct proxy is explicitly trusted. - **Log Record Integrity**: Control characters from untrusted values are escaped at the centralized logging boundary so one logging call cannot forge additional records or terminal output. ## Security Logging Wiki-Go formats log messages and neutralizes carriage returns, newlines, Unicode line separators, and terminal control characters before writing each record. This boundary applies consistently to debug, informational, warning, error, and fatal logs, including formatted and wrapped errors. Centralized neutralization protects log structure, but it does not make secrets safe to log. Callers must never include passwords, session tokens or token hashes, cookies, authorization headers, API keys, uploaded file contents, or other credential material in log messages. Non-secret request paths, usernames, filenames, network errors, and configuration values may be logged when operationally useful because control characters are escaped at the logging boundary. ## Markdown and Content Rendering Security Wiki-Go treats Markdown as content rather than executable page markup. User-authored inline HTML, CSS, and JavaScript in Markdown documents and comments are unsupported and are not rendered as active application content. Raw HTML is omitted or displayed inertly instead of being passed through to the browser. This restriction applies consistently to normal document pages, the editor preview, version-history previews, home-page content, comments, kanban documents, and links documents. ### Trusted Wiki-Go Extensions Wiki-Go's built-in Markdown extensions do not depend on user-provided raw HTML. Supported features are parsed into trusted, typed nodes or escaped templates controlled by Wiki-Go. These rendering boundaries provide the following protections: - Element and attribute names are selected by Wiki-Go rather than supplied by Markdown authors. - User-controlled text is HTML-escaped before insertion into trusted output. - Identifiers and CSS class tokens generated from content are normalized. - Links and media destinations are restricted to validated local URLs or approved URL schemes. - Missing internal document and attachment links retain their visual `notfound` indicator through a trusted renderer. - Render-specific state is isolated so concurrent document rendering does not share placeholder content. Supported Markdown and Wiki-Go extensions remain available, including tables, task lists, code blocks, GitHub-style admonitions, Mermaid diagrams, kanban boards, links pages, wiki links, attachments, details blocks, infoboxes, highlighting, superscript, subscript, table-of-contents generation, heading anchors, supported media embeds, and Wiki-Go custom tags. ### Defense in Depth The safe Markdown boundary is reinforced by an enforcing Content Security Policy. Application scripts are loaded from approved sources, inline event handlers are blocked, and embedded objects are disabled. SVG files receive separate upload and serving protections. Uploaded SVG content is parsed using a minimal allowlist that excludes executable or externally loaded content, and SVG responses use restrictive security headers. Administrators upgrading from an earlier release should review documents that contain custom HTML, `