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.
RBAC Permissions
Section titled “RBAC Permissions”| 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). |
Defense-in-Depth Security Boundaries
Section titled “Defense-in-Depth Security Boundaries”- 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. VerifiesisPublicPage(),isPublicEntry(),isPageFileAssetAccessible()(field-leveluseRoles), andisAccessibleEntryAssetOwner()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 withhash_equals(), bounded at16384bytes, JSON depth32, and86400-second default TTL (clamped when a block has an active_blocks_publish_untilexpiry window). - Attribute Allowlisting & Rich-Text Sanitization:
AttributeSanitizerrestricts_blocks_attributesstrictly to lowercasedata-*(excludingdata-blocks*anddata-hx*),aria-*, androle, and rejectsjavascript:,vbscript:,data:, and protocol-relative//URLs.- Rich-text HTML across
PhpBlockRenderer,PlainHtmlExtractor,BlockFieldValueResolver,BlockNodeFinalizer,FieldMappingEvaluator, andBlockParamsResolveris purified uniformly viaTotoglu\React\Tiptap\TiptapContentPolicy::sanitizeHtml().
- Ephemeral Live Preview & Demo Mode Guards (
LivePreviewRenderer):POST /_blocks/previewrequires an authenticated user (superuser,blocks,blocks-admin, orpage-edit+$page->editable()), validates ProcessWire$session->CSRF, enforces a2 MB(2097152-byte) body limit,depth 32,MAX_SNAPSHOT_DEPTH = 10, andMAX_BLOCKS_PER_STREAM = 200, setsX-Frame-Options: SAMEORIGINandContent-Security-Policy: frame-ancestors 'self', and binds a stateless 128-bit HMAC-SHA256LivePreviewRenderer::sessionNonce()for strictev.sourceandoriginpostMessagehandshake checks. It never writes to the database.- All write paths (
ProcessBlocks::___executeAction(), delegated___executeEdit(),/_blocks/studio-create, and non-dry_runBlocksCapabilityProviderAI tools) block writes when$config->demois enabled.