secure_headers 3.8.0 → 3.9.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e2f294d6c2130a1f629bf3dba2a88da71fa2b80a015cb7dc96bcbbcb88d1d59
|
4
|
+
data.tar.gz: 767021dbec7d023bbcb629b3315ad10ff989e2c6ae7ceff9ffc5614b05fa3ba5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86d16e60409fca6b72e16321100a6afc3cc1fded1fb79c004778c8cdae2872ed4751205e90274f4b2c0517a70763c896692d9bd547f3b5b9144b8479b93268d5
|
7
|
+
data.tar.gz: a2462e058ad88292d40e5a7e4e23e0a5ba431a8a114616f1e1d77bd5218e99ed0b68f4e7b0cf9e3480e10ca2e34e97d60e3b7b1d77db8b71da71c031f4cdaa52
|
data/CHANGELOG.md
CHANGED
@@ -144,10 +144,10 @@ module SecureHeaders
|
|
144
144
|
return unless source_list && source_list.any?
|
145
145
|
normalized_source_list = minify_source_list(directive, source_list).join(" ")
|
146
146
|
|
147
|
-
if normalized_source_list
|
148
|
-
Kernel.warn("#{directive} contains a
|
147
|
+
if normalized_source_list =~ /(\n|;)/
|
148
|
+
Kernel.warn("#{directive} contains a #{$1} in #{normalized_source_list.inspect} which will raise an error in future versions. It has been replaced with a blank space.")
|
149
149
|
end
|
150
|
-
escaped_source_list = normalized_source_list.gsub(
|
150
|
+
escaped_source_list = normalized_source_list.gsub(/[\n;]/, " ")
|
151
151
|
|
152
152
|
[symbol_to_hyphen_case(directive), escaped_source_list].join(" ").strip
|
153
153
|
end
|
data/secure_headers.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
Gem::Specification.new do |gem|
|
3
3
|
gem.name = "secure_headers"
|
4
|
-
gem.version = "3.
|
4
|
+
gem.version = "3.9.0"
|
5
5
|
gem.authors = ["Neil Matatall"]
|
6
6
|
gem.email = ["neil.matatall@gmail.com"]
|
7
7
|
gem.description = 'Manages application of security headers with many safe defaults.'
|
@@ -28,10 +28,15 @@ module SecureHeaders
|
|
28
28
|
end
|
29
29
|
|
30
30
|
it "deprecates and escapes semicolons in directive source lists" do
|
31
|
-
expect(Kernel).to receive(:warn).with(
|
31
|
+
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.))
|
32
32
|
expect(ContentSecurityPolicy.new(frame_ancestors: %w(https://google.com;script-src https://*;.;)).value).to eq("frame-ancestors google.com script-src * .")
|
33
33
|
end
|
34
34
|
|
35
|
+
it "deprecates and escapes semicolons in directive source lists" do
|
36
|
+
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.))
|
37
|
+
expect(ContentSecurityPolicy.new(frame_ancestors: ["\nfoo.com\nhacked"]).value).to eq("frame-ancestors foo.com hacked")
|
38
|
+
end
|
39
|
+
|
35
40
|
it "discards 'none' values if any other source expressions are present" do
|
36
41
|
csp = ContentSecurityPolicy.new(default_opts.merge(child_src: %w('self' 'none')))
|
37
42
|
expect(csp.value).not_to include("'none'")
|