AMS Docs
Docs / Security Model

Security Model

AMS is built with security as a first-class concern โ€” from multi-layer authentication to tenant isolation, rate limiting, encryption, and compliance features.

Authentication

AMS uses Laravel Sanctum for authentication, supporting two modes:

bash โ€” Generate an API token
curl -X POST https://pasha.ams.hkus1.s4s.host/api/v1/admin/api-tokens \
  -H "Authorization: Bearer $ADMIN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Zapier Integration",
    "abilities": ["members:read", "events:read", "webhooks:write"]
  }'

# Response: {"token": "1|abc123...", "name": "Zapier Integration", ...}
# The token is shown ONCE. Store it securely โ€” it cannot be retrieved again.

Authorization (RBAC)

Authorization is enforced via a Role-Based Access Control (RBAC) system. Every API action is protected by a Policy that checks the user's role and specific permission. Permissions are cached in Redis for 15 minutes and invalidated on role change.

Tenant Isolation

Every database query is automatically scoped to the current tenant via Eloquent global scopes. This is enforced at the ORM level โ€” it cannot be bypassed by user input. See Multi-Tenancy for the technical implementation.

CSRF Protection

All state-changing web requests (POST, PUT, PATCH, DELETE) are protected by Laravel's CSRF middleware. The CSRF token is embedded in every form and SPA request. API token routes are exempt from CSRF (they use Bearer tokens instead).

Rate Limiting

Endpoint TypeRate LimitWindowResponse on Breach
Authenticated API requests60 requestsper minute429 Too Many Requests
Unauthenticated API requests10 requestsper minute429 Too Many Requests
Login / auth endpoints5 requestsper minute429 + 30s lockout
Password reset3 requestsper hour429 Too Many Requests
File upload20 requestsper minute429 Too Many Requests
Webhook delivery (outbound)Unlimitedโ€”Queued with exponential backoff

Rate limit headers are returned on every response:

http โ€” Rate limit headers
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 47
X-RateLimit-Reset: 1741953600
Retry-After: 23    # Only present on 429 responses

Data Encryption

GDPR Compliance Features

FeatureLocationDescription
Data ExportMember profile โ†’ Export My DataMembers can download all their data as JSON/CSV
Account DeletionMember profile โ†’ Delete AccountSoft delete with 30-day recovery window, then hard delete
Consent TrackingCommunications moduleEmail/SMS opt-in/out tracked per member per channel
Data RetentionSettings โ†’ Data RetentionConfigurable retention periods per data type
Audit LogAdmin โ†’ Audit LogAll admin actions logged with timestamp and user
Privacy Policy URLSettings โ†’ LegalDisplayed on registration and login pages

Audit Logging

Every significant action in AMS is recorded in the audit log with: timestamp, actor (user ID + name), action type, affected resource, old values, new values, and IP address. Audit logs are immutable โ€” they cannot be edited or deleted by any role including Super Admin.

json โ€” Audit log entry example
{
  "id": "log_01HXZB",
  "timestamp": "2026-03-14T09:32:11Z",
  "actor": { "id": "usr_01HX", "name": "Ahmed Khan", "role": "admin" },
  "action": "member.updated",
  "resource": { "type": "member", "id": "mem_01HY" },
  "changes": {
    "membership_type": { "from": "associate", "to": "full" }
  },
  "ip_address": "203.0.113.45"
}

Password Policies

AMS enforces the following password policy for all users (configurable by tenant admins):

Two-Factor Authentication

โš ๏ธ Coming Soon โ€” Q2 2026TOTP-based two-factor authentication (Google Authenticator, Authy) is planned for Q2 2026. SMS OTP for 2FA is also under development. Admins will be able to enforce 2FA for all admin-level users.

Security Headers

HeaderValuePurpose
Strict-Transport-Securitymax-age=31536000; includeSubDomainsEnforces HTTPS for 1 year
X-Content-Type-OptionsnosniffPrevents MIME type sniffing
X-Frame-OptionsSAMEORIGINPrevents clickjacking
X-XSS-Protection1; mode=blockLegacy XSS browser filter
Referrer-Policystrict-origin-when-cross-originControls referrer info
Content-Security-PolicyConfigured per environmentPrevents XSS, injection attacks
Permissions-Policycamera=(), microphone=(), geolocation=()Disables unused browser features

Vulnerability Disclosure

If you discover a security vulnerability in AMS Platform, please report it responsibly. Do not create a public GitHub issue or post on social media before we've had a chance to address it.