Skip to content

Commit

Permalink
chore: Revert adding an EventScrubber (#3441)
Browse files Browse the repository at this point in the history
  • Loading branch information
bitsandfoxes committed Jun 21, 2024
1 parent 2ef9f80 commit c12fc96
Show file tree
Hide file tree
Showing 15 changed files with 2 additions and 576 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

- Added a new package `Sentry.AspNetCore.Blazor.WebAssembly`. This packages provides you with an extension to `WebAssemblyHostBuilder` to allow SDK configuration via the builder pattern. This package gives us an entry point and the ability to extend the SDKs support and out-of-the-box offering. You can follow the progress and leave feedback either ([here](https://github.com/getsentry/sentry-dotnet/issues/2329)) for extending the support for Blazor Server or ([here](https://github.com/getsentry/sentry-dotnet/issues/2021)) for Blazor WebAssembly support ([#3386](https://github.com/getsentry/sentry-dotnet/pull/3386))
- Added a new package `Sentry.AspNetCore.Blazor`. This packages provides you with an extension to `WebAssemblyHostBuilder` to allow SDK configuration via the builder pattern. This package gives us an entry point and the ability to extend the SDKs support and out-of-the-box offering. You can follow the progress and leave feedback either ([here](https://github.com/getsentry/sentry-dotnet/issues/2329)) for extending the support for Blazor Server or ([here](https://github.com/getsentry/sentry-dotnet/issues/2021)) for Blazor WebAssembly support ([#3386](https://github.com/getsentry/sentry-dotnet/pull/3386))
- Added an event scrubber to remove sensitive data from events before sending these to Sentry ([#3419](https://github.com/getsentry/sentry-dotnet/pull/3419))

### Fixes

Expand Down

This file was deleted.

79 changes: 0 additions & 79 deletions benchmarks/Sentry.Benchmarks/EventScrubberBenchmarks.cs

This file was deleted.

15 changes: 2 additions & 13 deletions src/Sentry/Breadcrumb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Sentry;
[DebuggerDisplay("Message: {" + nameof(Message) + "}, Type: {" + nameof(Type) + "}")]
public sealed class Breadcrumb : ISentryJsonSerializable
{
private readonly Dictionary<string, string>? _data;
private readonly IReadOnlyDictionary<string, string>? _data;
private readonly string? _message;

private bool _sendDefaultPii = true;
Expand Down Expand Up @@ -59,9 +59,7 @@ public sealed class Breadcrumb : ISentryJsonSerializable
x => x.Value.RedactUrl()
)
;
private init =>
_data = value as Dictionary<string, string>
?? value?.ToDictionary(v => v.Key, v => v.Value);
private init => _data = value;
}

/// <summary>
Expand Down Expand Up @@ -131,15 +129,6 @@ public sealed class Breadcrumb : ISentryJsonSerializable
Level = level;
}

internal void ScrubData(string dataKey, string replacement)
{
if (_data is null)
{
return;
}
_data![dataKey] = replacement;
}

/// <inheritdoc />
public void WriteTo(Utf8JsonWriter writer, IDiagnosticLogger? logger)
{
Expand Down
175 changes: 0 additions & 175 deletions src/Sentry/Internal/EventScrubber.cs

This file was deleted.

2 changes: 0 additions & 2 deletions src/Sentry/SentryClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,6 @@ private SentryId DoSendEvent(SentryEvent @event, SentryHint? hint, Scope? scope)
}
}

_options.EventScrubber?.ScrubEvent(processedEvent);

processedEvent = BeforeSend(processedEvent, hint);
if (processedEvent == null) // Rejected event
{
Expand Down
58 changes: 0 additions & 58 deletions src/Sentry/SentryOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1761,62 +1761,4 @@ internal void SetupLogging()
// In the future, this will most likely contain process ID
return TryGetDsnSpecificCacheDirectoryPath();
}

private EventScrubber? _eventScrubber;
internal EventScrubber? EventScrubber
{
get
{
if (_denyList.Count == 0)
{
return null;
}
_eventScrubber ??= new EventScrubber(_denyList); // Instantiate and cache the scrubber only if needed
return _eventScrubber;
}
set => _eventScrubber = value;
}

private List<string> _denyList = EventScrubber.DefaultDenylist.ToList();

/// <summary>
/// By default, sensitive data is scrubbed from events that get sent to Sentry. This option allows you to disable
/// this default behavior. Alternatively you can use <see cref="ScrubData(IEnumerable{string})"/> or
/// <see cref="ScrubData(Action{IList{string}})"/> to configure scrubbing behaviour.
/// </summary>
public void DisableScrubbing()
{
_denyList = [];
}

/// <summary>
/// <para>
/// By default, sensitive data is scrubbed from events that get sent to Sentry using a "deny list" that contains
/// the names of various keys that are commonly used to store sensitive data. If items from the deny list are found
/// in Cookies, Headers, StackFrames etc. then the value for these items will be scrubbed and replaced with `*****`.
/// </para>
/// <para>
/// This method allows you to override the default deny list that Sentry uses with your own list of strings used to
/// identify potentially sensitive data.
/// </para>
/// </summary>
public void ScrubData(IEnumerable<string> denyList)
{
_denyList = denyList.ToList();
}

/// <summary>
/// <para>
/// By default, sensitive data is scrubbed from events that get sent to Sentry using a "deny list" that contains
/// the names of various keys that are commonly used to store sensitive data. If items from the deny list are found
/// in Cookies, Headers, StackFrames etc. then the value for these items will be scrubbed and replaced with `*****`.
/// </para>
/// <para>
/// This method allows you to modify the list of strings used to identify potentially sensitive data.
/// </para>
/// </summary>
public void ScrubData(Action<IList<string>> configureDenyList)
{
configureDenyList.Invoke(_denyList);
}
}
Loading

0 comments on commit c12fc96

Please sign in to comment.