Permissions & Security
Navigation enforces layered authorization across the Admin UI, programmatic API, CLI commands, and optional Headless REST endpoints.
Role-Based Access Control (RBAC)
Section titled “Role-Based Access Control (RBAC)”| Permission | Scope |
|---|---|
navigation |
Access Setup -> Navigation (ProcessNavigation::checkAccess()), view manageable menus, and add, edit, reorder, duplicate, or delete items inside menus where $navigation->canEditMenu($menu) permits. |
navigation-admin |
Full administrative control: create, configure, rename, and delete menu schemas (./edit-menu/), import JSON bundles (?import=1), and manage all menus regardless of per-menu restrictions. |
Per-Menu permission Fail-Closed Guard
Section titled “Per-Menu permission Fail-Closed Guard”Any YAML or database menu can specify a custom permission: (for example, permission: footer-editor). MenuDefinition validates the permission name at load time; if a menu declares a malformed or non-existent permission ($hasInvalidPermission === true), Navigation fails closed across L2 WireCache, canEditMenu(), saveMenu(), and import() so unauthorized users can never edit that menu by mistake.
NavigationSelectorGuard & Output Sanitization
Section titled “NavigationSelectorGuard & Output Sanitization”NavigationSelectorGuard protects both admin inputs and frontend rendering:
- Forbidden System Templates: Blocks
admin,user,role,permission, andlanguagepages from being targeted or expanded bypageandchildrennodes (FORBIDDEN_TEMPLATES). - URL & Suffix Sanitization:
sanitizeUrl()permits only safe schemes (https://,http://,/relative,#anchor,mailto:,tel:) and blocksjavascript:ordata:payloads.sanitizeUrlSuffix()validates query and anchor suffixes. - Allowlisted HTML Attributes:
custom_attributesaccepts onlyid,class,title,target,rel,lang,hreflang,download,aria-*, and safedata-*attributes (ALLOWED_ATTRIBUTE_PATTERN), blocking inline event handlers (onclick,onmouseover). - Safe Children Sorting:
resolveChildrenSortField()andcompileChildrenSelector()allow only validated ProcessWire fields and blockFORBIDDEN_SORT_FIELDSwhen expandingchildrennodes. - Locked Nodes (
STATUS_LOCKED): Locked navigation nodes cannot be dragged, indented, edited, or deleted in the workspace or overwritten byreplaceimports. - CSRF, Demo & Debug Hardening: All
ProcessNavigationmutations validate$session->CSRF, respect$config->demo, and log internal database/filesystem exceptions (NavigationSelectorGuard::isInternalException()) to thenavigationlog channel while returning safe messages when$config->debug === false.