Security Overview
Security architecture and best practices for Ever Gauzy deployments.
Contact: security@ever.co โ If you discover any security issue, please disclose responsibly by sending an email, not by creating a GitHub issue.
Ever Gauzyโข follows good security practices, but 100% security cannot be guaranteed in any software. In a production setup, all client-side to server-side communications should be encrypted using HTTPS/WSS/SSL (REST APIs, GraphQL endpoint, Socket.io WebSockets, etc.).
Security Layersโ
Authentication Securityโ
- scrypt password hashing (default) with transparent bcrypt fallback for legacy hashes
- Progressive hash migration โ legacy bcrypt hashes are automatically re-hashed to scrypt on login
- JWT with short-lived access tokens and defense-in-depth validation
- Refresh tokens with identity reconciliation and token rotation
- Constant-time password comparison (
timingSafeEqual) โ prevents timing attacks - OAuth 2.0 for social authentication (tokens validated server-side against each provider's API)
- Email verification for new accounts
- Magic login codes via CSPRNG (
crypto.randomInt())
Authorization Guardsโ
The application uses a layered guard system with 12 specialized guards:
| Guard | Purpose |
|---|---|
AuthGuard | Global JWT validation (applied to all routes) |
TenantPermissionGuard | Ensures requests are scoped to the user's tenant |
PermissionGuard | Checks fine-grained permissions (@Permissions()) |
RoleGuard | Role-based access control (@Roles()) |
OrganizationPermissionGuard | Organization-level permission checks |
ManagerOrPermissionGuard | Allows managers OR users with specific permissions |
TenantBaseGuard | Base tenant validation logic |
FeatureFlagGuard | Feature flag gating |
ApiKeyAuthGuard | API key authentication for integrations |
AuthRefreshGuard | Validates refresh tokens specifically |
RegisterAuthorizationGuard | Controls user registration access |
Routes explicitly decorated with @Public() are the only exceptions to the global AuthGuard.
Tenant Isolationโ
All entities extending TenantBaseEntity or TenantOrganizationBaseEntity are automatically scoped to the current tenant. Cross-tenant data access is prevented at the ORM level.
HTTP Security Headersโ
Helmet is enabled in all environments, providing:
X-Content-Type-Options: nosniffX-Frame-Options: SAMEORIGINStrict-Transport-Security(HSTS)X-XSS-Protection- Content Security Policy (CSP)
- And other hardening headers
Input Validationโ
class-validatoris used across all DTOs with@UseValidationPipe({ whitelist: true })to strip unknown properties.UUIDValidationPipevalidates UUID parameters.ParseJsonPipeparses query parameters with safe defaults.- Relation loading in user endpoints is restricted to an allowlist of safe relations.
- File upload paths are sanitized to prevent path traversal (alphanumeric, dash, underscore only).
Session Managementโ
Sessions are managed through Redis (production) or in-memory stores (development):
- Redis-backed sessions provide persistence across server restarts.
- Session configuration is handled by
configureRedisSession().
File Storage Securityโ
All file storage providers (AWS S3, DigitalOcean Spaces, Wasabi, Cloudinary, Local) use structured logging:
- No credential leaks โ API keys, secret keys, and full configuration objects are never logged.
- Error logging uses
Logger.error()with message-only output. - Debug logs use safe messages (e.g.,
"S3 configuration loaded"instead ofJSON.stringify(config)).
Database Seeding Safetyโ
Default user seeding includes protections:
- Existing user passwords are never overwritten during re-seeding.
- Set
FORCE_SEED_PASSWORD=trueto explicitly allow password overwrites (use with caution).
Environment Variables Referenceโ
| Variable | Purpose | Required in Prod |
|---|---|---|
JWT_SECRET | Access token signing key | โ |
JWT_REFRESH_TOKEN_SECRET | Refresh token signing key | โ |
JWT_VERIFICATION_TOKEN_SECRET | Email verification token key | โ |
JWT_TOKEN_EXPIRATION_TIME | Access token expiry (seconds) | No |
JWT_REFRESH_TOKEN_EXPIRATION_TIME | Refresh token expiry (seconds) | No |
JWT_VERIFICATION_TOKEN_EXPIRATION_TIME | Verification token expiry (seconds) | No |
THROTTLE_ENABLED | Enable/disable rate limiting | No (default: true) |
THROTTLE_TTL | Rate limit window (ms) | No |
THROTTLE_LIMIT | Global rate limit | No |
MAGIC_CODE_EXPIRATION_TIME | Magic code expiry (seconds) | No |
FORCE_SEED_PASSWORD | Allow seed password overwrite | No (default: false) |
OTEL_ENABLED | Enable OpenTelemetry tracing | No |
ALLOWED_ORIGINS | CORS allowed origins (comma-separated) | Recommended |
CVE Clarificationsโ
CVE-2023-53951 (JWT Weak HMAC Secret)โ
CVE-2023-53951 refers to the public demo environment (demo.gauzy.co / apidemo.gauzy.co), which intentionally uses default credentials and secrets for testing purposes. This is expected behavior for a demo environment meant to allow public access and evaluation of the software.
Production deployments should always use strong, unique secrets configured via environment variables (e.g., JWT_SECRET, JWT_REFRESH_SECRET). See the environment configuration documentation for all required security-related environment variables.
Related Pagesโ
- Authentication Flows โ login, magic code, workspace switching
- Token Lifecycle โ JWT payload, validation, rotation
- Password Security โ hashing, policy, reset flow
- OAuth App Authorization โ server-to-server OAuth
- Data Protection โ GDPR, data handling
- Rate Limiting โ API throttling
- CORS Configuration โ cross-origin settings
- Audit Logging โ activity logs and observability
- Authentication โ auth setup details
- Roles & Permissions โ RBAC