1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
-
-
-
-
- final class Raven_Processor_SanitizeHttpHeadersProcessor extends Raven_Processor
- {
-
-
- private $httpHeadersToSanitize = array();
-
-
-
- public function __construct(Raven_Client $client)
- {
- parent::__construct($client);
- }
-
-
-
- public function setProcessorOptions(array $options)
- {
- $this->httpHeadersToSanitize = array_merge($this->getDefaultHeaders(), isset($options['sanitize_http_headers']) ? $options['sanitize_http_headers'] : array());
- }
-
-
-
- public function process(&$data)
- {
- if (isset($data['request']) && isset($data['request']['headers'])) {
- foreach ($data['request']['headers'] as $header => &$value) {
- if (in_array($header, $this->httpHeadersToSanitize)) {
- $value = self::STRING_MASK;
- }
- }
- }
- }
-
-
-
- private function getDefaultHeaders()
- {
- return array('Authorization', 'Proxy-Authorization', 'X-Csrf-Token', 'X-CSRFToken', 'X-XSRF-TOKEN');
- }
- }
|