servo/components/net
Tim van der Lippe baa18e18af
Support CSP report-only header (#36623)
This turned out to be a full rabbit hole. The new header
is parsed in the new `parse_csp_list_from_metadata` which
sets `disposition` to `report.

I was testing this with
`script-src-report-only-policy-works-with-external-hash-policy.html`
which was blocking the script incorrectly. Turns out that there
were multiple bugs in the CSP library, as well as a missing
check in `fetch` to report violations.

Additionally, in several locations we were manually reporting csp
violations, instead of the new `global.report_csp_violations`. As
a result of that, they would double report, since the report-only
header would be appended as a policy and now would report twice.

Now, all callsides use `global.report_csp_violations`. As a nice
side-effect, I added the code to set source file information,
since that was already present for the `eval` check, but nowhere
else.

Part of #36437

Requires servo/rust-content-security-policy#5

---------

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
Signed-off-by: Tim van der Lippe <TimvdLippe@users.noreply.github.com>
2025-04-25 19:59:44 +00:00
..
fetch Support CSP report-only header (#36623) 2025-04-25 19:59:44 +00:00
protocols Initial support for marking custom protocol secure (#36656) 2025-04-25 10:39:33 +00:00
tests Update FetchTaskTarget to propagate CSP violations. (#36409) 2025-04-13 20:54:59 +00:00
async_runtime.rs api: Flatten and simplify Servo preferences (#34966) 2025-01-14 13:54:06 +00:00
Cargo.toml Manually concatenate ACRH headers to not include a space (#36455) 2025-04-11 17:01:55 +00:00
connector.rs Update rustfmt to the 2024 style edition (#35764) 2025-03-03 11:26:53 +00:00
cookie.rs Update rustfmt to the 2024 style edition (#35764) 2025-03-03 11:26:53 +00:00
cookie_storage.rs Webdriver delete cookie (#36306) 2025-04-04 05:24:47 +00:00
decoder.rs Update rustfmt to the 2024 style edition (#35764) 2025-03-03 11:26:53 +00:00
filemanager_thread.rs servoshell: Migrate to egui-file-dialog from tinyfiledialogs (#34823) 2025-02-04 18:24:24 +00:00
hosts.rs Replace the lazy_static crate with std::sync::LazyLock in components/net (#33046) 2024-08-14 12:15:55 +00:00
hsts.rs net: Measure HSTS memory usage. (#36558) 2025-04-16 13:11:44 +00:00
http_cache.rs Update rustfmt to the 2024 style edition (#35764) 2025-03-03 11:26:53 +00:00
http_loader.rs net: Measure HSTS memory usage. (#36558) 2025-04-16 13:11:44 +00:00
image_cache.rs Prevent multiple notifications for image dimensions (#36600) 2025-04-18 20:01:26 +00:00
lib.rs libservo: Convert intercept_web_resource_load into load_web_resource (#35564) 2025-02-21 14:36:42 +00:00
local_directory_listing.rs Update rustfmt to the 2024 style edition (#35764) 2025-03-03 11:26:53 +00:00
mime_classifier.rs Update to rust 1.85 (#35628) 2025-02-24 17:44:35 +00:00
request_interceptor.rs Update rustfmt to the 2024 style edition (#35764) 2025-03-03 11:26:53 +00:00
resource_thread.rs Refactor common infrastructure for creating memory reports. (#36579) 2025-04-18 02:14:49 +00:00
storage_thread.rs Update to rust 1.85 (#35628) 2025-02-24 17:44:35 +00:00
subresource_integrity.rs clippy: Fix warnings in components/net (#31626) 2024-03-13 09:40:04 +00:00
websocket_loader.rs Update FetchTaskTarget to propagate CSP violations. (#36409) 2025-04-13 20:54:59 +00:00