Encryption Policy
| Category | Confidentiality |
|---|---|
| Version | 1.0 |
| Status | Approved |
| Approved | 2026-03-25 by Mishkin Berteig |
| Next Review | 2027-03-25 |
| ID | POL-1 |
| Document version | policies/encryption.md at commit 9c72db400a23 (SHA-256 605ed3b8d06f) |
Linked Controls
- INFRA-1 TLS certificates and endpoints
- DATA-6 Data in transit encryption
- DATA-2 File store encryption
- DATA-4 Data store encryption
- APPS-2 Encryption Documentation
- DATA-3 File systems encryption
Encryption Policy
Purpose
This policy establishes encryption requirements for data at rest and in transit across the MaxGood.work platform, ensuring confidentiality of customer and company data.
Scope
All data stored, processed, or transmitted by MaxGood.work systems, including databases, file storage, caches, backups, and network communications.
Data in Transit Encryption
All data transmitted between systems must be encrypted using TLS 1.2 or higher.
Requirements
- All public-facing endpoints use HTTPS (TLS 1.2+)
- Internal service-to-service communication uses TLS where supported
- API calls to third-party services (OpenAI, Stripe, DocuSign, etc.) use HTTPS
- Database connections (RDS PostgreSQL) use SSL/TLS
- Redis connections (ElastiCache) use in-transit encryption
Prohibited
- Unencrypted HTTP for any production endpoint
- TLS versions below 1.2
- Self-signed certificates in production
TLS Certificates and Endpoints
- Production TLS certificates are managed through AWS Certificate Manager (ACM)
- Certificates are configured for automatic renewal
- The public endpoints of the ECS services are served through AWS Elastic Load Balancer with ACM certificates
Endpoint configuration
- The production and staging load balancers (
lb-Prod-MaxGoodApp,lb-Staging-MaxGoodApp) terminate HTTPS on port 443 with the security policyELBSecurityPolicy-TLS13-1-2-Res-PQ-2025-09, which offers TLS 1.3 and TLS 1.2 only. Port 80 answers with a permanent redirect (HTTP 301) to HTTPS. - Both load balancers use the ACM certificate for
*.maxgood.work: Amazon-issued, RSA-2048, validated by DNS, eligible for managed renewal. - The blog and
wwwuse a Let's Encrypt certificate renewed by the server'scertbot-renew.timer; the Easypanel host's applications (automation,collaborate,convert) use Let's Encrypt certificates renewed by the host's reverse proxy; the trust portal (trust.maxgood.work) uses an ACM certificate.
Evaluation of endpoints
- The
mg-mail-health-checkLambda runs every minute against the mail endpoints, checks the certificate of each protocol against the default trust store, and raises the alarmmg-mail-health-cert-expirywhen the certificate has fewer than 14 days left. - The weekly server patching job (
scripts/server-patching.py) fetches the blog and the Easypanel applications over HTTPS with certificate validation against the default trust store; a failure is reported to the team. - ACM reports the renewal status of each certificate (
RenewalSummaryinaws acm describe-certificate); the status of the*.maxgood.workcertificate on 2026-11-27 is SUCCESS. - The protocol, cipher, issuer and days to expiry of the public endpoints, and the refusal of TLS 1.1 and older, as read on 2026-11-27, are in
MGDataAndEvidence/evidence/artifacts/decisions/2026-11-27-engineering-policy-tests-record.md.
Data Store Encryption
All data stores use encryption at rest:
| System | Encryption Method |
|---|---|
| RDS PostgreSQL | AWS KMS-managed encryption (AES-256) |
| ElastiCache Redis | At-rest encryption enabled |
| S3 buckets | Server-side encryption (SSE-S3 or SSE-KMS) |
| EBS volumes | AWS KMS-managed encryption |
File Store Encryption
- All S3 buckets have default encryption enabled (AES-256 or KMS)
- Versioning is enabled on select S3 buckets; not all production buckets currently have versioning enabled
File Systems Encryption
- ECS tasks run on AWS Fargate, whose task ephemeral storage is encrypted at rest (AES-256, Fargate-managed key)
- RDS storage uses encrypted volumes
- Backup snapshots inherit encryption from their source
Key Management
- Encryption keys are managed through AWS Key Management Service (KMS)
- KMS key rotation is not currently enabled; keys are rotated manually on suspected compromise
- Key access is restricted through IAM policies following least-privilege
- Key usage is logged through CloudTrail
Developer Guidance
When developing for the MaxGood.work platform:
- Never store encryption keys, API keys, or secrets in source code
- Use environment variables (
.envfiles, gitignored) or AWS Secrets Manager for all secrets - Use parameterized queries to prevent SQL injection (which could bypass data access controls)
- Use the platform's established database connection configurations, which include SSL/TLS
- Report any discovered encryption gaps to the Security Officer immediately
Cryptographic Methods in Use
Choose from these methods before introducing another. Use well-maintained library primitives and never write cryptographic code; generate secrets, codes and tokens with the Python secrets module, never random; compare secrets with a constant-time function (hmac.compare_digest, bcrypt.checkpw, timingSafeEqual).
| Purpose | Method and parameters | Code |
|---|---|---|
| Account passwords | bcrypt with a per-password random salt (bcrypt.gensalt(), cost factor 12) |
MaxGoodAI/app/refactored_routes/auth/routes.py |
| API and messaging credentials | 32 random bytes (secrets.token_urlsafe(32)), stored only as a bcrypt hash, shown once |
MaxGoodAI/app/refactored_routes/org_api_credentials/routes.py |
| One-time codes (OTC) | 6 digits from secrets.randbelow, 15-minute lifetime, five wrong guesses destroy the code |
MaxGoodAI/app/refactored_routes/auth/routes.py, attempt_budget.py |
| Session tokens | JWT signed HS256 with the server secret; decoding names the algorithm (algorithms=["HS256"]); lifetimes set by JWT_ACCESS_TOKEN_TTL_MINUTES and JWT_REFRESH_TOKEN_TTL_MINUTES |
MaxGoodAI/app/refactored_routes/auth/routes.py |
| Service-to-service requests | HMAC-SHA256 over timestamp, method, request target and the SHA-256 of the body; a separate secret per service; 300-second timestamp tolerance; replay protection in Redis | MaxGoodAI/app/refactored_routes/util/service_auth.py |
| OAuth state and PKCE | state from secrets.token_urlsafe(32) stored as SHA-256; PKCE verifier from token_urlsafe(64) with an S256 challenge; Discord state signed HMAC-SHA256 |
MaxGoodAI/app/refactored_routes/mural_import/services.py, MGDiscordApp/src/services/discord-oauth.ts |
| Inbound webhooks | Slack requests verified with the slack_sdk signature verifier |
MGSlackApp/app.py |
| Stored integration secrets | Fernet (AES-128-CBC with HMAC-SHA256); the trust portal uses MultiFernet with keys from its environment, which allows rotation |
ai-agent-first-trust-portal/app/services/collector_encryption.py |
| Database connections | PostgreSQL TLS: production forces sslmode=require and keeps verify-ca or verify-full when set |
MaxGoodAI/maxgood_db/session.py |
| Object storage | SSE-S3 (AES256) on the trust portal's buckets, with SHA-256 upload checksums |
ai-agent-first-trust-portal/deploy/aws/trust-portal.yaml |
| Content digests | SHA-256 | ban_flags, user_documents and newsjacking columns |
- Transport: TLS 1.2 or higher only (see "Data in Transit Encryption"); never disable certificate verification (
verify=False). - Key sizes: AES-128 or larger for symmetric encryption, RSA-2048 or larger for certificates, SHA-256 or stronger for hashing and signatures. MD5 and SHA-1 are not used for security purposes, and application code uses neither.
- Password and credential hashes use bcrypt and never a fast hash. Secrets are never logged or returned in a response after creation.
- A change that adds or alters a use of cryptography states it in the card's plan and is examined in the red-team review under "Security Design Review" in the Change Management Policy.