Laravel Scrubber is a Laravel package to scrub sensitive information that breaks operational security policies from being leaked on accident or not by developers.
You can use this package in a few ways:
First, this package detects log messages and context patterns and scrubs them:
Log::info('some message', [ 'context' => 'accidental', 'leak_of' => [ 'jwt' => '<insert jwt token here>' ] ]); // testing.INFO: some message {"context":"accidental","leak_of":{"jwt": '**redacted**'}} Log::info('<insert jwt token here>'); // testing.INFO: **redacted**
Second, you can use the scrubber directly to process data in an array and mark it as redacted:
Scrubber::processMessage([ 'context' => 'accidental', 'leak_of' => [ 'jwt' => '<insert jwt token here>' ] ]); // [ // "context" => "accidental" // "leak_of" => [ // "jwt" => "**redacted**" // ] // ]; Scrubber::processMessage('<insert jwt token here>'); // **redacted**
This package also provides customization options, such as configuring the replacement message when data is scrubbed (the default is **redacted**). You can also extend the package by adding custom regex scrubbers.
You can start with Laravel Scrubber by checking out the project on GitHub at YorCreative/Laravel-Scrubber.