kreativsoehne/sulu-email-obfuscator-bundle
A Sulu CMS bundle for obfuscating email addresses in templates and content, helping protect them from spam bots while keeping mailto links usable for visitors. Lightweight integration for Sulu/Twig projects.
Architecture fit. Despite being catalogued here as a Laravel/PHP package, the release notes describe a Sulu CMS bundle (Symfony bundle + Twig extension + response post-processor), not a Laravel package. There is no service provider, no config publish tag, and no middleware in the Laravel sense. If the target stack is Laravel, architectural fit is poor out of the box; if the target stack is Sulu/Symfony, fit is good — it uses the conventional "rewrite the finished response" pattern, which is the correct layer for email obfuscation because it is template-agnostic and works for content authored by editors in the CMS.
Integration feasibility. High for Sulu: activation is bundle registration, with no template edits required. Two escape hatches exist for cases where the template wants control: the sulu_obfuscate_email / sulu_obfuscate_emails Twig filters. The data-obfuscated-email marker on rewritten links is a sound design decision — it separates "browser knows what to un-rotate" from "rewriter knows what it has already seen", which is the usual source of double-processing bugs. Preview bypass via the request's preview attribute is pragmatic but Sulu-specific; anything outside Sulu's preview flow (draft shares, staging domains, AJAX preview) will not be detected.
Technical risk. Mostly concentrated in the HTML string rewriting:
mailto:, emails injected by JavaScript at runtime).script, style, textarea, title, non-mailto link content) is the right starting set, but it also means emails in JSON-LD, meta tags, data-* attributes, and img alt text are untouched — a partial-coverage story that must be documented, not discovered.eval/inline script. This is the single largest unknown for a TPM: it determines CSP posture and whether the feature silently fails in hardened environments.noscript behavior.Key questions.
eval)?Vary/cache headers) beyond the preview attribute?Stack fit. Only adopt directly if we run Sulu 2.x on Symfony with Twig 3. For a Laravel estate, this is at best a reference implementation: the rewriter core is reusable, but the delivery mechanism (Symfony response listener, Twig extension) must be replaced with Laravel middleware and a Blade directive/helper.
Migration path. Greenfield — there is no incumbent implementation to migrate from, which is an advantage. Two viable paths:
Illuminate\Http\Middleware, expose @obfuscateEmail / @obfuscateEmails Blade directives as equivalents of the Twig filters, and reimplement the preview bypass against our own draft/preview mechanism rather than Sulu's request attribute.Compatibility. Verify supported PHP/Symfony/Twig versions before committing. Confirm whether the client-side component (if any) conflicts with our CSP, our tag manager, or our existing mailto handlers. Confirm behavior under response caching and CDN: obfuscated HTML is safe to cache, but any preview bypass must set Vary/Cache-Control: private correctly, otherwise draft content leaks to anonymous visitors — a security-relevant failure mode, not a cosmetic one.
Sequencing.
Maintenance. Highest operational concern. v1.0.0, single "first draft" release, German-only documentation, and an implied small maintainer base. We should assume we will own this code. Budget for a vendored fork with our own regression suite over real page fixtures, or accept the risk explicitly and timebox it.
Support. No upstream SLA. Internal ownership must be assigned before rollout, ideally to the team that owns the CMS frontend. Document the exclusion list and the bypass mechanism, because the first support ticket will be "why is this email address still visible?" or "why did the contact link stop working?"
Scaling. The pass is O(n) over each HTML response with a full body copy in memory. For typical CMS pages this is negligible; for large listing pages, PDF/binary responses, or streamed responses it matters, and the listener must explicitly skip them. CDN and reverse-proxy behavior needs care: correct Vary and cache-key treatment for the preview bypass is mandatory. Also account for double-processing via ESI, sub-requests, or nested bundles — the data-obfuscated-email marker mitigates this, but only if the rewriter genuinely checks it.
Failure modes.
data-*, image alt text remain scrapable; marketing may believe they are protected.Ramp-up. Low for a Sulu/Twig team — it is essentially install-and-go, with the opt-out filters as the only thing to learn. Medium for a Laravel team: the concepts transfer, but the implementation must be ported and re-tested, and German-language docs plus a missing JS/distribution story add friction. Recommend one engineer own the spike end-to-end and produce an internal README covering the transformation scheme, the exclusion list, the bypass rules, and the client-side contract before any wider rollout.
How can I help you explore Laravel packages today?