We actively support security updates for the following versions:
| Version | Supported |
|---|---|
| 0.1.x | ✅ |
Once we reach 1.0.0, we will maintain a clearer LTS (Long Term Support) policy.
We take security vulnerabilities seriously. If you discover a security vulnerability within litestar-flags, please report it responsibly.
- Go to the Security tab of this repository
- Click "Report a vulnerability"
- Fill out the security advisory form with details about the vulnerability
This method ensures:
- Private communication until a fix is available
- Coordinated disclosure
- Credit for responsible disclosure
- CVE assignment if applicable
If you cannot use GitHub Security Advisories, you may email security concerns to:
- Email: jacob@z7x.org
- Subject:
[SECURITY] litestar-flags: <brief description>
Please include:
- Description of the vulnerability
- Steps to reproduce
- Potential impact
- Any suggested fixes (if available)
- Acknowledgment: We will acknowledge receipt of your report within 48 hours
- Assessment: We will assess the vulnerability and determine its severity within 7 days
- Updates: We will keep you informed of our progress
- Resolution: We aim to release patches for critical vulnerabilities within 30 days
- Credit: We will credit you in the release notes (unless you prefer anonymity)
We use the following severity levels:
- Critical: Remote code execution, authentication bypass, data exposure
- High: Privilege escalation, significant information disclosure
- Medium: Limited impact vulnerabilities, denial of service
- Low: Minor issues with limited security impact
When using litestar-flags in your applications, follow these guidelines:
Targeting keys (user IDs, etc.) may contain sensitive information. Use the built-in security utilities:
from litestar_flags.security import hash_targeting_key, sanitize_log_context
# Hash targeting keys in logs
hashed_key = hash_targeting_key(user_id)
# Sanitize context before logging
safe_context = sanitize_log_context(evaluation_context.to_dict())
logger.info("Flag evaluated", extra=safe_context)- Environment Variables: Store sensitive configuration in environment variables
- Secrets Management: Use your platform's secrets manager for Redis/database credentials
- Least Privilege: Use database accounts with minimal required permissions
- TLS/SSL: Always use encrypted connections to Redis and databases in production
- Network Isolation: Keep storage backends on private networks when possible
- Firewall Rules: Restrict access to storage backends to application servers only
- Flag Keys: Flag keys should be validated before use
- Context Attributes: User-provided context attributes should be sanitized
- Rule Conditions: Avoid using user input directly in rule conditions
- Audit Logs: Enable audit logging for flag changes in production
- Anomaly Detection: Monitor for unusual flag evaluation patterns
- Access Logs: Track who modifies flags and when
import os
from litestar_flags import FeatureFlagsConfig
# Secure production configuration
config = FeatureFlagsConfig(
backend="redis",
backend_options={
"url": os.environ["REDIS_URL"], # Use environment variable
"ssl": True, # Enable TLS
},
enable_middleware=True,
audit_logging=True, # Enable audit logs
)- Regex Patterns: The
matchesoperator uses Python'sremodule. Complex regex patterns could potentially cause ReDoS (Regular Expression Denial of Service). Avoid using untrusted regex patterns in rules.
- Error Messages: Error messages do not expose internal system details by default
- Flag Names: Flag keys and names may be exposed to clients; avoid using sensitive information in flag identifiers
- Memory Backend: The memory backend stores data in process memory; data is lost on restart and not suitable for production
- Redis Backend: Redis does not encrypt data at rest by default; consider using encrypted Redis or Redis Enterprise for sensitive data
- Database Backend: Use database-level encryption for sensitive flag configurations
- Input Sanitization: Flag keys and rule attributes are validated
- Type Safety: Pydantic models enforce type constraints
- Logging Redaction: Security utilities help redact sensitive data from logs
- No Arbitrary Code Execution: Rule evaluation does not execute arbitrary code
The litestar_flags.security module provides:
hash_targeting_key(): Hash sensitive identifiers for loggingsanitize_log_context(): Remove sensitive fields from log dataSENSITIVE_FIELDS: List of fields considered sensitive
Track security-related updates in our CHANGELOG.md with entries prefixed with [Security].
For non-security-related issues, please use GitHub Issues.
For security vulnerabilities, please use the methods described above.
Thank you for helping keep litestar-flags and its users secure!