yorcreative/laravel-scrubber
A Laravel package that automatically scrubs sensitive data such as passwords, API keys, and PII from logs, requests, and model output, with configurable redaction rules to keep private information out of your application's records.
Architecture fit. yorl/laravel-scrubber is a defense-in-depth control, not a data-governance platform. Architecturally it slots into the Laravel logging/exception pipeline — a service provider with auto-discovery, a publishable config file containing scrub rules, and (most likely) a Monolog processor or handler decorator that mutates log records before they hit a channel. That is the right shape for a Laravel estate: no infrastructure, no new runtime, no sidecar, no vendor contract. It fits cleanly alongside existing config/logging.php channels, exception handlers, Telescope, Horizon, and Sentry/Bugsnag SDKs, provided processor ordering is explicit. It does not solve secrets management, PII in database columns, or data leaving via analytics/queue payloads that never traverse the logger.
Integration feasibility. Low-to-moderate effort. Expect a half-day to a day per service for install, config authoring, and validation, assuming the package behaves as described. The real cost is not engineering — it is the policy work: agreeing what counts as sensitive, encoding that as patterns, and proving coverage. Budget 2–3 sprints for a multi-service rollout, of which 70% is security/policy alignment and verification, not code.
Technical risk. The dominant risk is the class of tool: regex/keyword redaction is inherently approximate. False negatives are a compliance incident; false positives silently destroy the forensic value of logs and erode developer trust until someone disables the package. Secondary risks are material for a TPM:
| Risk | Severity | Note |
|---|---|---|
| Provenance uncertainty — repo is listed as unknown, metadata is inconsistent, and the "last release" date (2026-09-10) is not credible | High | Treat package identity and supply chain as unverified until composer show / Packagist / GitHub source are confirmed by hand |
| Single-maintainer abandonment | Medium-High | 158 stars is small; MIT license mitigates via fork, but someone must own the fork |
| Over-redaction breaking incident response | High | Must be reversible/marked, not blanked, and tested against real incident scenarios |
| Performance on the hot path | Medium | Regex-per-record cost scales with log volume and Octane worker reuse |
| Coverage gaps (non-Monolog egress, DB, queue payloads, third-party SDK breadcrumbs) | High | Package scope is almost certainly narrower than "no leaks" |
Key questions (must be answered before a rollout decision):
context/trace, request/response dumps, queue job payloads, Telescope entries, Sentry breadcrumbs? Or only one of these?sk_, GitHub PATs, IBAN, national IDs)?config:cache, and does it behave correctly under Octane's long-lived workers?Stack fit. Composer-installed Laravel package, PHP 8.x, Monolog 2/3. No runtime, no infra, no egress change — it deploys with the application artifact and works identically on VMs, containers, and serverless Laravel runtimes. It is compatible in principle with structured JSON logging, which is the configuration I would mandate alongside it, because JSON + explicit redaction markers is auditable; free-text log lines are not.
Migration path. Do not treat this as a big-bang security fix.
Compatibility checks that must be explicit:
report()/render() overrides and custom exception handlers.php artisan config:cache and optimize in the deploy pipeline (a stale or uncached config is a silent no-op).Sequencing. Security owns the pattern taxonomy; platform owns the default config and the shared Composer constraint; application teams own per-service overrides. Land the package after the logging standard (structured JSON, no dump()/dd(), no Log::info($request->all())) and before you claim log-hygiene compliance in any customer-facing or audit context.
TPM leverage point. Ship it as part of the golden-path service template so every new service inherits it, and treat backfill as a tracked migration with a burndown. Otherwise you get 30% adoption and a false sense of coverage.
Maintenance. This is a small, single-maintainer dependency — pin it to an exact version, vendor it or maintain an internal fork if the repo provenance cannot be verified, and assign a named owner. The pattern library needs a recurring review cadence (quarterly minimum, plus on every incident and every new third-party integration that introduces a credential format). A stale pattern library is the most likely cause of eventual failure, and it fails silently.
Support model. Split accountability: Security owns what is sensitive and signs off on patterns; Platform owns the shared config, the Composer constraint, and the fork-if-needed contingency; Application teams own per-service overrides and the redaction tests. Two runbooks are mandatory: "a log line shows [REDACTED] where I need the value" (break-glass, time-boxed, audited) and "a suspected leak reached a log sink" (rotate, purge, disclose, post-mortem). Without the first, engineers will disable the package; without the second, you cannot prove the control works.
Scaling. Cost scales with log volume and pattern count, on the request hot path. At high throughput, mitigate with sampling for high-volume debug channels, async/buffered handlers, and keeping pattern count bounded and pre-compiled. Watch Octane memory if the package compiles patterns per worker. The redaction marker itself becomes a cardinality concern in log search — standardize on one token.
Failure modes to design against:
dd() in a debugging branch is untouched.Ramp-up. A Laravel engineer can integrate in under a day; the organizational ramp is the long pole. Expect one sprint to establish the pattern taxonomy and test corpus, one to pilot and measure, and one to two to roll out across the estate. Onboard teams with a one-page standard plus the golden-path template, not a wiki.
Success metrics to report upward: percentage of production services instrumented with a verified (not just installed) config; canary-detection pass rate; redaction false-positive rate sampled monthly; count of confirmed sensitive-data-in-logs incidents (target: zero, trending); p99 request latency delta; and time-to-patch for the dependency. Frame this to stakeholders as risk reduction on a known control gap, not as compliance certification — the package reduces accidental leakage; it does not make the estate compliant, and it is not a substitute for secrets management, data classification, or log retention policy.
How can I help you explore Laravel packages today?