secure_headers 5.0.5 → 5.1.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.

Potentially problematic release.


This version of secure_headers might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 691005b0bf1b02e1eb1b13b8eeac292267632a3d
4
- data.tar.gz: 8a32473e94e6a897d2861afc1ecebac947e98d34
3
+ metadata.gz: 32ea96aca183a8341bec40b998486beed14d59e8
4
+ data.tar.gz: 3081354f4bd486f5ea49d22f680d1ac2d36de4aa
5
5
  SHA512:
6
- metadata.gz: c1477c7f35c5203e3dffe06255c2123c417a000f7614bd336801b36b3dea6755e92a6fd74e2af2e80a1e1c9f3d1cc937d02128619fcbd6212e825afb21af886a
7
- data.tar.gz: b0083182dc46839c0359f94fdecb23933eefd74b6ef150b67d908ed02688042e6dbd45b82df766aaa86b9168a3b948eab33fbac0e689350f4f73aae96fa8da01
6
+ metadata.gz: cc8c64abdabaab458be788ee09a18984bab17cb8a01ef6eb76c75099cfaa5b8fc5962f5094e39f7067ebece388794e7f53a2e44f2fecdbfe4146a59a981211df
7
+ data.tar.gz: f8c369a5a2ac0e7547e231100c2a946a9204684d4db33206cc3baf0dd786b99c5a6d05cdaaaca5fcb439530a6d385d029c265dbc84f9b6ff665df52ad1191537
data/.travis.yml CHANGED
@@ -2,9 +2,9 @@ language: ruby
2
2
 
3
3
  rvm:
4
4
  - ruby-head
5
- - 2.4.2
6
- - 2.3.5
7
- - 2.2.8
5
+ - 2.6
6
+ - 2.5
7
+ - 2.4
8
8
  - jruby-head
9
9
 
10
10
  env:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 5.1.0
2
+
3
+ Fixes semicolon injection issue reported by @mvgijssel see https://github.com/twitter/secure_headers/issues/418
4
+
1
5
  ## 5.0.5
2
6
 
3
7
  A release to deprecate `SecureHeaders::Configuration#get` in prep for 6.x
data/Gemfile CHANGED
@@ -9,7 +9,7 @@ group :test do
9
9
  gem "pry-nav"
10
10
  gem "rack"
11
11
  gem "rspec"
12
- gem "rubocop"
12
+ gem "rubocop", "< 0.68"
13
13
  gem "rubocop-github"
14
14
  gem "term-ansicolor"
15
15
  gem "tins"
@@ -138,8 +138,14 @@ module SecureHeaders
138
138
  end
139
139
 
140
140
  if source_list != OPT_OUT && source_list && source_list.any?
141
- normalized_source_list = minify_source_list(directive, source_list)
142
- [symbol_to_hyphen_case(directive), normalized_source_list].join(" ")
141
+ minified_source_list = minify_source_list(directive, source_list).join(" ")
142
+
143
+ if minified_source_list.include?(";")
144
+ Kernel.warn("#{directive} contains a ; in '#{minified_source_list}' which will raise an error in future versions. It has been replaced with a blank space.")
145
+ end
146
+
147
+ escaped_source_list = minified_source_list.gsub(";", " ")
148
+ [symbol_to_hyphen_case(directive), escaped_source_list].join(" ").strip
143
149
  end
144
150
  end
145
151
 
@@ -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.0.5"
5
+ gem.version = "5.1.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."
@@ -28,6 +28,11 @@ module SecureHeaders
28
28
  expect(ContentSecurityPolicy.new.value).to eq("default-src https:; form-action 'self'; img-src https: data: 'self'; object-src 'none'; script-src https:; style-src 'self' 'unsafe-inline' https:")
29
29
  end
30
30
 
31
+ it "deprecates and escapes semicolons in directive source lists" do
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
+ expect(ContentSecurityPolicy.new(frame_ancestors: %w(https://google.com;script-src https://*;.;)).value).to eq("frame-ancestors google.com script-src * .")
34
+ end
35
+
31
36
  it "discards 'none' values if any other source expressions are present" do
32
37
  csp = ContentSecurityPolicy.new(default_opts.merge(child_src: %w('self' 'none')))
33
38
  expect(csp.value).not_to include("'none'")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: secure_headers
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.5
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neil Matatall
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-12 00:00:00.000000000 Z
11
+ date: 2020-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake