Skip to content

Instantly share code, notes, and snippets.

@niemyjski
Last active August 9, 2016 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niemyjski/29f1d44f9891c816661c360cfc044133 to your computer and use it in GitHub Desktop.
Save niemyjski/29f1d44f9891c816661c360cfc044133 to your computer and use it in GitHub Desktop.
Exceptionless Plugin to remove sensitive string post data
// Sometimes post data cannot be converted (non form data) so we serialize it to a stirng.
// This plugin adds some overhead as you are checking post data (really large string)
[Priority(100)]
internal class RemoveSensitivePostDataPlugin : IEventPlugin {
public void Run(EventPluginContext context) {
var serializer = context.Client.Configuration.Resolver.GetJsonSerializer();
var ri = context.Event.GetRequestInfo(serializer);
string data = ri != null ? ri.PostData as string : null;
if (data == null)
return;
if (data.AnyWildcardMatches(context.Client.Configuration.DataExclusions, true))
ri.PostData = "Post data contains sensitive information.";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment