Skip to content

Permissions & Security

Blocks enforces strict RBAC permissions, selector hardening, cryptographic query signing, HTML/attribute sanitization, and iframe handshake checks across every public and administrative surface.

Permission Scope Capabilities Granted
blocks Page editors Author blocks, apply Block Presets, insert Reusable Blocks, and launch the full-screen 3-Zone Visual Studio on editable ProcessWire pages.
blocks-admin Block administrators Administer Layouts (blocks-layouts), Reusable Blocks (blocks-reusable), Presets (blocks-presets), Block Defaults (blocks-defaults), and Categories (blocks-categories) under Setup > Blocks (ProcessBlocks), and use Studio Quick-Create (/_blocks/studio-create).
  • Selector, Entity & Media Ownership Hardening (DynamicSelectorGuard): Blocks OR-groups, sub-selectors, access-bypass modifiers (include=*, check_access=*, status=*), reserved sort/filter fields (pass, password, salt, roles, permissions, email, created_users_id, modified_users_id), system templates (admin, user, role, permission, language, repeater_*, 404), hidden or secret module blueprints (blocks-*, seo-*, forms-*, navigation-*, headless-*, auth-*, ai-*), and invalid UUIDs. Verifies isPublicPage(), isPublicEntry(), isPageFileAssetAccessible() (field-level useRoles), and isAccessibleEntryAssetOwner() before exposing records or media.
  • HMAC-SHA256 Signed Smart Queries (SignedSmartQueryCodec): /_blocks/smart (GET / HEAD) never accepts raw selectors from client requests. Query payloads are HMAC-SHA256 signed using a domain-separated key derived from $config->userAuthSalt, verified with hash_equals(), bounded at 16384 bytes, JSON depth 32, and 86400-second default TTL (clamped when a block has an active _blocks_publish_until expiry window).
  • Attribute Allowlisting & Rich-Text Sanitization:
    • AttributeSanitizer restricts _blocks_attributes strictly to lowercase data-* (excluding data-blocks* and data-hx*), aria-*, and role, and rejects javascript:, vbscript:, data:, and protocol-relative // URLs.
    • Rich-text HTML across PhpBlockRenderer, PlainHtmlExtractor, BlockFieldValueResolver, BlockNodeFinalizer, FieldMappingEvaluator, and BlockParamsResolver is purified uniformly via Totoglu\React\Tiptap\TiptapContentPolicy::sanitizeHtml().
  • Ephemeral Live Preview & Demo Mode Guards (LivePreviewRenderer):
    • POST /_blocks/preview requires an authenticated user (superuser, blocks, blocks-admin, or page-edit + $page->editable()), validates ProcessWire $session->CSRF, enforces a 2 MB (2097152-byte) body limit, depth 32, MAX_SNAPSHOT_DEPTH = 10, and MAX_BLOCKS_PER_STREAM = 200, sets X-Frame-Options: SAMEORIGIN and Content-Security-Policy: frame-ancestors 'self', and binds a stateless 128-bit HMAC-SHA256 LivePreviewRenderer::sessionNonce() for strict ev.source and origin postMessage handshake checks. It never writes to the database.
    • All write paths (ProcessBlocks::___executeAction(), delegated ___executeEdit(), /_blocks/studio-create, and non-dry_run BlocksCapabilityProvider AI tools) block writes when $config->demo is enabled.

Next steps