# πŸ” Security Policy **ThemisDB Security Team** [![Security Score](https://img.shields.io/badge/security-A+-green)](https://github.com/makr-code/ThemisDB/security) [![Gitleaks](https://img.shields.io/badge/Gitleaks-enabled-blue)](https://github.com/gitleaks/gitleaks) [![Responsible Disclosure](https://img.shields.io/badge/disclosure-responsible-orange)](https://github.com/makr-code/ThemisDB/security/policy)
--- ## πŸ“‹ Supported Versions > [!IMPORTANT] > ThemisDB is actively maintained. Security updates are provided for supported versions only. | Version | Status | Security Updates | End of Life | |---------|:------:|:----------------:|:-----------:| | **1.x** | βœ… Active | βœ… Yes | TBD | | **0.9.x** | βœ… Maintenance | βœ… Yes | 2026-12-31 | | **< 0.9** | ❌ Unsupported | ❌ No | 2024-01-01 | --- ## 🚨 Reporting a Vulnerability > We take security vulnerabilities **seriously**. If you discover a security issue, please follow our responsible disclosure process. ### ❌ Do NOT > [!CAUTION] > **Never do these things:** > - ❌ Open a public GitHub issue for security vulnerabilities > - ❌ Discuss the vulnerability publicly before it's addressed > - ❌ Exploit the vulnerability beyond demonstration purposes ### βœ… Do
1️⃣ Report via GitHub Security Advisories (Recommended) 1. Go to [Security Advisories](https://github.com/makr-code/ThemisDB/security/advisories/new) 2. Create a new **private** security advisory 3. Include: - πŸ“ **Description** of the vulnerability - πŸ”„ **Steps to reproduce** the issue - πŸ’₯ **Potential impact** assessment - πŸ› οΈ **Suggested fixes** (optional)
2️⃣ Use Responsible Disclosure - ⏳ Give us **reasonable time** to address the issue - 🀐 No public disclosure before fix is released - 🀝 Coordinate disclosure timeline with security team
3️⃣ Provide Sufficient Detail Help us reproduce and verify the issue: - πŸ–₯️ Environment details (OS, version, configuration) - πŸ“Š Proof-of-concept (PoC) code or steps - πŸ“Έ Screenshots or logs (if applicable)
### Response Timeline | Timeframe | Action | Status | |-----------|--------|:------:| | **Within 24 hours** | Acknowledgment of your report | πŸ“¨ | | **Within 72 hours** | Initial assessment & severity classification | πŸ” | | **7-14 days** | Detailed response with remediation plan | πŸ“‹ | | **30-90 days** | Fix released (depending on severity/complexity) | πŸš€ | > [!NOTE] > **Critical vulnerabilities** are prioritized and may receive expedited fixes within **7 days**. --- ## πŸ›‘οΈ Security Measures ThemisDB implements **defense-in-depth** security across all layers:
πŸ”‘ Authentication & Authorization - βœ… **RBAC** (Role-Based Access Control) with 4-tier hierarchy - βœ… **mTLS** (Mutual TLS) for client authentication - βœ… **Token-based API** authentication - βœ… **HashiCorp Vault** integration for secrets management **Security Level:** ⭐⭐⭐⭐⭐
🌐 Network Protocol Security (v1.3.0+) | Protocol | Security Features | TLS Version | |----------|------------------|:-----------:| | **HTTP/2** | Server Push, TLS 1.3 required | 1.3+ | | **WebSocket** | WSS (WebSocket Secure) | 1.2+ | | **MQTT** | TLS/mTLS support, auth required | 1.2+ | | **PostgreSQL Wire** | SSL/TLS encryption, RBAC | 1.2+ | | **MCP Server** | Transport security (stdio/SSE/WS) | 1.2+ | > [!IMPORTANT] > All protocols require **explicit opt-in** build switches for production readiness.
πŸ”’ Encryption **Data-at-Rest:** - πŸ” **AES-256-GCM** encryption - πŸ—„οΈ **Field-Level Encryption** (schema-based selective encryption) - πŸ”‘ **Key Management:** HSM (PKCS#11), Vault, or Mock providers **Data-in-Transit:** - 🌐 **TLS 1.3** (with TLS 1.2 fallback) - πŸ”— **Perfect Forward Secrecy** (PFS) - πŸ“œ **Certificate pinning** for HSM/TSA **πŸ›‘οΈ Security Hardening (v1.4.2+):** > [!WARNING] > **NEW: HSM Stub Provider Gating** > - ⚠️ Requires explicit opt-in via `THEMIS_ALLOW_HSM_STUB=1` > - ❌ Fails in production mode (`THEMIS_PRODUCTION_MODE=1`) > - πŸ” Auto-detects production environments (`ENVIRONMENT=production`) > - πŸ“‹ See: [HSM Production Setup](docs/security/HSM_PRODUCTION_SETUP.md) > [!NOTE] > **VaultSigningProvider Limitation** > - βœ… Signing operations only (Transit Engine) > - ❌ Key management operations throw clear errors > - πŸ“– Migration path: Use `VaultKeyProvider` for full key management > - πŸ“‹ See: [Vault Signing Provider](docs/security/VAULT_SIGNING_PROVIDER.md) > [!TIP] > **PKCS#11 Integration Strategy** > - πŸ“ Development: `pkcs11_minimal.h` (built-in, limited) > - 🏭 Production: Vendor PKCS#11 headers (required) > - βœ… Compile-time validation for header compatibility > - πŸ“‹ See: [PKCS#11 Integration](docs/security/PKCS11_INTEGRATION.md)
βœ… Input Validation - πŸ“‹ **JSON Schema** validation - πŸ’‰ **AQL injection** prevention - 🚫 **Path traversal** protection - πŸ“¦ **Request body size limits** (10MB default) - πŸ” **BPMN/EPK/YAML parser hardening** (`src/process/`) β€” regex-based BPMN parser rejects malformed XML; EPK and VCC-VPB parsers validate schema before import
🚦 Rate Limiting & DoS Protection - ⏱️ **Token bucket algorithm** (100 req/min default) - 🌍 **Per-IP rate limiting** - πŸ‘€ **Per-user rate limiting** - βš™οΈ **Configurable thresholds**
πŸ“Š Audit & Compliance **Audit Logging:** - πŸ“ **65+ security event types** - πŸ” **Encrypt-then-Sign** audit logs - πŸ”— **Hash chain** for tamper detection - πŸ”” **SIEM integration** (Syslog RFC 5424, Splunk HEC) - πŸ—‚οΈ **Maintenance operations** (`src/maintenance/`) β€” all schedule CRUD and job lifecycle events logged via `AuditLogger`; RBAC roles `maintenance:read`, `maintenance:write`, `maintenance:admin` **Compliance Ready:** - βœ… GDPR/DSGVO - βœ… eIDAS - βœ… SOC 2 - βœ… HIPAA
--- ## πŸ”’ Security Hardening > [!IMPORTANT] > For production deployments, start with the **[Security Posture Guide](docs/production/SECURITY_POSTURE.md)** β€” it explicitly lists every insecure default, why it is unsafe, and the exact environment variable to change it. > Then follow the **[Production Runbook](docs/production/RUNBOOKS/CORE_MODULE_RUNBOOK.md)** for the full reference of required and optional environment variables, startup sequence, and failure-mode mitigations. ### Hardening Checklist | Step | Action | Priority | |:----:|--------|:--------:| | 1️⃣ | Set `THEMIS_PRODUCTION_MODE=1` and `THEMIS_ENVIRONMENT=production` | πŸ”΄ Critical | | 2️⃣ | Set `THEMIS_TOKEN_ADMIN` to a strong random secret (β‰₯32 bytes) | πŸ”΄ Critical | | 3️⃣ | Enable TLS with strong cipher suites | πŸ”΄ Critical | | 4️⃣ | Configure RBAC with least-privilege principle | πŸ”΄ Critical | | 5️⃣ | Use external key management: Vault or hardware HSM | 🟑 High | | 6️⃣ | Enable audit logging with encryption and SIEM sink | 🟑 High | | 7️⃣ | Enable WAL gRPC mTLS (`THEMIS_WAL_GRPC_ENABLE_MTLS=1`) | 🟑 High | | 8️⃣ | Configure rate limiting appropriately | 🟒 Medium | | 9️⃣ | Set up monitoring and alerting | 🟒 Medium | | πŸ”Ÿ | Regular security updates and patching | πŸ”΄ Critical | --- ## πŸ“š Security Documentation
⭐ Production Security (Start Here) - πŸ›‘οΈ **[Security Posture Guide](docs/production/SECURITY_POSTURE.md)** β€” dev vs. production defaults, hardening checklist, threat model, integrator checklist - πŸ“‹ **[Production Runbook](docs/production/RUNBOOKS/CORE_MODULE_RUNBOOK.md)** β€” required env vars, startup sequence, failure modes, mitigations - πŸ–₯️ [systemd deployment files](deploy/systemd/) β€” hardened service unit, production drop-in, env template - ☸️ [Kubernetes production Helm values](docs/production/examples/k8s_production_values.yaml) β€” TLS, secrets, probes, autoscaling
Core Security Guides - πŸ” [TLS Setup Guide](docs/guides/guides_tls_setup.md) - πŸ‘₯ [RBAC Configuration](docs/security/api_authentication_authorization.md) - πŸ”’ [Encryption Strategy](docs/security/encryption_strategy.md) - πŸ”‘ [Key Management](docs/security/ENCRYPTION_KEY_MANAGEMENT_POLICY.md) - 🏦 [HSM Integration](docs/security/HSM_PRODUCTION_SETUP.md) - βœ… [Production Hardening Checklist](docs/security/PRODUCTION_HARDENING_CHECKLIST.md)
Advanced Security Topics - πŸ“ [Audit Logging](docs/features/features_audit_logging.md) - ⚠️ [Threat Model](docs/security/security_threat_model.md) - πŸ›‘οΈ [Hardware Attack Vectors](docs/de/security/security_hardware_attack_vectors.md) - USB, PCIe, CPU, RAM, I/O threats - βœ… [Full Audit Checklist (BSI C5, ISO 27001, DSGVO)](docs/compliance/compliance_full_checklist.md)
πŸ†• Knowledge Graph Protection (2026) **Protection against AI data theft and knowledge graph exfiltration:** - πŸ›‘οΈ [Knowledge Graph Protection Guide (EN)](docs/en/security/knowledge_graph_protection.md) - πŸ›‘οΈ [Wissensgraphen-Schutz (DE)](docs/de/security/knowledge_graph_protection.md) - πŸ“Š [Impact Summary & Implementation Plan (DE)](docs/de/security/graph_protection_impact_summary.md) - βš™οΈ [Graph Protection Configuration Example](config/graph_protection.yaml) **Topics covered:** - Systematic graph exfiltration detection - Vector embedding theft prevention - Training data extraction protection - Access pattern anomaly detection - Graph watermarking & fingerprinting (planned)
--- ## 🀝 Vulnerability Disclosure Policy We follow **responsible disclosure practices**:
1️⃣ Acknowledgment Security researchers who responsibly disclose vulnerabilities will be **acknowledged in our security advisories** (unless they prefer to remain anonymous).
2️⃣ No Legal Action We will **not take legal action** against security researchers who: - βœ… Act in good faith - βœ… Follow this security policy - βœ… Do not access or modify other users' data - βœ… Do not disrupt our services
3️⃣ CVE Coordination For significant vulnerabilities, we will coordinate **CVE assignment with MITRE**.
--- ## πŸ” Security Scanning > **Automated security scanning** is integrated into our CI/CD pipeline. ### Tools | Tool | Purpose | Integration | |------|---------|:-----------:| | **Gitleaks** | Secret detection in source code | βœ… CI/CD | | **clang-tidy** | Static analysis for C++ code | βœ… CI/CD | | **cppcheck** | Additional C++ security checks | βœ… CI/CD | | **Trivy** | Container image vulnerability scanning | βœ… CI/CD | | **OWASP ZAP** | Dynamic application security testing | 🚧 Planned | | **Comprehensive Audit** | Systematic security & compliance audit | βœ… Available | ### Run Scans Locally
Comprehensive Security Audit (Recommended) Run a systematic security audit covering SAST, dependency scanning, secret detection, and more: ```bash # Full audit (requires tools: cppcheck, clang-tidy, trivy, gitleaks, semgrep) ./scripts/comprehensive-code-audit.sh # Quick audit (skip time-consuming checks) AUDIT_QUICK=1 ./scripts/comprehensive-code-audit.sh # Audit with specific categories ./scripts/comprehensive-code-audit.sh --skip-dependencies --skip-dynamic # View all options ./scripts/comprehensive-code-audit.sh --help ``` **Audit Report:** Results are saved in `audit-results-/comprehensive-audit-report.md` **Compliance Coverage:** BSI C5, ISO 27001, DSGVO, NIS2, OWASP ASVS, NIST CSF
Individual Security Tools ```bash # Secret detection gitleaks detect --source . --verbose # Static analysis cppcheck --enable=warning,style --inconclusive ./src ./include clang-tidy src/**/*.cpp -- -std=c++20 # Dependency scanning trivy fs --scanners vuln,secret,misconfig . # Semgrep patterns semgrep --config=auto src/ include/ ```
--- ## πŸ“ž Security Contact | Method | Purpose | Link | |--------|---------|------| | πŸ”’ **GitHub Security Advisories** | Report vulnerabilities (Recommended) | [Report](https://github.com/makr-code/ThemisDB/security/advisories/new) | | πŸ’¬ **GitHub Issues** | Non-sensitive security discussions | [Issues](https://github.com/makr-code/ThemisDB/issues) | | πŸ”‘ **PGP Key** | Encrypted communications | Available upon request | > [!NOTE] > **Response Time:** Within 24 hours for initial acknowledgment. --- ## πŸ“… Changelog | Date | Event | |------|-------| | **2026-03** | πŸ“ Added `src/process/` (BPMN parser hardening) and `src/maintenance/` (RBAC audit trail) security notes | | **2026-01** | πŸ”’ Major security improvements in v1.3.4 (RocksDB, Docker, Updates) | | **2025-12** | πŸ” Update Checker security features & Manifest signing design | | **2025-11** | πŸ“ Initial security policy publication | --- ## πŸ”’ Recent Security Work > [!NOTE] > **Comprehensive Security Summary (v1.3.0 - v1.3.4):** > See [Security Work Summary](/docs/de/releases/SECURITY_WORK_SUMMARY_V1.3.4.md) for detailed information about recent security improvements. ### Highlights (v1.3.4) **RocksDB Wrapper Security Fixes:** - βœ… 7 critical vulnerabilities fixed (use-after-free, null-pointer, memory leaks) - βœ… 8 medium-severity issues resolved (deadlocks, resource leaks) - πŸ“Š 100% elimination of segfault risks - πŸ“– [Full Audit Report](/docs/ROCKSDB_WRAPPER_AUDIT_REPORT.md) **Docker Security Improvements:** - βœ… Ubuntu 24.04 LTS base image (extended security support) - βœ… Automated security updates during build - βœ… 80%+ reduction in CVEs - πŸ“– [Docker Security Fixes](/docs/DOCKER_SECURITY_FIXES.md) **Update Checker Security:** - βœ… Token masking and secure handling - βœ… HTTPS-only communication - βœ… Thread-safe implementation - πŸ“– [Update Security Summary](/docs/de/releases/updates_security_summary.md) **Binary Authenticity (Design):** - βœ… Cryptographic manifest signing architecture - βœ… SHA-256 hash verification - βœ… RSA-4096 digital signatures - πŸ“– [Manifest Security](/docs/de/releases/updates_manifest_security.md) ---
**πŸ” Security is a top priority at ThemisDB** [🚨 Report a Vulnerability](https://github.com/makr-code/ThemisDB/security/advisories/new) Β· [πŸ“– Security Docs](docs/security/) Β· [πŸ›‘οΈ Security Posture Guide](docs/production/SECURITY_POSTURE.md)