You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Breadcrumbs bypass IExceptionFilter, leaking filtered exception messages into later events #5514
SentrySdk.Init(o =>{o.Dsn="https://[email protected]/0";// any DSN; nothing is actually sent belowo.AddExceptionFilterForType<MyException>();// Only here to inspect what would be sento.SetBeforeSend((e,_)=>{Console.WriteLine($"BeforeSend: {e.Message?.Formatted??e.Message?.Message??e.Exception?.Message}");foreach(varbine.Breadcrumbs??newList<Breadcrumb>()){Console.WriteLine($" breadcrumb: [{b.Category}] {b.Message}");}returnnull;});});
Steps to Reproduce
usingSentry;classMyException:Exception{publicMyException(stringm):base(m){}}classProgram{staticvoidMain(){usingvar_=SentrySdk.Init(o =>{/* see above */});// Doesn't have to be an explicit CaptureException, it can be reproduced with implicit unhandled exceptions tooSentrySdk.CaptureException(newMyException("secret exception message"));SentrySdk.CaptureMessage("some later unrelated event");}}
Register an exception filter for MyException.
Capture a MyException - it's filtered out as expected.
Capture any later, unrelated event (message or more likely a span).
It is possible to filter/process breadcrumbs before they are sent. But at this point we lost exception context and its type, forcing filtering by a string alone.
And speaking of that, Sentry Scrubbing doesn't have an option to scrub breadcrumbs as it seems - no $breadcrumb defined in the Source list. I tried to set [Mask] [Usernames in filepaths] from [$breadcrumb] blindly, but it didn't seem to scrub anything.
@maxkatz6 I've added a solution roughly based on what we do in the sentry-java SDK... there, they don't actually create breadcrumbs for all exceptions but they do when the exception gets captured via one of the logging integrations. In that scenario, they pass the log into the BeforeBreadcrumb callback as a Hint.
In sentry-dotnet we add breadcrumbs for exceptions regardless of whether these get captured via the logging API, by one of our integrations or whether you capture them manually. So for .NET I figured we could pass the Exception itself in to the callback as a Hint:
@jamescrosswell thanks. Yes, BeforeBreadcrumb filtration + exception hint works for me.
Not sure I follow... what are you configuring where and what are you seeing vs what you expect?
I was talking about https://****.sentry.io/settings/security-and-privacy/ "Advanced Data Scrubbing" section. Doesn't seem to be possible to scrub breadcrumbs contents, unless I miss something. But it's not a .NET client issue.
BeforeBreadcrumb filtration + exception hint works for me.
Cool, thanks for validating 👍🏻
https://****.sentry.io/settings/security-and-privacy/ "Advanced Data Scrubbing" section. Doesn't seem to be possible to scrub breadcrumbs contents
Aha, I see. Possibly something to raise with the core product team.
Activity
linear-code commentedon Aug 27, 2026
NET-794
maxkatz6 commentedon Aug 27, 2026
It is possible to filter/process breadcrumbs before they are sent. But at this point we lost exception context and its type, forcing filtering by a string alone.
And speaking of that, Sentry Scrubbing doesn't have an option to scrub breadcrumbs as it seems - no $breadcrumb defined in the Source list. I tried to set
[Mask] [Usernames in filepaths] from [$breadcrumb]blindly, but it didn't seem to scrub anything.jamescrosswell commentedon Aug 31, 2026
Hi @maxkatz6 - interesting problem. I'll do some digging to see it there is already an established way to avoid this in other SDKs.
Not sure I follow... what are you configuring where and what are you seeing vs what you expect?
jamescrosswell commentedon Aug 31, 2026
@maxkatz6 I've added a solution roughly based on what we do in the sentry-java SDK... there, they don't actually create breadcrumbs for all exceptions but they do when the exception gets captured via one of the logging integrations. In that scenario, they pass the log into the BeforeBreadcrumb callback as a Hint.
In sentry-dotnet we add breadcrumbs for exceptions regardless of whether these get captured via the logging API, by one of our integrations or whether you capture them manually. So for .NET I figured we could pass the Exception itself in to the callback as a Hint:
maxkatz6 commentedon Sep 1, 2026
@jamescrosswell thanks. Yes,
BeforeBreadcrumbfiltration + exception hint works for me.I was talking about
https://****.sentry.io/settings/security-and-privacy/"Advanced Data Scrubbing" section. Doesn't seem to be possible to scrub breadcrumbs contents, unless I miss something. But it's not a .NET client issue.jamescrosswell commentedon Sep 1, 2026
Cool, thanks for validating 👍🏻
Aha, I see. Possibly something to raise with the core product team.