X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiCSPReport.php;h=5a0edfcd82ddc9cedecd82d0ee9f39bd3eee0c1b;hb=f0c8cbc6d9bc05c1aa1cfc89f13bee3514c947c3;hp=5271996080e164c9f6fa4739e9901c40ad1439d1;hpb=40ac7fd1b5bd2dbd6843d5907454178f390436f9;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiCSPReport.php b/includes/api/ApiCSPReport.php index 5271996080..5a0edfcd82 100644 --- a/includes/api/ApiCSPReport.php +++ b/includes/api/ApiCSPReport.php @@ -85,8 +85,8 @@ class ApiCSPReport extends ApiBase { */ private function getFlags( $report ) { $reportOnly = $this->getParameter( 'reportonly' ); - $userAgent = $this->getRequest()->getHeader( 'user-agent' ); $source = $this->getParameter( 'source' ); + $falsePositives = $this->getConfig()->get( 'CSPFalsePositiveUrls' ); $flags = []; if ( $source !== 'internal' ) { @@ -95,6 +95,16 @@ class ApiCSPReport extends ApiBase { if ( $reportOnly ) { $flags[] = 'report-only'; } + + if ( + ( isset( $report['blocked-uri'] ) && + isset( $falsePositives[$report['blocked-uri']] ) ) + || ( isset( $report['source-file'] ) && + isset( $falsePositives[$report['source-file']] ) ) + ) { + // Report caused by Ad-Ware + $flags[] = 'false-positive'; + } return $flags; }