# Security Policy ## Supported Versions Only the latest release of SnapOtter receives security updates. We recommend always running the most recent version. | Version | Supported | |---------|-----------| | Latest release | Yes | | Previous releases | No | Self-hosted deployments should subscribe to [GitHub release notifications](https://github.com/snapotter-hq/snapotter/releases) and upgrade promptly when security patches are published. ## Reporting a Vulnerability **Do not open a public GitHub issue or pull request for security vulnerabilities.** To report a vulnerability, email **contact@snapotter.com** with: - A description of the vulnerability and its potential impact - Steps to reproduce or a proof-of-concept - The affected version(s) - Any suggested fix, if available ### Response Timeline | Stage | Timeline | |-------|----------| | Acknowledgment | Within 48 hours | | Critical severity patch | Within 7 days | | Non-critical severity patch | Within 30 days | After acknowledging your report, we will keep you informed of our progress toward a fix. Once a patch is released, we will credit you in the release notes unless you prefer to remain anonymous. ### Severity Classification | Severity | Definition | |----------|------------| | Critical | Remote code execution, authentication bypass, data exfiltration without authentication | | High | Privilege escalation, stored XSS, SQL injection, SSRF with internal network access | | Medium | CSRF, information disclosure of non-sensitive data, denial of service | | Low | Missing security headers on non-sensitive endpoints, verbose error messages | ## Security Architecture ### Authentication and Access Control - **Password hashing**: scrypt with 32-byte random salt and 64-byte derived key - **Timing-safe comparison**: All credential verification uses `crypto.timingSafeEqual` to prevent timing attacks - **Password policy**: Minimum 8 characters with uppercase, lowercase, and numeric requirements - **Session management**: Cryptographically random UUIDs, configurable expiration (`SESSION_DURATION_HOURS`), automatic cleanup of expired sessions - **Credential rotation**: Password changes invalidate all other sessions and revoke all API keys for the affected user - **Brute-force protection**: Per-endpoint rate limiting on the login route (`LOGIN_ATTEMPT_LIMIT`) - **API keys**: Hashed with scrypt (same parameters as passwords), SHA-256 prefix index for O(1) lookup, optional expiration, scoped permissions - **Role-based access control**: Hierarchical roles (admin > editor > user) with granular permissions. Escalation prevention blocks creating or promoting users above your own role. Last-admin and self-demote protections prevent lockout ### Input Validation - **Image uploads**: Magic-byte verification against a known format table, null-byte buffer detection, configurable megapixel limit (`MAX_MEGAPIXELS`), configurable upload size limit (`MAX_UPLOAD_SIZE_MB`) - **SVG sanitization**: Strips DOCTYPE declarations (XXE prevention), removes `