Skip to content

Commit ccd7b4e

Browse files
danydevJean85
authored andcommitted
Backport #483 to be released as 1.7.1
(cherry picked from commit e2f3c47)
1 parent f92d304 commit ccd7b4e

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

Diff for: lib/Raven/Processor/SanitizeDataProcessor.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function sanitize(&$item, $key)
7979
public function sanitizeException(&$data)
8080
{
8181
foreach ($data['exception']['values'] as &$value) {
82-
return $this->sanitizeStacktrace($value['stacktrace']);
82+
$this->sanitizeStacktrace($value['stacktrace']);
8383
}
8484
}
8585

Diff for: test/Raven/Tests/Processor/SanitizeDataProcessorTest.php

+49
Original file line numberDiff line numberDiff line change
@@ -199,4 +199,53 @@ public static function overrideDataProvider()
199199
array($processorOptions, $client_options, $dsn)
200200
);
201201
}
202+
203+
public function testDoesFilterExceptionDataWithMultipleValues()
204+
{
205+
// Prerequisite: create an array with an 'exception' that contains 2 entry for 'values' key both containing at
206+
// least 1 key that must be masked (i.e. 'password') in one of their 'vars' array in 'frames'.
207+
$data = array(
208+
'exception' => array(
209+
'values' => array(
210+
array(
211+
'stacktrace' => array(
212+
'frames' => array(
213+
array(
214+
'vars' => array(
215+
'credentials' => array(
216+
'password' => 'secretPassword'
217+
),
218+
),
219+
),
220+
),
221+
),
222+
),
223+
array(
224+
'stacktrace' => array(
225+
'frames' => array(
226+
array(
227+
'vars' => array(
228+
'credentials' => array(
229+
'password' => 'anotherSecretPassword'
230+
),
231+
),
232+
),
233+
),
234+
),
235+
),
236+
),
237+
),
238+
);
239+
240+
$client = new Dummy_Raven_Client();
241+
$processor = new Raven_Processor_SanitizeDataProcessor($client);
242+
// Action
243+
$processor->process($data);
244+
245+
// Expectation: make sure we mask password in both the values array
246+
$passwordValue0 = $data['exception']['values'][0]['stacktrace']['frames'][0]['vars']['credentials']['password'];
247+
$this->assertEquals(Raven_Processor_SanitizeDataProcessor::STRING_MASK, $passwordValue0);
248+
$passwordValue1 = $data['exception']['values'][1]['stacktrace']['frames'][0]['vars']['credentials']['password'];
249+
$this->assertEquals(Raven_Processor_SanitizeDataProcessor::STRING_MASK, $passwordValue1);
250+
}
202251
}

0 commit comments

Comments
 (0)