# π Security Policy
**ThemisDB Security Team**
[](https://github.com/makr-code/ThemisDB/security)
[](https://github.com/gitleaks/gitleaks)
[](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)