Comments (3)
Hi @MakerTim - you should be able to use the redactedKeys
config option to filter out breadcrumb metadata that contains sensitive data. Do you think this will work for your use case?
from bugsnag-php.
@MakerTim Hi! We've faced a similar situation in different projects and agree that sanitizing data within breadcrumbs is a bit tricky with the current implementation. It would be nice to see an easier way to do it in this package directly, in the meantime here is the code we are using to do so.
It's a little "magic" as we are using a closure that we bind to the report instance to modify the value of its $breadcrumbs
property but it works 😄
// Our own sanitizer service
$sanitizer = $this->sensitiveDataSanitizer;
// Call registerCallback on Client
$bugsnag->registerCallback(static function (Report $report) use ($sanitizer): void {
// First we sanitise the metadata of the report itself
$report->setMetaData($sanitizer->sanitize($report->getMetaData()), false);
// Fetch breadcrumbs from report array representation
$breadcrumbs = $report->toArray()['breadcrumbs'] ?? [];
$redactedBreadcrumbs = [];
// Build our own breadcrumbs array with sanitized data
foreach ($breadcrumbs as $breadcrumb) {
if (isset($breadcrumb['metaData'])) {
$breadcrumb['metaData'] = $sanitizer->sanitize($breadcrumb['metaData']);
}
$redactedBreadcrumbs[] = $breadcrumb;
}
// Override the value of $breadcrumbs property on report using bound closure
(function ($property, $value): void {
$this->{$property} = $value;
})->call($report, 'breadcrumbs', $redactedBreadcrumbs);
});
from bugsnag-php.
Going to close this out as there are a couple of workaround options suggested above.
from bugsnag-php.
Related Issues (20)
- Joomla integration ? similar Wordpress.. HOT 1
- StyleCI not working HOT 9
- Packagist hooks need updating HOT 1
- Unable to install on PHP 5.5 HOT 5
- PHP 7.2: count(): Parameter must be an array or an object that implements Countable HOT 3
- Session handler design HOT 1
- Consider using phpstan (or another analyser) on the codebase HOT 2
- Memory exhaustion error reports are lost HOT 4
- setRedactedKeys cannot support non-regex and regex filters at the same time HOT 7
- Option to disable syslog() call HOT 4
- Downstream Vulnerability - Guzzle <1.8.4 >=2.0.0, <2.1.1 HOT 3
- Is payloadVersion set on the wrong object? HOT 2
- Yii2: Logs are not flushed on shutdown HOT 5
- Error running tests with php7.4 HOT 5
- Redact command-line options HOT 4
- New Relic PHP extension causes duplicate errors in BugSnag HOT 2
- startSession immediately triggers deliverSessions HOT 1
- API keys for service accounts
- SSL certificate problem: self-signed certificate in certificate chain
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bugsnag-php.