secure_headers 6.2.0 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce02dddd749c70448cb50004e8ee21cfd5676283c5c119c595efe882985c9d63
|
4
|
+
data.tar.gz: 59f44239dc9f07aa93280c7455ca6561f96cba05834cdf43f3b2cda37ca2d70d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3d764be6a8dd9715feed0efd02216567d5c75c87a4a7016de6d43fe2e907a20425ea2708ea6384b3fe8e2c47b5a91d964febb0ea227ba3d257f821eb766b2ff
|
7
|
+
data.tar.gz: f157d965478100e2eebbd3c875e94d2e6c8b66631fa2cbc06bb5316815b5c33234a15a0956087902f39f74b9d38a6f834cae76b338e8c8355bca21261914973c
|
data/CHANGELOG.md
CHANGED
@@ -106,11 +106,11 @@ module SecureHeaders
|
|
106
106
|
if source_list != OPT_OUT && source_list && source_list.any?
|
107
107
|
minified_source_list = minify_source_list(directive, source_list).join(" ")
|
108
108
|
|
109
|
-
if minified_source_list
|
110
|
-
Kernel.warn("#{directive} contains a
|
109
|
+
if minified_source_list =~ /(\n|;)/
|
110
|
+
Kernel.warn("#{directive} contains a #{$1} in #{minified_source_list.inspect} which will raise an error in future versions. It has been replaced with a blank space.")
|
111
111
|
end
|
112
112
|
|
113
|
-
escaped_source_list = minified_source_list.gsub(
|
113
|
+
escaped_source_list = minified_source_list.gsub(/[\n;]/, " ")
|
114
114
|
[symbol_to_hyphen_case(directive), escaped_source_list].join(" ").strip
|
115
115
|
end
|
116
116
|
end
|
@@ -29,10 +29,15 @@ module SecureHeaders
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it "deprecates and escapes semicolons in directive source lists" do
|
32
|
-
expect(Kernel).to receive(:warn).with(
|
32
|
+
expect(Kernel).to receive(:warn).with(%(frame_ancestors contains a ; in "google.com;script-src *;.;" which will raise an error in future versions. It has been replaced with a blank space.))
|
33
33
|
expect(ContentSecurityPolicy.new(frame_ancestors: %w(https://google.com;script-src https://*;.;)).value).to eq("frame-ancestors google.com script-src * .")
|
34
34
|
end
|
35
35
|
|
36
|
+
it "deprecates and escapes semicolons in directive source lists" do
|
37
|
+
expect(Kernel).to receive(:warn).with(%(frame_ancestors contains a \n in "\\nfoo.com\\nhacked" which will raise an error in future versions. It has been replaced with a blank space.))
|
38
|
+
expect(ContentSecurityPolicy.new(frame_ancestors: ["\nfoo.com\nhacked"]).value).to eq("frame-ancestors foo.com hacked")
|
39
|
+
end
|
40
|
+
|
36
41
|
it "discards 'none' values if any other source expressions are present" do
|
37
42
|
csp = ContentSecurityPolicy.new(default_opts.merge(child_src: %w('self' 'none')))
|
38
43
|
expect(csp.value).not_to include("'none'")
|