Skip to content

PII Scrubbing

Pionne sanitizes personal data by default before sending an event. You don’t have to configure anything to be GDPR-compliant on standard patterns.

PatternMatchReplacement
EMAILjohn@doe.com[email]
CARD13-19 digit numbers (Luhn)[card]
IBANFR76..., DE89...[iban]
JWTeyJ... 3 segments[jwt]
TOKENBearer ..., pio_live_..., etc.[token]
IPIPv4 / IPv6[ip]
PHONE+33 6 12 34 56 78, 06 12...[phone]

The scrubbing applies to the message, stack, breadcrumbs[].message and extra fields.

Pionne.init({ token: '...', scrubPii: false });

Pass an array to extend (or replace) the default patterns:

Pionne.init({
token: '...',
scrubPii: [
// Keep all defaults + these two new ones
{ re: /sk_live_[a-zA-Z0-9]{24,}/g, replace: '[stripe-secret]' },
{ re: /SSN-\d{9}/g, replace: '[ssn]' },
],
});

For full control — e.g. extra scrubbing, dropping certain events, heavy anonymization:

Pionne.init({
token: '...',
beforeSend: (event) => {
// Drop dev events from a specific user
if (event.user?.id === 'qa_bot') return null;
// Scrub a custom extra field
if (event.extra?.payload) {
event.extra.payload = '[redacted]';
}
return event;
},
});

Returning null cancels the send.

  • Keep scrubPii: true (default).
  • Add your own patterns for internal secrets (API keys, internal IDs).
  • Use Pionne.setUser(idAnon) with an anonymous ID — never the email.
  • For health/finance, add beforeSend to scrub business payloads.