ื“ืœื’ ืœืชื•ื›ืŸ ื”ืจืืฉื™

Security Overview

Security architecture and best practices for Ever Gauzy deployments.

info

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:

GuardPurpose
AuthGuardGlobal JWT validation (applied to all routes)
TenantPermissionGuardEnsures requests are scoped to the user's tenant
PermissionGuardChecks fine-grained permissions (@Permissions())
RoleGuardRole-based access control (@Roles())
OrganizationPermissionGuardOrganization-level permission checks
ManagerOrPermissionGuardAllows managers OR users with specific permissions
TenantBaseGuardBase tenant validation logic
FeatureFlagGuardFeature flag gating
ApiKeyAuthGuardAPI key authentication for integrations
AuthRefreshGuardValidates refresh tokens specifically
RegisterAuthorizationGuardControls 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: nosniff
  • X-Frame-Options: SAMEORIGIN
  • Strict-Transport-Security (HSTS)
  • X-XSS-Protection
  • Content Security Policy (CSP)
  • And other hardening headers

Input Validationโ€‹

  • class-validator is used across all DTOs with @UseValidationPipe({ whitelist: true }) to strip unknown properties.
  • UUIDValidationPipe validates UUID parameters.
  • ParseJsonPipe parses 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 of JSON.stringify(config)).

Database Seeding Safetyโ€‹

Default user seeding includes protections:

  • Existing user passwords are never overwritten during re-seeding.
  • Set FORCE_SEED_PASSWORD=true to explicitly allow password overwrites (use with caution).

Environment Variables Referenceโ€‹

VariablePurposeRequired in Prod
JWT_SECRETAccess token signing keyโœ…
JWT_REFRESH_TOKEN_SECRETRefresh token signing keyโœ…
JWT_VERIFICATION_TOKEN_SECRETEmail verification token keyโœ…
JWT_TOKEN_EXPIRATION_TIMEAccess token expiry (seconds)No
JWT_REFRESH_TOKEN_EXPIRATION_TIMERefresh token expiry (seconds)No
JWT_VERIFICATION_TOKEN_EXPIRATION_TIMEVerification token expiry (seconds)No
THROTTLE_ENABLEDEnable/disable rate limitingNo (default: true)
THROTTLE_TTLRate limit window (ms)No
THROTTLE_LIMITGlobal rate limitNo
MAGIC_CODE_EXPIRATION_TIMEMagic code expiry (seconds)No
FORCE_SEED_PASSWORDAllow seed password overwriteNo (default: false)
OTEL_ENABLEDEnable OpenTelemetry tracingNo
ALLOWED_ORIGINSCORS allowed origins (comma-separated)Recommended

CVE Clarificationsโ€‹

CVE-2023-53951 (JWT Weak HMAC Secret)โ€‹

caution

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.