artisanpack-ui/security
Core Laravel security toolkit for ArtisanPack UI: input sanitization, output escaping, KSES filtering, validation rules, security headers, XSS protection, rate limiting, and CSP with nonces, presets, and violation reporting, plus audit, scan, and benchmark Artisan commands.
Strict / Relaxed / Livewire presets, a violation reporting endpoint, a stored violation model, and a dashboard plus csp:stats / csp:prune. That sequence (report-only → observe real violations → tighten → enforce) lets a PM schedule CSP as a tracked workstream with data, rather than as a one-way ticket that produces a rollback.NoHtml / SecureUrl validation rules is a direct enabler for those features, and the allowlist is configurable, which means the product decision "what markup do we permit in a comment?" becomes a config change rather than a code change.security:audit, security:scan, security:check-config, security:test-headers, security:scan-deps, and security:baseline, with report generators emitting JSON, HTML, JUnit, SARIF, and Markdown, are effectively a CI-gate and audit-evidence pipeline. This is the strongest PM-relevant asset in the package: it converts "we care about security" into artifacts you can attach to a SOC 2 control, a customer security questionnaire, or a pull-request check.ap.security.csp.directives filter lets the host app mutate the directive array per request. That makes "marketing wants tag manager on checkout" a reviewable, centralized policy decision instead of an ad-hoc template edit.security-auth, rbac, secure-uploads, security-analytics, compliance, with a security-full meta-package) is a deliberate product decision by the maintainer in favor of composability. For a PM this is a scope signal: you can adopt the core narrowly today and defer auth/compliance suites, but each sibling you add deepens vendor lock-in to this ecosystem.Consider it when:
artisanpack-ui/hooks) only pays off inside that ecosystem.e(); the marginal value here is nonces, policy presets, violation reporting, and security.headers middleware in one coherent unit.ap.security.sanitizedInput, ap.security.escapedOutput, and ap.security.ksesAllowedTags subscribers can weaken the guarantees the package provides. That is a governance requirement, not a footnote — treat those hooks as privileged, code-reviewed surface.Look elsewhere when:
spatie/laravel-csp, HTMLPurifier/mews/purifier, or framework primitives) or budget for internal review.e(), and Laravel's validation rules. Do not add a dependency for escHtml.export-ignore had stripped from the release tarball, breaking package discovery for every consumer; and 2.1.0 fixed sanitizeFloat() returning a string under a float return type — a TypeError that implies the method had essentially never been exercised. Neither is disqualifying given the 2026-07-21 release, but they argue for a spike with test coverage before wider adoption.To executives: This is a security-controls package, not a feature. It gives us Content Security Policy with a report-only-to-enforce path, standard security headers, sanitization/escaping utilities, and — most usefully — audit commands that generate CI reports and audit-ready artifacts (SARIF, JUnit, HTML, Markdown). The business case is cost avoidance and evidence: we get a documented, reproducible security posture story for customer questionnaires and compliance reviews without building the tooling ourselves. It is MIT-licensed, so there is no procurement or per-seat cost. Caveat to state plainly: it is early-stage with a single-maintainer profile and no measurable adoption, so I recommend a scoped pilot (CSP + headers middleware + audit commands in CI) rather than an org-wide mandate, with a documented exit path to spatie/laravel-csp or framework primitives if the project stalls.
To engineering: Thin, conventional Laravel package — service provider, Security and Csp facades, global helper functions, config publish via vendor:publish --tag=security-config, and route middleware (csp, security.headers, xss.protection, api.security, api.rate_limit). Escaping is Laminas Escaper-backed; KSES is htmLawed-backed; both are known quantities rather than bespoke implementations, which is the right call. CSP adds a nonce Blade directive, three policy presets including a Livewire-aware one, a violation reporting endpoint with a CspViolationReport model, and Artisan commands (csp:test, csp:stats, csp:prune, security:generate-csp). Optional Livewire dashboard is opt-in, so no forced frontend dependency. Extension points come through artisanpack-ui/hooks filters/actions — useful, but they are an escape hatch that can undo the package's guarantees, so they go behind code review. Two known release-quality data points to design around: pin the exact version (a bad export-ignore once shipped a tarball missing a registered command), and add our own tests around anything we rely on (a return-type bug survived in sanitizeFloat until 2.1.0). Proposed first milestone: security.headers + CSP in report-only with the violation endpoint wired to our alerting, plus the audit commands in CI; measure violations for two sprints before flipping to enforce.
How can I help you explore Laravel packages today?