Last active
August 9, 2016 14:33
-
-
Save niemyjski/29f1d44f9891c816661c360cfc044133 to your computer and use it in GitHub Desktop.
Exceptionless Plugin to remove sensitive string post data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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