Security Policy¶
Reporting a Vulnerability¶
If you discover a security vulnerability in ArchiPy, please do not open a public GitHub issue. Instead, report it privately so the maintainers can triage and patch it before public disclosure.
How to report:
- Email the maintainers at the address listed in
pyproject.tomlunder[project.authors], or - Use GitHub's private vulnerability reporting feature (Settings → Security → Advisories → New advisory).
Include as much detail as possible:
- A description of the vulnerability and its potential impact
- Steps to reproduce, including a minimal code example if possible
- The ArchiPy version(s) affected
- Any suggested mitigations you are aware of
You will receive an acknowledgment within 48 hours and a status update within 7 days.
Warning: Please allow the maintainers reasonable time (typically 90 days) to prepare and release a fix before disclosing the vulnerability publicly.
Supported Versions¶
Only the latest released version of ArchiPy receives security patches. Older versions are not actively maintained.
| Version | Supported |
|---|---|
| Latest | Yes |
| Older | No |
If you are running an older version, upgrade to the latest release to receive security fixes:
Security Hardening Checklist¶
Follow these practices when building applications with ArchiPy.
Configuration & Secrets¶
- Never hardcode secrets — use environment variables or a secrets manager.
- Add
.envto.gitignore— commit only.env.examplewith placeholder values. - Use
pydantic-settingsvalidators to reject missing or malformed secrets at startup (fail fast). - Rotate credentials regularly — Redis passwords, database URLs, JWT secrets.
- Set
SECRET_KEYto a cryptographically random value (at least 32 bytes):
JWT Utilities¶
- Use short expiry times — access tokens should expire in minutes, not hours.
- Use asymmetric keys (RS256) for tokens consumed by third parties.
- Validate
audandissclaims to prevent token reuse across services. - Never log full JWT tokens — log only the token ID (
jti) if needed.
from archipy.helpers.utils.jwt_utils import JWTUtils
# Always specify algorithm and expiry explicitly
token = JWTUtils.encode(
payload={"sub": user_id, "jti": str(uuid4())},
expiry_minutes=15,
)
Database Adapters¶
- Use least-privilege database users — application users should not have
DROPorCREATErights. - Enable SSL/TLS for all database connections in production.
- Never interpolate user input directly into SQL — use parameterized queries (SQLAlchemy does this by default).
- Use connection pooling limits to prevent connection exhaustion attacks.
Redis Adapter¶
- Enable Redis
requirepassin production. - Restrict Redis to localhost or a private network; never expose port 6379 publicly.
- Set
maxmemoryand an eviction policy to prevent unbounded memory growth. - Use TLS (
rediss://) for Redis connections in production.
Keycloak Adapter¶
- Verify the token signature using the Keycloak public key — do not skip signature validation.
- Use PKCE for public clients (e.g., SPAs).
- Restrict redirect URIs in the Keycloak client configuration.
- Set short session timeouts and enforce re-authentication for sensitive actions.
Password Utilities¶
- Always hash passwords using
PasswordUtilsbefore storage — never store plaintext. - Use a high cost factor (bcrypt rounds ≥ 12) for production workloads.
from archipy.helpers.utils.password_utils import PasswordUtils
hashed = PasswordUtils.hash_password(plain_password)
is_valid = PasswordUtils.verify_password(plain_password, hashed)
Kafka Adapter¶
- Enable SASL/SSL authentication for Kafka brokers in production.
- Validate message schemas before processing — do not trust incoming payloads blindly.
- Use separate topics per environment to prevent cross-environment message leakage.
MinIO Adapter¶
- Use IAM policies to restrict bucket and object access per service.
- Enable server-side encryption for buckets containing sensitive data.
- Disable public bucket access unless explicitly required.
- Set pre-signed URL expiry to the minimum required duration.
Logging & Observability¶
- Do not log sensitive data — passwords, tokens, credit card numbers, PII.
- Use structured logging (
loggingmodule with JSON formatters) to ease log analysis. - Redact secrets in exception messages before they reach error trackers (Sentry, Elastic APM).
Dependency Management¶
- Pin dependency versions with
uv lockand commituv.lockto version control. - Run
uv auditregularly to check for known vulnerabilities in dependencies. - Update dependencies with
make updateand review the diff before merging.
See Also¶
- Configuration Management — environment variables and secrets management
- JWT Utilities — encoding and decoding JSON Web Tokens
- Installation — optional extras and dependencies
- Contributing — responsible disclosure and code review process