secure_headers 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.

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: de4e0f18558ac4a65a9983f56e4dd65ca95e5f82
4
- data.tar.gz: 3c16a5bdeec36aab812bcbfbbdba544b969c3a33
3
+ metadata.gz: fe8e39e4a81e0429bcba0fde48a5bb670f4bfb21
4
+ data.tar.gz: fc5989c5886abaf9245b2e29c3a0fbdb77e03e40
5
5
  SHA512:
6
- metadata.gz: 14f3bc42066b1b4bd6044b75a78818a6ce6edc60760e84af03d13623758a4d05b9397d0c4b4baa92c71d105e0334fa39ec56124c3014e8a63096236f9c6e6d51
7
- data.tar.gz: f07cfc4d11b24a7d7ec1ad50b2fb756fd3a69c8558b922eb79daf35bbf5dc721c24ca27dfa8b5ca13865dc3345cb0162161f3c41fa04ffbff8c190908d8a7b32
6
+ metadata.gz: 373cbefd9bf90c0aa486de40aea8b14f45c9855a580048b25a1de9e7475cb597b7c4bda979f79c897fc988a9be38741477994ba295153ccb642846b767ab597d
7
+ data.tar.gz: 1911795207a61925df44c32d8ffb23908c909332eab7b579d84a5a008296be0e329fcc950e70885fd876b2c7feed2d4e2c12f65148303f90849757a050b32a04
data/CHANGELOG.md CHANGED
@@ -1,7 +1,15 @@
1
- ## 4.x
1
+ ## 4.0.1
2
+
3
+ - Adds support for `worker-src` CSP directive to 4.x line (https://github.com/twitter/secureheaders/pull/364)
4
+
5
+ ## 4.0
2
6
 
3
7
  - See the [upgrading to 4.0](upgrading-to-4-0.md) guide. Lots of breaking changes.
4
8
 
9
+ ## 3.7.2
10
+
11
+ - Adds support for `worker-src` CSP directive to 3.x line (https://github.com/twitter/secureheaders/pull/364)
12
+
5
13
  ## 3.7.1
6
14
 
7
15
  Fix support for the sandbox attribute of CSP. `true` and `[]` represent the maximally restricted policy (`sandbox;`) and validate other values.
data/README.md CHANGED
@@ -67,24 +67,13 @@ SecureHeaders::Configuration.default do |config|
67
67
  }
68
68
  }
69
69
  # Add "; preload" and submit the site to hstspreload.org for best protection.
70
- config.hsts = "max-age=#{20.years.to_i}; includeSubdomains"
70
+ config.hsts = "max-age=#{20.years.to_i}"
71
71
  config.x_frame_options = "DENY"
72
72
  config.x_content_type_options = "nosniff"
73
73
  config.x_xss_protection = "1; mode=block"
74
74
  config.x_download_options = "noopen"
75
75
  config.x_permitted_cross_domain_policies = "none"
76
76
  config.referrer_policy = "origin-when-cross-origin"
77
- config.clear_site_data = [
78
- "cache",
79
- "cookies",
80
- "storage",
81
- "executionContexts"
82
- ]
83
- config.expect_certificate_transparency = {
84
- enforce: false,
85
- max_age: 1.day.to_i,
86
- report_uri: "https://report-uri.io/example-ct"
87
- }
88
77
  config.csp = {
89
78
  # "meta" values. these will shape the header, but the values are not included in the header.
90
79
  preserve_schemes: true, # default: false. Schemes are removed from host sources to save bytes and discourage mixed content.
@@ -106,6 +95,7 @@ SecureHeaders::Configuration.default do |config|
106
95
  plugin_types: %w(application/x-shockwave-flash),
107
96
  script_src: %w('self'),
108
97
  style_src: %w('unsafe-inline'),
98
+ worker_src: %w('self'),
109
99
  upgrade_insecure_requests: true, # see https://www.w3.org/TR/upgrade-insecure-requests/
110
100
  report_uri: %w(https://report-uri.io/example-csp)
111
101
  }
@@ -114,16 +104,6 @@ SecureHeaders::Configuration.default do |config|
114
104
  img_src: %w(somewhereelse.com),
115
105
  report_uri: %w(https://report-uri.io/example-csp-report-only)
116
106
  })
117
- config.hpkp = {
118
- report_only: false,
119
- max_age: 60.days.to_i,
120
- include_subdomains: true,
121
- report_uri: "https://report-uri.io/example-hpkp",
122
- pins: [
123
- {sha256: "abc"},
124
- {sha256: "123"}
125
- ]
126
- }
127
107
  end
