mirror of
https://github.com/servo/servo.git
synced 2025-06-08 00:23:30 +00:00
Propagate parent policy container to local iframes (#36710)
This follows the rules as defined in https://w3c.github.io/webappsec-csp/#security-inherit-csp where local iframes (about:blank and about:srcdoc) should initially start with the CSP rules of the parent. After that, all new CSP headers should only be set on the policy container of the iframe. Part of #36437 Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com> Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
This commit is contained in:
parent
4164f76769
commit
539ca27284
11 changed files with 45 additions and 47 deletions
|
@ -3674,10 +3674,12 @@ impl ScriptThread {
|
|||
None => vec![],
|
||||
};
|
||||
|
||||
let policy_container = incomplete.load_data.policy_container.clone();
|
||||
self.incomplete_loads.borrow_mut().push(incomplete);
|
||||
|
||||
let dummy_request_id = RequestId::default();
|
||||
context.process_response(dummy_request_id, Ok(FetchMetadata::Unfiltered(meta)));
|
||||
context.append_parent_to_csp_list(policy_container.as_ref());
|
||||
context.process_response_chunk(dummy_request_id, chunk);
|
||||
context.process_response_eof(
|
||||
dummy_request_id,
|
||||
|
@ -3697,12 +3699,14 @@ impl ScriptThread {
|
|||
let srcdoc = std::mem::take(&mut incomplete.load_data.srcdoc);
|
||||
let chunk = srcdoc.into_bytes();
|
||||
|
||||
let policy_container = incomplete.load_data.policy_container.clone();
|
||||
self.incomplete_loads.borrow_mut().push(incomplete);
|
||||
|
||||
let mut context = ParserContext::new(id, url);
|
||||
let dummy_request_id = RequestId::default();
|
||||
|
||||
context.process_response(dummy_request_id, Ok(FetchMetadata::Unfiltered(meta)));
|
||||
context.append_parent_to_csp_list(policy_container.as_ref());
|
||||
context.process_response_chunk(dummy_request_id, chunk);
|
||||
context.process_response_eof(
|
||||
dummy_request_id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue