| 1 | package Sentry::Raven::Processor::RemoveStackVariables; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use 5.008; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | =head1 NAME | ||||||||||
| 8 | |||||||||||
| 9 | Sentry::Raven::Processor::RemoveStackVariables - Remove stack variables from stack traces in events | ||||||||||
| 10 | |||||||||||
| 11 | =head1 SYNOPSIS | ||||||||||
| 12 | |||||||||||
| 13 | use Sentry::Raven; | ||||||||||
| 14 | use Sentry::Raven::Processor::RemoveStackVariables; | ||||||||||
| 15 | |||||||||||
| 16 | my $raven = Sentry::Raven->new( | ||||||||||
| 17 | processors => [ Sentry::Raven::Processor::RemoveStackVariables ], | ||||||||||
| 18 | ); | ||||||||||
| 19 | |||||||||||
| 20 | =head1 DESCRIPTION | ||||||||||
| 21 | |||||||||||
| 22 | This processor removes variables from stack traces before they are posted to the sentry service. This prevents sensitive values from being exposed, such as passwords or credit card numbers. | ||||||||||
| 23 | |||||||||||
| 24 | =head1 METHODS | ||||||||||
| 25 | |||||||||||
| 26 | =head2 my $processed_event = Sentry::Raven::Processor::RemoveStackVariables->process( $event ) | ||||||||||
| 27 | |||||||||||
| 28 | Process an event. | ||||||||||
| 29 | |||||||||||
| 30 | =cut | ||||||||||
| 31 | |||||||||||
| 32 | sub process { | ||||||||||
| 33 | 1 | ▶ | my ($class, $event) = @_; | ||||||||
|
Subroutine
process: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 34 | 1 | ▶ | if ($event->{'sentry.interfaces.Stacktrace'}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | 1 | my $num_frames = scalar(@{$event->{'sentry.interfaces.Stacktrace'}->{frames}}); | |||||||||
| 36 | 1 | delete($event->{'sentry.interfaces.Stacktrace'}->{frames}->[$_]->{vars}) for 0..($num_frames-1); | |||||||||
| 37 | } | ||||||||||
| 38 | 1 | return $event; | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 1 | 1; | |||||||||