rails-auth 2.1.2 → 2.1.3

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: 53175b906593724848fe6edf409ec1ae4587be25
4
- data.tar.gz: 22fc25df91e79d8fa2930644ca29db47c3f7270a
3
+ metadata.gz: 04accd9068297df63d222180e00d66bb5a3cdc24
4
+ data.tar.gz: 36dba8c9eee4957f1defe679ae9d98ceba53393f
5
5
  SHA512:
6
- metadata.gz: b25632b4984227bce11e227e4842595b7be966819876c3a2dc0d67f05b77b65e76917b788dc179b1c4aa7a4473766aab2d43de0e3958d98ed33f97877bc9796a
7
- data.tar.gz: 0c584823d4fa31db393742b56a1511a9c7628caf01d6773c6b98a72491e7f6a731cd77b6245031db409f275adf840d987eaa57242c19cd8b63754d9e32614d18
6
+ metadata.gz: 790da2f08086cee1fd8719fff050e18e7cfc1301fb12483c327d117c0875bdc945fe404d7040a184f28dd69c352803b525acd720f94b8f7920f550776d950371
7
+ data.tar.gz: 4f6d90c4d94195cc5b42cd0f783d64168aa045178bea6ac6e646cbf80e221bc0668a9400358271449e570fe8358592ae7ae2d84897771da583c2a45592325426
data/CHANGES.md CHANGED
@@ -1,3 +1,9 @@
1
+ ### 2.1.3 (2017-08-04)
2
+
3
+ * [#44](https://github.com/square/rails-auth/pull/44)
4
+ Normalize abnormal whitespace in PEM certificates for Passenger 5.
5
+ ([@drcapulet])
6
+
1
7
  ### 2.1.2 (2017-01-27)
2
8
 
3
9
  * [#42](https://github.com/square/rails-auth/pull/42)
@@ -3,6 +3,6 @@
3
3
  module Rails
4
4
  # Pluggable authentication and authorization for Rack/Rails
5
5
  module Auth
6
- VERSION = "2.1.2".freeze
6
+ VERSION = "2.1.3".freeze
7
7
  end
8
8
  end
@@ -5,7 +5,14 @@ module Rails
5
5
  # Extract OpenSSL::X509::Certificates from Privacy Enhanced Mail (PEM) certificates
6
6
  class Pem
7
7
  def call(pem)
8
- OpenSSL::X509::Certificate.new(pem.delete("\t")).freeze
8
+ # Normalize the whitespace in the certificate to the exact format
9
+ # certificates are normally formatted in otherwise parsing with fail
10
+ # with a 'nested asn1 error'. split(" ") handles sequential whitespace
11
+ # characters like \t, \n, and space.
12
+ OpenSSL::X509::Certificate.new(pem.split(" ").instance_eval do
13
+ [[self[0], self[1]].join(" "), self[2...-2], [self[-2], self[-1]].join(" ")]
14
+ .flatten.join("\n")
15
+ end).freeze
9
16
  end
10
17
  end
11
18
  end
@@ -33,6 +33,13 @@ RSpec.describe Rails::Auth::X509::Middleware do
33
33
  _response, env = middleware.call(request.merge(example_key => bad_cert_pem))
34
34
  expect(Rails::Auth.credentials(env)).to be_empty
35
35
  end
36
+
37
+ it "normalizes abnormal whitespace" do
38
+ _response, env = middleware.call(request.merge(example_key => valid_cert_pem.tr("\n", "\t")))
39
+
40
+ credential = Rails::Auth.credentials(env).fetch("x509")
41
+ expect(credential).to be_a Rails::Auth::X509::Certificate
42
+ end
36
43
  end
37
44
 
38
45
  # :nocov:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Arcieri
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-27 00:00:00.000000000 Z
11
+ date: 2017-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  version: '0'
146
146
  requirements: []
147
147
  rubyforge_project:
148
- rubygems_version: 2.6.8
148
+ rubygems_version: 2.6.11
149
149
  signing_key:
150
150
  specification_version: 4
151
151
  summary: Modular resource-oriented authentication and authorization for Rails/Rack