Redacting passwords & sensitive information with a Custom Event Transformer


(David Hayes) #1

Custom Event Transformers are a powerful way to host custom code inside your incident resolution process, here’s an example of one that will redact American social security numbers “123-45-6789” and anything of the form “password: abc123”.

Pro-tip: an Account Owner can also hide the incident’s details by using the [Redact Incident button] (Account Owner can hide the incident’s details by using the Redact Incident button.) from the UI.

Create an integration of type “Custom Event Transformer” and paste in the following code. Once you have an integration key you can test it with this code on JSFiddle:

function sanitize(str) {
  str = str.replace(/[0-9]{3}-[0-9]{2}-[0-9]{4}/gi, 'XXX-XX-XXXX');
  str = str.replace(/password:.*/gi, 'password: redacted');
  return str;

var details = PD.inputRequest.body.details

for (var p in details) {
  details[p] = sanitize(details[p]);

var normalized_event = {
  event_type: PD.Trigger,
  description: PD.inputRequest.body.description,
  details: details


And here’s what the results look like:

(system) #2