Skip to content

Security: ibam28/erp-automation-platform

Security

docs/security.md

Security Boundaries

Network Boundaries

  • ERP Public API: Used by frontend, n8n, and AI tools.

    • Port: 3000 (local), 443 (production)
    • Authentication: JWT
  • n8n Webhook URL: Receives event pushes from Worker.

    • Port: 5678 (local), 443 (production)
    • Authentication: Basic Auth (username/password)
  • Worker: Sends events to n8n Webhook URL via HTTPS.

    • No direct DB access.

Data Access

  • n8n and AI do not connect directly to PostgreSQL.
  • AI tools are in-process modules inside the ERP API.
  • Tenant isolation is enforced via organization_id on all tenant-scoped entities.

Authentication

  • JWT for API authentication:

    • Token includes user_id, organization_id, roles, permissions.
    • Token expires after 24 hours.
    • Refresh token issued on login.
  • Basic Auth for n8n Webhook URL:

    • username/password configured via environment variables.
    • Shared secret between Worker and n8n.

Secrets

  • Never commit secrets (e.g., .env).
  • Use environment variables for configuration.
  • Secrets managed by Fly.io in production.

Authorization

  • RBAC: Role-Based Access Control.
  • Permissions: Fine-grained permissions on entities.
  • Tenant Context: All queries filtered by organization_id.

Audit Logging

  • Every mutation records an AuditLog entry.
  • Includes: user_id, action, entity_type, entity_id, metadata.

AI Safety

  • AI tools have explicit authorization context.
  • Critical mutations require explicit human approval.
  • AI cannot perform destructive actions autonomously.

There aren't any published security advisories