128
108
  ```
129
109
 
@@ -38,6 +38,7 @@ module SecureHeaders
38
38
  @script_src = nil
39
39
  @style_nonce = nil
40
40
  @style_src = nil
41
+ @worker_src = nil
41
42
  @upgrade_insecure_requests = nil
42
43
 
43
44
  from_hash(hash)
@@ -72,10 +72,13 @@ module SecureHeaders
72
72
  BLOCK_ALL_MIXED_CONTENT = :block_all_mixed_content
73
73
  MANIFEST_SRC = :manifest_src
74
74
  UPGRADE_INSECURE_REQUESTS = :upgrade_insecure_requests
75
+ WORKER_SRC = :worker_src
76
+
75
77
  DIRECTIVES_3_0 = [
76
78
  DIRECTIVES_2_0,
77
79
  BLOCK_ALL_MIXED_CONTENT,
78
80
  MANIFEST_SRC,
81
+ WORKER_SRC,
79
82
  UPGRADE_INSECURE_REQUESTS
80
83
  ].flatten.freeze
81
84
 
@@ -86,6 +89,7 @@ module SecureHeaders
86
89
  FIREFOX_UNSUPPORTED_DIRECTIVES = [
87
90
  BLOCK_ALL_MIXED_CONTENT,
88
91
  CHILD_SRC,
92
+ WORKER_SRC,
89
93
  PLUGIN_TYPES
90
94
  ].freeze
91
95
 
@@ -95,6 +99,7 @@ module SecureHeaders
95
99
 
96
100
  FIREFOX_46_UNSUPPORTED_DIRECTIVES = [
97
101
  BLOCK_ALL_MIXED_CONTENT,
102
+ WORKER_SRC,
98
103
  PLUGIN_TYPES
99
104
  ].freeze
100
105
 
@@ -148,6 +153,7 @@ module SecureHeaders
148
153
  SANDBOX => :sandbox_list,
149
154
  SCRIPT_SRC => :source_list,
150
155
  STYLE_SRC => :source_list,
156
+ WORKER_SRC => :source_list,
151
157
  UPGRADE_INSECURE_REQUESTS => :boolean
152
158
  }.freeze
153
159
 
@@ -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 = "4.0.0"
5
+ gem.version = "4.0.1"
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."
@@ -143,12 +143,12 @@ module SecureHeaders
143
143
 
144
144
  it "does not filter any directives for Chrome" do
145
145
  policy = ContentSecurityPolicy.new(complex_opts, USER_AGENTS[:chrome])
146
- expect(policy.value).to eq("default-src default-src.com; base-uri base-uri.com; block-all-mixed-content; child-src child-src.com; connect-src connect-src.com; font-src font-src.com; form-action form-action.com; frame-ancestors frame-ancestors.com; img-src img-src.com; manifest-src manifest-src.com; media-src media-src.com; object-src object-src.com; plugin-types application/pdf; sandbox allow-forms; script-src script-src.com 'nonce-123456'; style-src style-src.com; upgrade-insecure-requests; report-uri report-uri.com")
146
+ expect(policy.value).to eq("default-src default-src.com; base-uri base-uri.com; block-all-mixed-content; child-src child-src.com; connect-src connect-src.com; font-src font-src.com; form-action form-action.com; frame-ancestors frame-ancestors.com; img-src img-src.com; manifest-src manifest-src.com; media-src media-src.com; object-src object-src.com; plugin-types application/pdf; sandbox allow-forms; script-src script-src.com 'nonce-123456'; style-src style-src.com; upgrade-insecure-requests; worker-src worker-src.com; report-uri report-uri.com")
147
147
  end
148
148
 
149
149
  it "does not filter any directives for Opera" do
150
150
  policy = ContentSecurityPolicy.new(complex_opts, USER_AGENTS[:opera])
151
- expect(policy.value).to eq("default-src default-src.com; base-uri base-uri.com; block-all-mixed-content; child-src child-src.com; connect-src connect-src.com; font-src font-src.com; form-action form-action.com; frame-ancestors frame-ancestors.com; img-src img-src.com; manifest-src manifest-src.com; media-src media-src.com; object-src object-src.com; plugin-types application/pdf; sandbox allow-forms; script-src script-src.com 'nonce-123456'; style-src style-src.com; upgrade-insecure-requests; report-uri report-uri.com")
151
+ expect(policy.value).to eq("default-src default-src.com; base-uri base-uri.com; block-all-mixed-content; child-src child-src.com; connect-src connect-src.com; font-src font-src.com; form-action form-action.com; frame-ancestors frame-ancestors.com; img-src img-src.com; manifest-src manifest-src.com; media-src media-src.com; object-src object-src.com; plugin-types application/pdf; sandbox allow-forms; script-src script-src.com 'nonce-123456'; style-src style-src.com; upgrade-insecure-requests; worker-src worker-src.com; report-uri report-uri.com")
152
152
  end
153
153
 
154
154
  it "filters blocked-all-mixed-content, child-src, and plugin-types for firefox" do
@@ -33,6 +33,7 @@ module SecureHeaders
33
33
  object_src: %w('self'),
34
34
  script_src: %w('self'),
35
35
  style_src: %w('unsafe-inline'),
36
+ worker_src: %w(worker.com),
36
37
  base_uri: %w('self'),
37
38
  form_action: %w('self' github.com),
38
39
  frame_ancestors: %w('none'),
data/upgrading-to-4-0.md CHANGED
@@ -4,18 +4,18 @@ The most likely change to break your app is the new cookie defaults. This is the
4
4
 
5
5
  ## All cookies default to secure/httponly/SameSite=Lax
6
6
 
7
- By default, *all* cookies will be marked as `SameSite=lax`,`secure`, and `httponly`. To opt-out, supply `OPT_OUT` as the value for `SecureHeaders.cookies` or the individual configs. Setting these values to `false` will raise an error.
7
+ By default, *all* cookies will be marked as `SameSite=lax`,`secure`, and `httponly`. To opt-out, supply `SecureHeaders::OPT_OUT` as the value for `SecureHeaders.cookies` or the individual configs. Setting these values to `false` will raise an error.
8
8
 
9
9
  ```ruby
10
10
  # specific opt outs
11
11
  config.cookies = {
12
- secure: OPT_OUT,
13
- httponly: OPT_OUT,
14
- samesite: OPT_OUT,
12
+ secure: SecureHeaders::OPT_OUT,
13
+ httponly: SecureHeaders::OPT_OUT,
14
+ samesite: SecureHeaders::OPT_OUT,
15
15
  }
16
16
 
17
17
  # nuclear option, just make things work again
18
- config.cookies = OPT_OUT
18
+ config.cookies = SecureHeaders::OPT_OUT
19
19
  ```
20
20
 
21
21
  ## script_src must be set
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: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neil Matatall
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-18 00:00:00.000000000 Z
11
+ date: 2017-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake