Update content-security-policy.

This commit is contained in:
Josh Matthews 2020-03-20 15:40:55 -04:00
parent 0fef1bfbec
commit 19216627d3
7 changed files with 16 additions and 6 deletions

12
Cargo.lock generated
View file

@ -239,6 +239,12 @@ version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7"
[[package]]
name = "base64"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d5ca2cd0adc3f48f9e9ea5a6bbdf9ccc0bfade884847e484d452414c7ccffb3"
[[package]] [[package]]
name = "binary-space-partition" name = "binary-space-partition"
version = "0.1.2" version = "0.1.2"
@ -822,15 +828,17 @@ dependencies = [
[[package]] [[package]]
name = "content-security-policy" name = "content-security-policy"
version = "0.3.0" version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f30ee9967a875968e66f6690e299f06781ed109cb82d10e0d60a126a38d61947" checksum = "e9c6953cf3a032666719b6c432617652532bdeb6015c93473cbbd432d9657600"
dependencies = [ dependencies = [
"base64 0.12.0",
"bitflags", "bitflags",
"lazy_static", "lazy_static",
"percent-encoding", "percent-encoding",
"regex", "regex",
"serde", "serde",
"sha2",
"url", "url",
] ]

View file

@ -29,7 +29,7 @@ servo = [
[dependencies] [dependencies]
accountable-refcell = { version = "0.2.0", optional = true } accountable-refcell = { version = "0.2.0", optional = true }
app_units = "0.7" app_units = "0.7"
content-security-policy = {version = "0.3.0", features = ["serde"], optional = true} content-security-policy = {version = "0.4.0", features = ["serde"], optional = true}
crossbeam-channel = { version = "0.4", optional = true } crossbeam-channel = { version = "0.4", optional = true }
cssparser = "0.27" cssparser = "0.27"
euclid = "0.20" euclid = "0.20"

View file

@ -18,7 +18,7 @@ doctest = false
base64 = "0.10.1" base64 = "0.10.1"
brotli = "3" brotli = "3"
bytes = "0.4" bytes = "0.4"
content-security-policy = {version = "0.3.0", features = ["serde"]} content-security-policy = {version = "0.4.0", features = ["serde"]}
cookie_rs = {package = "cookie", version = "0.11"} cookie_rs = {package = "cookie", version = "0.11"}
crossbeam-channel = "0.4" crossbeam-channel = "0.4"
data-url = "0.1.0" data-url = "0.1.0"

View file

@ -203,6 +203,7 @@ pub fn main_fetch(
// Step 2.4. // Step 2.4.
if should_request_be_blocked_by_csp(request) == csp::CheckResult::Blocked { if should_request_be_blocked_by_csp(request) == csp::CheckResult::Blocked {
warn!("Request blocked by CSP");
response = Some(Response::network_error(NetworkError::Internal( response = Some(Response::network_error(NetworkError::Internal(
"Blocked by Content-Security-Policy".into(), "Blocked by Content-Security-Policy".into(),
))) )))

View file

@ -13,7 +13,7 @@ test = false
doctest = false doctest = false
[dependencies] [dependencies]
content-security-policy = {version = "0.3.0", features = ["serde"]} content-security-policy = {version = "0.4.0", features = ["serde"]}
cookie = "0.11" cookie = "0.11"
embedder_traits = { path = "../embedder_traits" } embedder_traits = { path = "../embedder_traits" }
headers = "0.2" headers = "0.2"

View file

@ -39,7 +39,7 @@ bitflags = "1.0"
bluetooth_traits = {path = "../bluetooth_traits"} bluetooth_traits = {path = "../bluetooth_traits"}
canvas_traits = {path = "../canvas_traits"} canvas_traits = {path = "../canvas_traits"}
caseless = "0.2" caseless = "0.2"
content-security-policy = {version = "0.3.0", features = ["serde"]} content-security-policy = {version = "0.4.0", features = ["serde"]}
cookie = "0.11" cookie = "0.11"
chrono = "0.4" chrono = "0.4"
crossbeam-channel = "0.4" crossbeam-channel = "0.4"

View file

@ -460,6 +460,7 @@ impl HTMLScriptElement {
&text, &text,
) == csp::CheckResult::Blocked ) == csp::CheckResult::Blocked
{ {
warn!("Blocking inline script due to CSP");
return; return;
} }