Skip to main content

Security Architecture

Status: DRAFT Owner: Engineering Last Review: 2026-05-03 Applicable Standards: SOC 2 (CC6, CC7) / GDPR (Art. 32) / SEC (data protection)

1. Purpose

This document describes the security controls protecting the Equa platform — the technical mechanisms that safeguard user credentials, financial data, equity records, and organizational documents. It covers authentication, encryption, session management, network hardening, input validation, and infrastructure security.

2. Scope

3. Authentication

For the full technical implementation, see Authentication and Permissions.

3.1 Authentication Methods

The platform supports three authentication methods, all resulting in a server-side session stored in PostgreSQL.

3.2 Two-Factor Authentication

Source: equa-server/modules/auth/src/two-factor.ts

3.3 Email Verification

Email verification is required before a user can log in. The EmailVerifications entity stores a verification code linked to the user’s UUID. Source: equa-server/modules/persistence/src/schema.ts (EmailVerifications entity)

3.4 Anti-Abuse Controls

reCAPTCHA validation is currently frontend-only. No server-side verification endpoint was found in equa-server for validating reCAPTCHA tokens with Google.Recommendation: Add backend token verification for signup to prevent direct API bypass of frontend checks.

4. Encryption

4.1 Current Implementation

Source: equa-server/modules/auth/src/lib/encryption.ts Encrypted fields:

4.2 Password Hashing

4.3 Encryption Gaps

The following sensitive fields are stored in plaintext in PostgreSQL:Recommendation: Extend the AesKey encryption to these fields using a dedicated encryption key separate from the 2FA key.

5. Session Management

Source: equa-server/modules/auth/src/sessions.ts

5.1 Session Storage Schema

Source: equa-server/modules/persistence/src/schema.ts (Sessions entity)

5.2 Session Cleanup

Source: equa-server/modules/auth/src/lib/session-cleaning.ts A cron job periodically removes expired session records from the database based on the expires column.

6. Network and Infrastructure Security

6.1 Deployment

6.2 SSL/TLS

6.3 CORS

CORS is enabled via the vineyard-lawn middleware in equa-server/modules/api/src/server.ts. The specific allowed origins are configured at the application level.

6.4 Gateway HTTP Authentication and CORS

Source: equabot-gateway/src/gateway/auth.ts, equabot-gateway/src/gateway/channels-http.ts, equabot-gateway/src/gateway/config-http.ts, equabot-gateway/src/gateway/task-stack-http.ts

6.5 Security Headers Gap

No security headers middleware (such as helmet) is configured. The following headers are not set:
  • Strict-Transport-Security (HSTS)
  • X-Content-Type-Options
  • X-Frame-Options
  • Content-Security-Policy
  • X-XSS-Protection
  • Referrer-Policy
Recommendation: Add helmet middleware to equa-server/modules/api/src/server.ts with production-appropriate defaults.

6.6 Rate Limiting Gap

There is no API-wide rate limiting. The only rate limiting exists at the agent level:Source: equa-server/modules/agent/src/security/guardrails.tsRecommendation: Implement API-wide rate limiting (e.g., express-rate-limit) on authentication endpoints and write operations.

7. Input Validation

7.1 Backend Validation

Source: equa-server primarily uses class-validator decorators for backend request DTO validation. vineyard-lawn is used for endpoint wiring and request flow. Validation for file names, URLs, phone numbers, and Ethereum addresses is also present in frontend validators (equa-web/src/shared/helpers/field-validators.ts) and should not be treated as equivalent to backend enforcement without endpoint-specific confirmation.

7.2 Frontend Validation

Source: equa-web/src/shared/helpers/field-validators.ts Frontend validation mirrors backend rules using the same validator library and custom regex patterns. React’s default JSX escaping provides baseline XSS protection.

7.3 File Upload Validation

8. Secret Scanning

Recommendation: Add detect-secrets scanning to equa-server and equa-web CI pipelines, matching the equabot-gateway configuration.

9. Environment Variables (Security-Relevant)

10. Regulatory References

11. Revision History