Skip to content

Truly independent web browser

LibWeb/CSP: Verify a violated policy is in the request's CSP list

Luke Wildee24ed89c453f
diff --git a/Libraries/LibWeb/ContentSecurityPolicy/BlockingAlgorithms.cpp b/Libraries/LibWeb/ContentSecurityPolicy/BlockingAlgorithms.cpp
index 58db5dacdc6..7d4e4a6cbd3 100644
--- a/Libraries/LibWeb/ContentSecurityPolicy/BlockingAlgorithms.cpp
+++ b/Libraries/LibWeb/ContentSecurityPolicy/BlockingAlgorithms.cpp
@@ -63,8 +63,7 @@ static void report_a_violation_of_a_remote_client(Page& page, Fetch::Infrastruct
// NB: Request's policy container is a copy of the client's, which lists the policies in the same order.
auto const& policies = request.policy_container().get<NonnullRefPtr<HTML::PolicyContainer const>>()->csp_list.policies();
auto policy_index = policies.find_first_index_if([&](auto const& candidate) { return candidate.ptr() == &policy; });
- if (!policy_index.has_value())
- return;
+ VERIFY(policy_index.has_value());
if (auto const& navigation = request.remote_client_navigation(); navigation.has_value()) {
// NB: The UI process checks a navigation's report against the directives the navigation can violate, and