Repository navigation
Description
Versions: livewire/blaze v1.0.19, livewire/flux 2.20.1, livewire/flux-pro 2.20.1, laravel/framework 13.35.0, PHP 8.4
Reproduction (no published stubs needed):
@php $label = 'Label'; $value = 'a"b<c>&d\'e'; @endphp
<flux:checkbox :label="$label" :aria-label="$value" />
A dynamic label (listed in the stub's unsafe array) cancels folding, so the component runs through the compiled
path and delegates to checkbox.variants.default.
Expected (what <flux:input :aria-label="$value" /> prints):
aria-label="a"b<c>&d'e"
Actual:
aria-label="a"b&d'e"
The quote is emitted as " and < > & are emitted raw, so the attribute value breaks out of its quotes.
The same happens for every component that delegates to a variant:
- flux:select.option with any dynamic prop from its
unsafelist (description, icon, icon:variant, avatar, loading,
filterable, indicator), in both select.option.variants.default (native select) and .custom (listbox/combobox); - flux:checkbox and flux:radio in every variant (default, cards, buttons, pills, segmented) and flux:checkbox.group /
flux:radio.group in every variant, with a dynamic label, description, name, size or icon; - flux:select.group and flux:select.indicator with a dynamic :variant (select.option.variants.custom renders
<flux:select.indicator :variant="$indicator" /> on every option); - flux:icon with a dynamic :icon / :name, and therefore every <flux:button icon="..."> (icon.index delegates to
icon.); - flux:select / flux:pillbox / flux:date-picker.input (native and custom variants) whenever their index stub is
rendered withoutfold: true.
Static values are decoded too: <flux:checkbox label="L" aria-label="a&b" /> prints aria-label="a&b".
Prefixed attribute bags that a stub forwards with :attributes are printed raw as well: field:, label:,
description:, error: through flux:with-field (checkbox.group, radio.group) and avatar:* in select.option.variants.custom.
Not affected (verified): select.option.create / .empty, checkbox.all, checkbox.indicator, radio.indicator,
editor, editor.toolbar (it delegates to editor. without attributes), date-picker.
Cause: Compiler::compileDelegateComponentTag() (src/Compiler/Compiler.php:165) passes the parent's attributes through
BlazeRuntime::unescapeAttributes() (src/Runtime/BlazeRuntime.php:163-172, htmlspecialchars_decode on every string),
and calls the delegated component with an empty $__bound list (Compiler.php:170 and :179). BlazeAttributeBag::make()
therefore sanitizes nothing, and ComponentAttributeBag::__toString() only replaces " with ". The decoded values
reach {{ $attributes->class(...) }} in the variant raw.
Decoding is presumably there so that props such as label are not double-encoded when printed with {{ }}; but the
same decoded values also stay in the attribute bag that the variant prints as HTML attributes.
Suggested fix: keep the decoded values for props only, or pass the original bound keys to the delegated component
so BlazeAttributeBag::make() sanitizes the remaining attributes as it does for a direct call.
Our workaround: published copies of the delegated variants (select, select.option, select.group, select.indicator,
pillbox, date-picker.input, checkbox, checkbox.group, radio, radio.group) and our own icon components wrap the
attribute bag print with htmlspecialchars($value, ENT_QUOTES, 'UTF-8', false) for string values. Forwarded bags are
patched the same way where their props are already extracted: field:* and description:* where flux:with-field builds
them, the flux:error print and the flux:avatar bag passed to flux:button-or-link.
label:* through flux:with-field is deliberately left unpatched: a copy of flux:label would lose fold: true.
Related: #221 (we found this while publishing unfolded copies of the stubs as a workaround for it).
Activity
mauritskorse commentedon Oct 22, 2026
Just came across the same issue. And can confirm on the same versions (Blaze 1.0.19, Flux 2.20.1, Livewire 4.4.7, Laravel 13.35).
There's one more path worth covering in the fix: an attribute bag that an app or package component forwards into a delegating Flux component. It prints raw even when the Flux call itself is static and would fold.
Since a bound value from user input breaks out of the attribute, this is a stored or reflected XSS for any app with Blaze enabled. Could it be handled as a security issue, with an advisory once fixed, so composer audit flags affected versions?
resources/views/components/my-icon.blade.php:data-x="q"><img src=x onerror=alert(1)>"data-x="q\"><img src=x onerror=alert(1)>", which parses as animg[onerror]element.The same happens with
:class, when the wrapper is itself@blaze, and when the wrapper forwards toflux:selectinstead offlux:icon. The control case,<flux:icon name="home" :data-x="$value" />called directly, prints escaped. As far as I can tell, Blade escapes the bound value once when it builds the wrapper's bag, andunescapeAttributes()then strips that only layer.This matters for component libraries built on Flux. Any component that passes its
$attributes, or a prefixed bag such asicon:*, on toflux:iconorflux:selectexposes its users to this whenever Blaze is enabled, and the user has no way to see it from their own template.On the fix: passing the bound keys to the delegated component would cover direct calls. For a forwarded bag, though, the keys bound at the original call site aren't known to the delegator. A fix that relies on
$__boundalone may still leave this case raw, so it's worth a regression test.MohannadElemary commentedon Oct 22, 2026
Thanks for the case. Reproduced it on 1.0.19 with plain and
@blazewrappers, two levels of wrappers, a delegate inside a delegate,flux:iconandflux:select, andwhereStartsWith/Flux::attributesAfterbags. On #225 the forwarded attributes are escaped the same as plain Blade in all of those, and I added a regression test for the wrapper case. Props read through a delegate still differ from Blade in a few ways that already exist in 1.0.19, noted in the PR. I'll leave the advisory question to the maintainers.ganyicz commentedon Oct 23, 2026
Thanks for reporting @mr-riabov !
This will be fixed in the next release
mr-riabov commentedon Oct 28, 2026
Thanks for the fix! I re-ran our regression suite on v1.0.20 (livewire/flux 2.20.1, flux-pro 2.20.1, PHP 8.4)
with all of our workarounds removed. Delegation now escapes the variant's own attribute bag in every case we
cover (select / select.option / select.group / select.indicator / pillbox / date-picker.input / checkbox /
checkbox.group / radio / radio.group variants, flux:icon, and the field:* / description:* / error:* / label:*
bags of checkbox.group and radio.group). Two things are still open:
A forwarded bag that a variant re-wraps is still printed raw. select.option.variants.custom passes
$avatarAttributes through @unblaze and
new \Illuminate\View\ComponentAttributeBag($scope['attributes']),and the plain bag does not escape:
prints aria-label="a"b&d'e" on the avatar div, while a direct <flux:avatar :aria-label="$v" />
prints aria-label="a"b<c>&d'e".
Direct (non-delegated) path, visible double encoding (not a security issue): a prefixed text that a stub
forwards to a child prop is encoded twice, because the bag value is already sanitized and the child prints it
with {{ }} again. With $v = "it's & co":
<flux:input label="L" :description:trailing="$v" /> (also label:aside / label:trailing / label:badge,
error:message through flux:with-field)
<flux:sidebar.collapse tooltip="T" :tooltip:kbd="$v" />
<flux:pillbox searchable :search:placeholder="$v">...</flux:pillbox>
<flux:toggle 🔛label="$v" /> / :off:label
all show "it's & co" on screen. flux:input does the same for input:* —
$attributes->merge($inputAttributes->getAttributes()) escapes the already sanitized values again.
Since 1.0.20 the same happens for checkbox.group / radio.group on delegation (label:aside etc.).
ganyicz commentedon Nov 3, 2026
@mr-riabov
Thanks for reporting!
The first issue was fixed in the latest release, the second one is intended behavior.