artisanpack-ui/security
Core Laravel security toolkit for ArtisanPack UI: sanitization, escaping (Laminas Escaper), KSES filtering, validation rules, security/CSP middleware, CSP builder with nonce & reporting, rate limiting, audit/scan commands, and testing helpers.
Security facade and global helpers (sanitizeEmail(), escHtml()) reduces boilerplate while maintaining explicit control—ideal for teams balancing consistency and convenience.csp, security.headers, xss.protection) integrates seamlessly with Laravel’s routing system, enabling granular security policies per route/group.kses(), escJs(), and sanitizeArray() address OWASP Top 10 risks (e.g., XSS, Injection) proactively, reducing custom validation logic.laminas/laminas-escaper, laravel/sanctum) are standardized and non-intrusive. Optional Livewire support is opt-in and isolated.security.php config centralizes policies (e.g., CSP directives, rate limits), enabling environment-specific tuning (dev/staging/prod).security:audit, security:scan) reduce manual security testing during CI/CD.unsafe-inline tradeoffs). The package mitigates this with:
default, strict).csp_violation_reports table).csp:test command in staging.api.rate_limit thresholds.UPGRADE.md guides splitting auth/RBAC into sibling packages.security-auth, rbac, etc., are optional but tightly coupled. Over-fetching may bloat the app.security-full meta-package judiciously.unsafe-inline? If so, how will exceptions be documented?artisanpack-ui/compliance be needed?security:scan) can be gated in pipelines.htmlspecialchars, custom regex) and escaping logic.sanitizeEmail() instead of filter_var()).security.headers to all routes).csp:test in staging.Str::of()->escape()) in favor of escHtml().Str::of()->markdown() with kses() if HTML is allowed in user content.security:benchmark to compare performance before/after adoption.security:audit to validate coverage.spatie/csp. Solution: Merge policies or disable duplicate middleware.throttle middleware. Solution: Use api.rate_limit explicitly for consistency.csp_violation_reports) is optional and uses standard Eloquent syntax.| Step | Action | Dependencies | Risk |
|---|---|---|---|
| 1. Setup | Install package, publish config, update composer.json. |
None | Low |
| 2. Core Sanitization | Replace htmlspecialchars/filter_var with sanitize*() helpers. |
None | Medium (logic changes) |
| 3. Middleware | Add security.headers and xss.protection to App\Http\Kernel. |
Step 2 | Low |
| 4. CSP Implementation | Configure CSP in security.php, test with csp:test. |
Step 3 | High (CSP misconfig risk) |
| 5. Rate Limiting | Apply api.rate_limit to API routes. |
Step 4 | Medium (performance impact) |
| 6. Audit | Run security:audit and security:scan in CI. |
All steps | Low |
| 7. Monitoring | Set up CSP violation alerts and performance benchmarks. | Step 6 | Low |
security.php reduces magic values in code. Risk: Forgetting to update policies across environments.
config:clear in CI and enforce config validation.security-auth) may introduce breaking changes.
composer.json or use security-full for stability.extends Sanitizer). Risk: Forking the package.
csp:stats and the Livewire dashboard to identify violations.sanitizeText() dropping critical HTML).How can I help you explore Laravel packages today?