RemoveHttpBodyProcessor.php 832 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /*
  3. * This file is part of Raven.
  4. *
  5. * (c) Sentry Team
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. /**
  11. * This processor removes all the data of the HTTP body to ensure no sensitive
  12. * informations are sent to the server in case the request method is POST, PUT,
  13. * PATCH or DELETE.
  14. *
  15. * @author Stefano Arlandini <sarlandini@alice.it>
  16. */
  17. final class Raven_Processor_RemoveHttpBodyProcessor extends Raven_Processor
  18. {
  19. /**
  20. * {@inheritdoc}
  21. */
  22. public function process(&$data)
  23. {
  24. if (isset($data['request'], $data['request']['method']) && in_array(strtoupper($data['request']['method']), array('POST', 'PUT', 'PATCH', 'DELETE'))) {
  25. $data['request']['data'] = self::STRING_MASK;
  26. }
  27. }
  28. }