Permissions & Security
Headless is built around strict defense-in-depth at every API boundary so exposing ProcessWire over REST never compromises system templates, unpublished pages, or credential secrets.
1. Admin RBAC (headless Permission & Ownership Scoping)
Section titled “1. Admin RBAC (headless Permission & Ownership Scoping)”| Role / Permission | Capabilities in Setup -> Headless |
|---|---|
headless (non-superuser) |
View Overview, Providers & Routes, and manage only their own API keys (headless-keys) and refresh tokens (headless-tokens). Settings (headless singleton) are strictly read-only (403 on POST). Cannot grant full_access or reassign user_id to another user. |
superuser |
Full access to all keys, refresh tokens, outbound webhooks, and writable global Settings (api_prefix, cors_origins, full_headless, rate_limit, jwt_ttl, refresh_ttl, secret_key). |
CredentialLifecycleGuard enforces ownership checks, blocks non-superuser scope escalations (assertNonSuperuserScopesAllowed()), and protects internal credential writes (withInternalCredentialWrite()).
2. PageAccessPolicy & SelectorGuard
Section titled “2. PageAccessPolicy & SelectorGuard”PageAccessPolicy: Blocks system templates (SYSTEM_TEMPLATES), protected system pages (admin, trash, 404, RBAC containers), and reserved access fields (RESERVED_ACCESS_FIELDS). Every returned page is checked via$page->viewable()andPageCollectionPaginatorhandles custom viewable hooks cleanly.SelectorGuard: Builds sanitized ProcessWire selectors forResourceBlueprintqueries using only declaredfilterable/searchablefields and allowlisted operators (eq,neq,gt,gte,lt,lte,contains), preventing selector injection.EntriesFieldTransformer: Automatically stripsINTERNAL_SECRET_FIELDS(key_hash,token_hash,secret_key,custom_headers) from every API serialization and export.
3. Rate Limiting, Payload Caps, CORS & Demo Mode
Section titled “3. Rate Limiting, Payload Caps, CORS & Demo Mode”| Control | Default / Limit | Details |
|---|---|---|
| Request rate limiter | 120 req / 60s (HlRateLimit cache) |
Configurable globally in Settings, per API key (rate_limit), or per HeadlessAction. |
| Max JSON body size | MAX_JSON_BODY_BYTES = 2_097_152 (2 MiB) |
Enforced by HeadlessKernel before json_decode. |
| Max JSON depth | MAX_JSON_DEPTH = 32 |
Prevents deeply nested JSON DoS payloads. |
| Batch & query bounds | limit <= 1000, MAX_BATCH_ITEMS = 100, maxAggregates = 10, maxWith = 5 |
Enforced in EntryQueryHandler and EntryMutationHandler. |
| CORS origins | Configurable (cors_origins) |
Restrict to explicit origins in production (avoid * with credentials). |
Demo mode ($config->demo) |
Read-only | Blocks POST /pages, Settings writes, and credential mutations automatically. |