joomla/filter
Joomla's Filter package provides input and output sanitization utilities, letting you validate and clean user data and build URL-safe strings for secure PHP applications.
e() helper, Illuminate\Validation\Rules\Sanitize, and packages like htmlpurifier/htmlpurifier already address HTML sanitization. This package introduces redundancy unless Joomla-specific filtering rules (e.g., OutputFilter::stringURLSafe) are explicitly required.javascript:/data: URIs and evasion characters) but lacks Laravel-native features like request validation pipelines or middleware integration. The 3.0.7 release confirms the scope is adversarial input filtering, not general-purpose HTML purification — two bypasses were found and fixed in the URI and entity-decoding paths.Joomla\Language dependency for stringURLSafe creates unnecessary coupling for Laravel apps not using Joomla components.<b>, <i> but block <script>).data: URIs, HTML5 entity decode mismatch) is the classic signature of this design pattern. HTMLPurifier’s parser-based model exists precisely to avoid this class of bug.data: URIs — a data: URI with injected whitespace evaded the scheme check. The prior assessment credited this package with reliably "stripping data: URIs"; that claim is false for versions ≤ 3.0.6.composer audit) is unverified and must be confirmed — silent patches are a supply-chain monitoring gap.TAGS_WHITELIST → ONLY_ALLOW_DEFINED_TAGS).e()) causing double-encoding, and unbenchmarked overhead in high-traffic APIs.joomla/filter ≤ 3.0.6? Is anything pinned to exactly 3.0.6?data: URIs or URI-bearing attributes (href, src, xlink:href) from users — i.e., are they actually exposed to bypass #1?DOMDocument), which is the precondition for the entity-decode mismatch bypass?stringURLSafe), legacy Joomla components, or is the configurable whitelisting the only differentiator?htmlpurifier/htmlpurifier's slower-but-parser-based model now the better risk trade?e() / strip_tags()?Joomla\Language package introduce bloat or conflicts? Any hidden PHP extension requirements (e.g., mbstring)?use Joomla\Filter\InputFilter;
use Illuminate\Validation\Rule;
public function rules()
{
return [
'comment' => [
'required',
Rule::custom(function ($attribute, $value, $fail) {
$filter = new InputFilter();
$filtered = $filter->clean($value, InputFilter::ONLY_ALLOW_DEFINED_TAGS, ['p', 'b', 'i']);
// Compare or return filtered value
}),
],
];
}
namespace App\Http\Middleware;
use Joomla\Filter\InputFilter;
use Closure;
class SanitizeInput
{
public function handle($request, Closure $next)
{
$filter = new InputFilter();
$request->merge([
'input_field' => $filter->clean($request->input_field, InputFilter::ONLY_ALLOW_DEFINED_TAGS, ['a']),
]);
return $next($request);
}
}
$this->app->singleton(InputFilter::class, function ($app) {
return new InputFilter();
});
e(), Blade {{ }}) at render time and scheme allowlisting on any URI attribute (href/src must match ^https?: or a relative path) rather than relying on the filter alone. The entity-decode mismatch bypass is only neutralized end-to-end if the filter and the renderer agree — an independent scheme/attribute check closes that gap.laravel-joomla-filter) to abstract Joomla dependencies and to centralize the compensating URI-scheme check so no team re-implements it.e() for general escaping.joomla/filter to 3.0.7 across every consuming service. Loosen any exact pin on 3.0.6 (e.g., 3.0.6 → ^3.0.7 or ~3.0.7).composer update joomla/filter --with-dependencies, then composer audit.data: URIs with embedded whitespace/tabs/newlines, and payloads relying on named-entity decoding (e.g., :, 	, 
).href/src).e() and strip_tags().strip_tags() calls with InputFilter where configurable whitelisting is needed; phase out custom regex-based sanitization.htmlpurifier/htmlpurifier or Laravel native tools. Note the 3.0.7 findings raise the probability of triggering this plan.joomla/language if stringURLSafe is used; avoid pairing with htmlpurifier/htmlpurifier (duplicate sanitization).| Constraint | Status |
|---|---|
3.0.7 (PHP 8.1+) |
Recommended — includes both XSS fixes |
3.0.6 and below |
Vulnerable — do not deploy |
4.x (PHP 8.3+) |
Verify equivalent fixes are present in the 4.x line |
joomla/filter consumers to 3.0.7; confirm composer audit is clean; verify 4.x consumers received the equivalent fix.~3.0.7 (never a bare 3.0.6 pin).InputFilter and adds the URI-scheme allowlist.^3.0.7) — not an exact 3.0.6. Exact patch pins now have a demonstrated security cost.joomla-framework/filter and enable composer audit in CI.composer why-not joomla/filter to check for conflicts. Consider a custom fork if the package stagnates (low effort — small codebase) — but note a fork means we own all future bypass remediation, which 3.0.7 shows is real, recurring work.Joomla\Language dependency warnings.strip_tags fallback, which is weaker — flag as temporary only). Train devs to test with OWASP XSS payloads, specifically whitespace-obfuscated data: URIs, HTML5 named entities, and mutation-XSS vectors.e() and strip_tags() for high-traffic endpoints; cache InputFilter instances via the service container. Any compensating scheme-check added post-3.0.7 should be a cheap regex and not a second full parse.| Failure Scenario | Trigger | Impact | Mitigation |
|---|---|---|---|
XSS bypass — whitespace in data: URI |
Filter ≤ 3.0.6; user-supplied URI attribute | Script execution in victim browsers; stored XSS if persisted | Upgrade to 3.0.7; enforce independent ^https?:/relative scheme allowlist |
| XSS bypass — HTML5 entity decode mismatch | Filter ≤ 3.0.6; sanitized HTML rendered by an HTML5 parser | Payload reconstitutes post-filter; mutation XSS | Upgrade to 3.0.7; contextual output escaping at render; regression-test entity payloads |
| Undiscovered bypass class | SVG/MathML foreign content, CSS injection, further encoding differentials | Unknown; potentially stored XSS | Assume not fully solved; independent output escaping as defense-in-depth; periodic red-team payload review |
| Silent advisory / detection lag | No CVE/GHSA published; no advisory subscription | Extended exposure window well beyond patch availability | Subscribe to GitHub Advisories + composer audit in CI; routine release-note review |
| Major version breakage (v3 → v4) | PHP 8.3 requirement; renamed constants | Build failures, refactor cost | Stay on 3.0.7; stage v4 with full test suite |
| Over-escaping / double encoding | Filter output re-escaped by Blade {{ }} |
Corrupted output (e.g., &amp;), broken links |
Decide escape-at-input vs escape-at-output per layer; document the contract |
| Misconfigured whitelist | Overly permissive tag/attribute list | Allows unsafe attributes (on*, style) |
Restrictive defaults; config review in code review |
| Package abandonment | Maintainer inactivity at 15 stars | No future security patches | Maintain fork only with explicit ownership of CVE response; else migrate to HTMLPurifier |
Joomla\Language resolution failure |
Optional dependency omitted but stringURLSafe called |
Runtime exception | Guard the call path; avoid stringURLSafe in Laravel-only services |
How can I help you explore Laravel packages today?