Security

Automation Hub is built with security-first principles. This page documents all security mechanisms, from authentication and encryption to network protections and audit logging.

Authentication

Automation Hub supports two authentication methods:

MethodUse CaseDetails
Session-based (Web) Browser UI access HTTP-only cookies, database-backed sessions, SameSite=lax
API Keys REST API access SHA-256 hashed storage, never stored in plain text, per-key rate limits

API Key Security

API keys are hashed with SHA-256 before storage. The plain-text key is shown only once at creation time. If lost, the key must be revoked and a new one generated.

Two-Factor Authentication (2FA)

Users can enable TOTP-based two-factor authentication for an additional layer of security.

Password Policy

Rate Limiting

EndpointLimitWindow
Login (/login)5 attemptsPer minute, per IP
Register (/register)5 requestsPer minute, per IP
Forgot Password5 requestsPer minute, per IP
Reset Password5 requestsPer minute, per IP
API EndpointsConfigurablePer-key + per-organization limits

When rate limited, the API returns a 429 Too Many Requests response with a Retry-After header indicating seconds to wait.

CSRF Protection

All web routes are protected by CSRF tokens verified on every state-changing request (POST, PUT, PATCH, DELETE). The only exception is the installation wizard, which operates before sessions are fully configured.

CORS Policy

Cross-Origin Resource Sharing is restricted to the APP_URL origin only. API requests from other origins are rejected. This prevents unauthorized cross-origin access to the API.

SSRF Protection

The HTTP Request node and polling mechanisms include Server-Side Request Forgery (SSRF) protections. The following private IP ranges are blocked:

Blocked IP Ranges
127.0.0.0/8       (localhost)
10.0.0.0/8        (private class A)
172.16.0.0/12     (private class B)
192.168.0.0/16    (private class C)
::1               (IPv6 localhost)
fc00::/7          (IPv6 private)

This prevents workflows from making requests to internal services, databases, or cloud metadata endpoints.

Input Validation

Encrypted Credentials

All sensitive module credentials (API keys for email providers, WhatsApp tokens, AI service keys, courier API keys) are stored using Laravel's encrypted cast. This means:

Audit Logging

All administrative actions are logged to the audit trail with:

Audit logs are queryable via the admin UI and the GET /api/v1/audit-logs endpoint (requires audit.view permission).

Organization Isolation

Multi-tenant data isolation is enforced at the database query level using an OrganizationScope global scope applied to all tenant models. This ensures:

HMAC Webhook Verification

Outbound webhooks include an HMAC-SHA256 signature for verification:

Signature Verification Example (PHP)
$signature = $_SERVER['HTTP_X_WEBHOOK_SIGNATURE'] ?? '';
$payload = file_get_contents('php://input');
$expected = hash_hmac('sha256', $payload, $webhookSecret);

if (!hash_equals($expected, $signature)) {
    http_response_code(401);
    exit('Invalid signature');
}

Session Security

SettingValuePurpose
Cookie FlagHttpOnlyPrevents JavaScript access to session cookies
SameSitelaxPrevents CSRF via cross-origin requests
SecureAuto (HTTPS)Cookies only sent over HTTPS in production
DriverdatabaseSessions stored in DB for scalability and auditability
Lifetime120 minutesConfigurable session expiration

Captcha Protection

Automation Hub includes built-in captcha protection for all public-facing authentication forms to prevent spam, bot registrations, and brute-force attacks. Two providers are supported:

ProviderTypeBest For
Cloudflare TurnstileVisible widget (privacy-friendly)Recommended — free, no tracking, GDPR-compliant
Google reCAPTCHA v3Invisible (score-based)Alternative — invisible, risk scoring (min score 0.5)

Protected Forms

Configuration

Captcha is disabled by default for backward compatibility. To enable, add these variables to your .env file:

.env — Cloudflare Turnstile
CAPTCHA_ENABLED=true
CAPTCHA_PROVIDER=turnstile
TURNSTILE_SITE_KEY=0x4AAAAAAA...your_site_key
TURNSTILE_SECRET_KEY=0x4AAAAAAA...your_secret_key
.env — Google reCAPTCHA v3 (alternative)
CAPTCHA_ENABLED=true
CAPTCHA_PROVIDER=recaptcha
RECAPTCHA_SITE_KEY=6Lc...your_site_key
RECAPTCHA_SECRET_KEY=6Lc...your_secret_key

How It Works

  1. 1

    Frontend Widget

    When captcha is enabled, the CaptchaWidget React component automatically loads the appropriate provider script and renders the challenge (visible for Turnstile, invisible for reCAPTCHA v3).

  2. 2

    Token Generation

    Upon successful verification, the provider returns a one-time token that is included in the form submission as captcha_token.

  3. 3

    Server-Side Verification

    The ValidCaptcha rule sends the token to the provider's verification API (Cloudflare or Google) and checks the response. If verification fails, the form submission is rejected with a validation error.

Getting Captcha Keys

Cloudflare Turnstile: Go to Cloudflare Dashboard → Turnstile, add a site, and copy the site key and secret key. It's completely free with no request limits.

Google reCAPTCHA v3: Go to reCAPTCHA Admin, register a new site with reCAPTCHA v3, and copy the keys.

Security Best Practices

For production deployments: always use HTTPS, keep APP_DEBUG=false, rotate your APP_KEY periodically, enable 2FA for all admin users, enable captcha protection, and regularly review the audit log for suspicious activity.