secure_headers 2.4.1 → 2.4.2

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: 333c51c1bbbed7415696fa0e8fd7e3147ddcf542
4
- data.tar.gz: 798eae0a9dc303a0c72c946e74aa76a2f36e229c
3
+ metadata.gz: ba37b57a088b6c481e24b7effe725c665061dba6
4
+ data.tar.gz: d081e7b902b1d6036d8862267c5f3fb179bba219
5
5
  SHA512:
6
- metadata.gz: 80224aff2b4a8230de68b0338dd5ca4ef19c56b929fe59693d3f01395f7b4c3cab57170b389044dacd0745e43d07cf98951f13de48d646cc17cf8a40befe4d90
7
- data.tar.gz: 7f663e76802e8c2282908eb2eefce7a040cf9f5c04da49b825bd147854879a900577f22f9a8e918a973d3019e840e95d08aec6eaeeb3836c6233fb0db0dd8982
6
+ metadata.gz: fd94590f06966a3d80f635cfda20127bbf5004612cce06d729e90b6c6c69f46a4faf014a34605143f1ccd36b4cda0cf8ad40a6fad5f48c40c04c466438e5a1a0
7
+ data.tar.gz: 7adee15d4987530bdf8b49ef681642427632ebd2a33595d37025c326bd2b3a8a23062d043bca2b1ed0c3ac305661cb3fd7541aa1b59f59ed9335157e5863a7af
@@ -133,15 +133,6 @@ module SecureHeaders
133
133
  @ua = options[:ua]
134
134
  @ssl_request = !!options.delete(:ssl)
135
135
  @request_uri = options.delete(:request_uri)
136
- @http_additions = config.delete(:http_additions)
137
- @disable_img_src_data_uri = !!config.delete(:disable_img_src_data_uri)
138
- @tag_report_uri = !!config.delete(:tag_report_uri)
139
- @script_hashes = config.delete(:script_hashes) || []
140
- @app_name = config.delete(:app_name)
141
- @app_name = @app_name.call(@controller) if @app_name.respond_to?(:call)
142
- @enforce = config.delete(:enforce)
143
- @enforce = @enforce.call(@controller) if @enforce.respond_to?(:call)
144
- @enforce = !!@enforce
145
136
 
146
137
  # Config values can be string, array, or lamdba values
147
138
  @config = config.inject({}) do |hash, (key, value)|
@@ -153,14 +144,22 @@ module SecureHeaders
153
144
  translate_dir_value(val)
154
145
  end.flatten.uniq
155
146
  end
156
- elsif key != :script_hash_middleware
157
- raise ArgumentError.new("Unknown directive supplied: #{key}")
158
147
  end
159
148
 
160
149
  hash[key] = config_val
161
150
  hash
162
151
  end
163
152
 
153
+ @http_additions = @config.delete(:http_additions)
154
+ @disable_img_src_data_uri = !!@config.delete(:disable_img_src_data_uri)
155
+ @tag_report_uri = !!@config.delete(:tag_report_uri)
156
+ @script_hashes = @config.delete(:script_hashes) || []
157
+ @app_name = @config.delete(:app_name)
158
+ @app_name = @app_name.call(@controller) if @app_name.respond_to?(:call)
159
+ @enforce = @config.delete(:enforce)
160
+ @enforce = @enforce.call(@controller) if @enforce.respond_to?(:call)
161
+ @enforce = !!@enforce
162
+
164
163
  # normalize and tag the report-uri
165
164
  if @config[:report_uri]
166
165
  @config[:report_uri] = @config[:report_uri].map do |report_uri|
@@ -1,3 +1,3 @@
1
1
  module SecureHeaders
2
- VERSION = "2.4.1"
2
+ VERSION = "2.4.2"
3
3
  end
@@ -142,6 +142,14 @@ module SecureHeaders
142
142
  end
143
143
 
144
144
  describe "#value" do
145
+ it "does not mutate shared state" do
146
+ opts = default_opts.merge(enforce: true)
147
+ policy = ContentSecurityPolicy.new(opts, :request => request_for(CHROME))
148
+ expect(policy.name).to eq("Content-Security-Policy")
149
+ policy = ContentSecurityPolicy.new(opts, :request => request_for(CHROME))
150
+ expect(policy.name).to eq("Content-Security-Policy")
151
+ end
152
+
145
153
  context "browser sniffing" do
146
154
  let(:complex_opts) do
147
155
  ALL_DIRECTIVES.inject({}) { |memo, directive| memo[directive] = "'self'"; memo }.merge(:block_all_mixed_content => '')
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: 2.4.1
4
+ version: 2.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neil Matatall
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-14 00:00:00.000000000 Z
11
+ date: 2015-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake