ApiCSPReport: Support origin/path matching for false positives
authorTimo Tijhof <krinklemail@gmail.com>
Fri, 21 Dec 2018 20:56:57 +0000 (12:56 -0800)
committerKrinkle <krinklemail@gmail.com>
Tue, 16 Apr 2019 23:51:56 +0000 (23:51 +0000)
commit0ca1b8a0e621c939dfdf81035b73d23d94098894
treedb923b9ee6c4572cc6508f08a8cd011ffce8597d
parent64bd7a7e4b4ca39d74ffd3aeb03dfe7fc4114f33
ApiCSPReport: Support origin/path matching for false positives

According to https://www.tollmanz.com/content-security-policy-report-samples/,
browsers are meant to normalise blocked-url to just the origin,
similar to referer.

However, not all browsers do this in practice, and even in Chrome
it only applies if CORS is not authorising the origin to see the
full url, which means it is usually still the full url for things
like CORS API requests to things under wmflabs.org.

The purpose of this change is to allow a wmflabs.org subdomain
and certain subdirectories to be set as false positive and have
it not log to Logstash in wmf-production.

Bug: T207900
Change-Id: I21f93223e0e3a6ca2dbbb95163a02cd88e4dfc8f
includes/api/ApiCSPReport.php