Security, Localization & Troubleshooting
Every client-to-server interaction in React flows through a hardened set of /_react/* gateway endpoints with layered cryptographic, RBAC, CSRF, and upload defenses.
Gateway Endpoints & Security Architecture
Section titled “Gateway Endpoints & Security Architecture”| Endpoint | Purpose | Enforcement |
|---|---|---|
/_react/viewport |
Data viewport queries, inline edit, quick edit, bulk actions, CSV export | Authenticated user, HMAC-SHA256 stateToken (typ = 'viewport'), POST + $session->CSRF + !$config->demo on mutations |
/_react/workspace-prefs |
Per-user favorites, Bento layout, sidebar collapse, theme mode/preset | Authenticated user, POST, $session->CSRF, !$config->demo |
/_react/presence |
Co-editor heartbeat and stale-form save notices | Superuser or workspace access (React::checkAccess()), signed presenceToken, POST, $session->CSRF |
/_react/command-search |
Cmd/Ctrl+K live search across workspaces and editable pages |
Workspace or page-edit access, per-item $page->editable(), Cache-Control: no-store, private |
/_react/relation |
M2O/M2M/O2M/M2A search and cascading lookups |
Authenticated user, signed relationToken, per-resource RBAC |
/_react/media |
Media Studio upload, metadata update, crop/rotate/flip/focus | Entity and language editable() RBAC, signed mediaToken, finfo_file + $sanitizer->validateFile(), 64 MP raster cap, SVG DOMDocument sanitization |
/_react/tiptap |
Tiptap native media and page link dialogs | Signed tiptapToken, TiptapContentPolicy HTML sanitization, RBAC |
/_react/icons |
Read-only vector icon catalog search | Authenticated admin user, read-only |
Core Defense Layers
Section titled “Core Defense Layers”- HMAC-SHA256 Signed Envelopes (
SignedTokenCodec): Derives domain-separated HMAC-SHA256 subkeys from$config->userAuthSalt(requires minimum 16 characters), binds every token touid($user->id),iat(24-hour default TTL, 300-second clock skew limit), and an isolated domain claim (viewport,presence,relation,media,tiptap) so tokens cannot be replayed across users or endpoints. - CSRF & Payload Bounds (
ReactGatewayRouter): Mutating requests enforcePOST(405), validate ProcessWire$session->CSRFviaX-CSRF-TOKEN,X-XSRF-TOKEN, or body fields usinghash_equals()(419), block writes when$config->demo === true(403), and cap JSON bodies at 2 MiB and depth 64. - Safe URLs & Exports (
UrlSanitizer):UrlSanitizer::sanitizeHref(),sanitizeImageSrc(), andsanitizeSameOriginUrl()strip unsafe schemes across workspaces, viewports, and links; CSV exports neutralize spreadsheet formulas.
Multi-Language Localization (i18n)
Section titled “Multi-Language Localization (i18n)”React resolves all UI strings through ProcessWire’s native LanguageTranslator (Setup > Languages) with zero runtime CSV parsing:
- PHP (
___translations()):TranslationCatalogServicecollects strings fromReact::___translations()(and downstream module___translations()hooks) and delivers flattened locale dictionaries viabuildInertiaI18nSharedProps()as a locale-scopedOnceProp(rw_i18n:{locale}:{namespace}). - TypeScript (
useTranslations()/t()): Components importuseTranslationsortfrom@pw/react/hooksto render localized labels with parameter interpolation. - 6-Locale Language Packs:
site/modules/React/languages/ships synchronized CSV import packs foren,tr,de,fr,es, andrucompatible with ProcessWire’sLanguagePorter.
Troubleshooting
Section titled “Troubleshooting”UI Showcase returns a permission error (403 / WirePermissionException)
Section titled “UI Showcase returns a permission error (403 / WirePermissionException)”UI Showcase (/admin/workspace/ui-showcase/) is intentionally restricted to superusers when $config->debug = true in site/config.php. Confirm both conditions before opening the route.
Gateway actions fail with HTTP 419 (CSRF mismatch)
Section titled “Gateway actions fail with HTTP 419 (CSRF mismatch)”A 419 response occurs when a browser tab stays open past ProcessWire’s session lifetime or when a reverse proxy strips cookies. Refresh the page to obtain a fresh $session->CSRF token and XSRF-TOKEN cookie.
Custom Theme Tokens are ignored
Section titled “Custom Theme Tokens are ignored”Verify that Default Theme Preset under Modules > Configure > React is set to Custom and that your CSS defines at least --background, --foreground, --primary, and --primary-foreground inside :root { ... }. ThemeTokenParser rejects blocks containing url(), @import, or expression().
SignedTokenCodec throws an exception about userAuthSalt
Section titled “SignedTokenCodec throws an exception about userAuthSalt”ProcessWire’s $config->userAuthSalt in site/config.php must be at least 16 characters long. Never leave userAuthSalt blank in local or staging environments.
Dark mode toggle does not apply in classic ProcessWire Admin
Section titled “Dark mode toggle does not apply in classic ProcessWire Admin”Check whether AdminThemeUikit has noDarkMode enabled in its module settings. ThemeManager intentionally respects AdminThemeUikit’s noDarkMode preference.