Front End & XSS
What the framework already does
| Path | Defense |
|---|---|
| Blade output | escaping (Laravel default) |
| Field error messages | Written with textContent; messages are treated as data |
data-state-text | textContent |
dom.repeat | Never goes through the HTML parser; placeholder positions are allow-listed; URLs only allow http(s)/mailto/tel/relative |
@linkerRefSeed | <script type="application/json"> with < > & ' " escaped, so the tag can't be closed |
| Linker error toasts | Fixed text; server messages aren't shown |
dump() debug panel | Sandboxed iframe (no allow-same-origin) |
| Charts | Colors accept only #hex / rgb(); field and method names go through allow-list regexes; data encoded with JSON_HEX_* |
| Actions | No eval; action names must be registered |
What you need to watch
1. Don't output user data with {!! !!}
renderBlade fragments are just Blade; the same rules apply as for any page.
2. Don't open framework-directive attributes in dom.repeat
{{-- ✅ plain-text attributes --}}
<tr data-linker-ref-dom="orders" data-linker-ref-allow="data-status aria-busy">
{{-- ❌ the framework refuses this, but don't try --}}
<tr data-linker-ref-dom="orders" data-linker-ref-allow="data-linker-call">If data decides which method a button calls, data controls behavior. data-linker-*, data-state-*, data-render-*, data-cg-* and data-param-* can never be opened.
3. Inline scripts in fragments
renderBlade runs any <script> in a fragment after inserting it. So a fragment must never contain unescaped user data. Put logic in a CGEvent inside the bundle.
4. No sensitive data in client state
It's memory only and never written to storage, but any code on the page can read it (anyone can listen to cg:state). No passwords, tokens or personal data.
5. Check permit() in your own CGEvents
Code inside the bundle that imports state directly isn't checked. The convention is to check first:
const { ok, name } = permit(element, 'state:write');
if (!ok) return;
state.scope(name).set('x', 1);That's what keeps "the template is the truth" true.
CSP
Because there's no eval path, you can use a CSP without unsafe-eval. The chart engine, FileDrop and other modules follow the same principle. If page fragments contain inline scripts, you'll need a nonce, or rewrite them as CGEvents.