# Security, RBAC, MFA & SSRF Protection

> How Weelkit protects workspace data with role-based access control, TOTP MFA, encrypted secrets, and SSRF-hardened crawling.

Weelkit is built with strict tenant isolation and defense-in-depth across every API route, background worker, and external request.

## Role-Based Access Control (RBAC)

Every organization member has one of four roles enforced server-side on every org-scoped endpoint:

| Role | Capabilities |
| :--- | :--- |
| **Viewer / Analyst** | Read-only access to visibility, actions, proofs, analytics, and reports. |
| **Editor** | Create/run prompts, generate and approve action drafts, run cloud agents, open GitHub PRs, send approved outreach emails. |
| **Admin** | Manage CMS/GitHub/Analytics/Slack connections, invite/update members, manage billing and credit top-ups, view audit logs. |
| **Owner** | Full organization administration, billing ownership, and workspace governance. |

## Authentication, Sessions & TOTP MFA

- Short-lived Bearer access tokens paired with `HttpOnly`, `SameSite=Lax`, `Secure` refresh cookies.
- Full session management under **Settings → Security** (list and revoke active sessions anytime).
- Optional **TOTP Multi-Factor Authentication** per user, plus an org-wide **Require MFA** policy (`requireMfa: true`) enforced on every API call.

## Credential Encryption & SSRF Protection

- All stored integration credentials (CMS keys, GitHub tokens, OAuth refresh tokens, Slack tokens) are encrypted at rest with **AES-256-GCM**.
- Every outbound HTTP request from Weelkit's crawler, free tools, and webhooks passes through `safehttp`, rejecting private RFC 1918 networks, loopback, link-local cloud metadata IPs, and unsafe redirects.
- Every sensitive workspace mutation is written to the immutable **Organization Audit Log** (`GET /api/v1/orgs/{orgId}/audit-logs`).
