secure_headers 5.1.0 → 5.2.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b901bf6e9f4127c81ec207e46599054feb18f32
|
4
|
+
data.tar.gz: 642585cfc04901c83ff5d90ea1600f5ef141fec4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e304a7d52e6dbf0a4fd2bb114201ba781e8565fd9ecbd4977e6169f922101f186c7024194c81ecd780376f2e4c18f7af3bd88f98cd2b86301b15de5e4148c44
|
7
|
+
data.tar.gz: 9d5e1e8f35954baea9e4fcec70af22e7f3c2d8b16deaa98d6c882c9373c9a76556a711696b081920d9279df96375dd6e2a473e265c9bfbf2e12a6f9a62da486f
|
data/CHANGELOG.md
CHANGED
@@ -140,11 +140,11 @@ module SecureHeaders
|
|
140
140
|
if source_list != OPT_OUT && source_list && source_list.any?
|
141
141
|
minified_source_list = minify_source_list(directive, source_list).join(" ")
|
142
142
|
|
143
|
-
if minified_source_list
|
144
|
-
Kernel.warn("#{directive} contains a
|
143
|
+
if minified_source_list =~ /(\n|;)/
|
144
|
+
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.")
|
145
145
|
end
|
146
146
|
|
147
|
-
escaped_source_list = minified_source_list.gsub(
|
147
|
+
escaped_source_list = minified_source_list.gsub(/[\n;]/, " ")
|
148
148
|
[symbol_to_hyphen_case(directive), escaped_source_list].join(" ").strip
|
149
149
|
end
|
150
150
|
end
|
data/secure_headers.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = "secure_headers"
|
5
|
-
gem.version = "5.
|
5
|
+
gem.version = "5.2.0"
|
6
6
|
gem.authors = ["Neil Matatall"]
|
7
7
|
gem.email = ["neil.matatall@gmail.com"]
|
8
8
|
gem.description = "Manages application of security headers with many safe defaults."
|
@@ -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'")
|