omniauth-rails_csrf_protection 0.1.2 → 1.0.1

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: 6ddd12c3aa3f5c4f89fbfeceeef6809aeee75e299cd2671447240368334553d4
4
- data.tar.gz: 27675eb799f7693ae06ed1327efcb50b93f4c9944bc5c2882dff4aa48364fc57
3
+ metadata.gz: b7c9f0953f60f411b88e66c914509308274d46c44a5fa42e1531740fc94c0be5
4
+ data.tar.gz: 1420e37a8f982fded587e1960309871054fc7e4a6ae4e237d5783025983a4c31
5
5
  SHA512:
6
- metadata.gz: 73c42c5bc5763dc015c27685436b1dc01d04f2161b9f9717d223019e2bbb0c2785aeabbf9044369dfeca7d19a1c5251c6f47b11f7b37fb0c15aedb833536d871
7
- data.tar.gz: a92516800f4e6817eb762cf74b64e525813948024ef3362e8b02d4a608fc280f1a3b0cde2c498ec9760ee98b94af8d6c40fa556db6d8e6f1078056f41083a026
6
+ metadata.gz: 95efbe6ce15fd93acf8e4953ffbc058e681dda33f0a129a3b0a33c1c9000faf25a4bb789de45cd89603cfa2e5702b15c51db6468bbf616754199cf54e55cf750
7
+ data.tar.gz: dabea2ed5fddeda77f46fd7cee2a4f1b5f79d8dc042eba02dc64fda6ef304f828cce81d63c42a2592cd059511d080a6dd77db4ceb5de8dc17740e6d58fea04fb
data/.circleci/config.yml CHANGED
@@ -21,11 +21,23 @@ ruby-2-4: &ruby-2-4
21
21
 
22
22
  ruby-2-5: &ruby-2-5
23
23
  docker:
24
- - image: circleci/ruby:2.5
24
+ - image: cimg/ruby:2.5
25
25
 
26
26
  ruby-2-6: &ruby-2-6
27
27
  docker:
28
- - image: circleci/ruby:2.6
28
+ - image: cimg/ruby:2.6
29
+
30
+ ruby-2-7: &ruby-2-7
31
+ docker:
32
+ - image: cimg/ruby:2.7
33
+
34
+ ruby-3-0: &ruby-3-0
35
+ docker:
36
+ - image: cimg/ruby:3.0
37
+
38
+ ruby-3-1: &ruby-3-1
39
+ docker:
40
+ - image: cimg/ruby:3.1
29
41
 
30
42
  rails-4-2: &rails-4-2
31
43
  environment:
@@ -45,11 +57,19 @@ rails-5-2: &rails-5-2
45
57
 
46
58
  rails-6-0: &rails-6-0
47
59
  environment:
48
- RAILS_VERSION: "6.0.0.rc1"
60
+ RAILS_VERSION: "~> 6.0.0"
61
+
62
+ rails-6-1: &rails-6-1
63
+ environment:
64
+ RAILS_VERSION: "~> 6.1.0"
65
+
66
+ rails-7-0: &rails-7-0
67
+ environment:
68
+ RAILS_VERSION: "~> 7.0.0"
49
69
 
50
70
  rails-edge: &rails-edge
51
71
  environment:
52
- RAILS_BRANCH: "master"
72
+ RAILS_BRANCH: "main"
53
73
 
54
74
  jobs:
55
75
  "ruby-2-4-rails-4-2":
@@ -85,6 +105,10 @@ jobs:
85
105
  <<: *ruby-2-5
86
106
  <<: *rails-6-0
87
107
  <<: *build_steps
108
+ "ruby-2-5-rails-6-1":
109
+ <<: *ruby-2-5
110
+ <<: *rails-6-1
111
+ <<: *build_steps
88
112
  "ruby-2-5-rails-edge":
89
113
  <<: *ruby-2-5
90
114
  <<: *rails-edge
@@ -106,11 +130,78 @@ jobs:
106
130
  <<: *ruby-2-6
107
131
  <<: *rails-6-0
108
132
  <<: *build_steps
133
+ "ruby-2-6-rails-6-1":
134
+ <<: *ruby-2-6
135
+ <<: *rails-6-1
136
+ <<: *build_steps
109
137
  "ruby-2-6-rails-edge":
110
138
  <<: *ruby-2-6
111
139
  <<: *rails-edge
112
140
  <<: *build_steps
113
141
 
142
+ "ruby-2-7-rails-5-0":
143
+ <<: *ruby-2-7
144
+ <<: *rails-5-0
145
+ <<: *build_steps
146
+ "ruby-2-7-rails-5-1":
147
+ <<: *ruby-2-7
148
+ <<: *rails-5-1
149
+ <<: *build_steps
150
+ "ruby-2-7-rails-5-2":
151
+ <<: *ruby-2-7
152
+ <<: *rails-5-2
153
+ <<: *build_steps
154
+ "ruby-2-7-rails-6-0":
155
+ <<: *ruby-2-7
156
+ <<: *rails-6-0
157
+ <<: *build_steps
158
+ "ruby-2-7-rails-6-1":
159
+ <<: *ruby-2-7
160
+ <<: *rails-6-1
161
+ <<: *build_steps
162
+ "ruby-2-7-rails-7-0":
163
+ <<: *ruby-2-7
164
+ <<: *rails-7-0
165
+ <<: *build_steps
166
+ "ruby-2-7-rails-edge":
167
+ <<: *ruby-2-7
168
+ <<: *rails-edge
169
+ <<: *build_steps
170
+
171
+ "ruby-3-0-rails-6-0":
172
+ <<: *ruby-3-0
173
+ <<: *rails-6-0
174
+ <<: *build_steps
175
+ "ruby-3-0-rails-6-1":
176
+ <<: *ruby-3-0
177
+ <<: *rails-6-1
178
+ <<: *build_steps
179
+ "ruby-3-0-rails-7-0":
180
+ <<: *ruby-3-0
181
+ <<: *rails-7-0
182
+ <<: *build_steps
183
+ "ruby-3-0-rails-edge":
184
+ <<: *ruby-3-0
185
+ <<: *rails-edge
186
+ <<: *build_steps
187
+
188
+ "ruby-3-1-rails-6-0":
189
+ <<: *ruby-3-1
190
+ <<: *rails-6-0
191
+ <<: *build_steps
192
+ "ruby-3-1-rails-6-1":
193
+ <<: *ruby-3-1
194
+ <<: *rails-6-1
195
+ <<: *build_steps
196
+ "ruby-3-1-rails-7-0":
197
+ <<: *ruby-3-1
198
+ <<: *rails-7-0
199
+ <<: *build_steps
200
+ "ruby-3-1-rails-edge":
201
+ <<: *ruby-3-1
202
+ <<: *rails-edge
203
+ <<: *build_steps
204
+
114
205
  workflows:
115
206
  version: 2
116
207
  build:
@@ -123,10 +214,28 @@ workflows:
123
214
  - "ruby-2-5-rails-5-1"
124
215
  - "ruby-2-5-rails-5-2"
125
216
  - "ruby-2-5-rails-6-0"
126
- - "ruby-2-5-rails-edge"
217
+ - "ruby-2-5-rails-6-1"
127
218
 
128
219
  - "ruby-2-6-rails-5-0"
129
220
  - "ruby-2-6-rails-5-1"
130
221
  - "ruby-2-6-rails-5-2"
131
222
  - "ruby-2-6-rails-6-0"
132
- - "ruby-2-6-rails-edge"
223
+ - "ruby-2-6-rails-6-1"
224
+
225
+ - "ruby-2-7-rails-5-0"
226
+ - "ruby-2-7-rails-5-1"
227
+ - "ruby-2-7-rails-5-2"
228
+ - "ruby-2-7-rails-6-0"
229
+ - "ruby-2-7-rails-6-1"
230
+ - "ruby-2-7-rails-7-0"
231
+ - "ruby-2-7-rails-edge"
232
+
233
+ - "ruby-3-0-rails-6-0"
234
+ - "ruby-3-0-rails-6-1"
235
+ - "ruby-3-0-rails-7-0"
236
+ - "ruby-3-0-rails-edge"
237
+
238
+ - "ruby-3-1-rails-6-0"
239
+ - "ruby-3-1-rails-6-1"
240
+ - "ruby-3-1-rails-7-0"
241
+ - "ruby-3-1-rails-edge"
data/README.md CHANGED
@@ -1,11 +1,13 @@
1
1
  # OmniAuth - Rails CSRF Protection
2
2
 
3
- This gem provides a mitigation against CVE-2015-9284 (Cross-Site Request
4
- Forgery on the request phrase when using OmniAuth gem with a Ruby on Rails
5
- application) by implementing a CSRF token verifier that directly utilize
3
+ This gem provides a mitigation against [CVE-2015-9284] (Cross-Site Request
4
+ Forgery on the request phase when using OmniAuth gem with a Ruby on Rails
5
+ application) by implementing a CSRF token verifier that directly uses
6
6
  `ActionController::RequestForgeryProtection` code from Rails.
7
7
 
8
- [![CircleCI](https://circleci.com/gh/cookpad/omniauth-rails_csrf_protection/tree/master.svg?style=svg)](https://circleci.com/gh/cookpad/omniauth-rails_csrf_protection/tree/master)
8
+ [![CircleCI](https://circleci.com/gh/cookpad/omniauth-rails_csrf_protection/tree/main.svg?style=svg)](https://circleci.com/gh/cookpad/omniauth-rails_csrf_protection/tree/main)
9
+
10
+ [CVE-2015-9284]: https://nvd.nist.gov/vuln/detail/CVE-2015-9284
9
11
 
10
12
  ## Usage
11
13
 
@@ -18,7 +20,7 @@ gem "omniauth-rails_csrf_protection"
18
20
  Then run `bundle install` to install this gem.
19
21
 
20
22
  You will then need to verify that all links in your application that would
21
- initiate OAuth request phrase are being converted to a HTTP POST form that
23
+ initiate OAuth request phase are being converted to a HTTP POST form that
22
24
  contains `authenticity_token` value. This might simply be done by changing all
23
25
  `link_to` to `button_to`, or use `link_to ..., method: :post`.
24
26
 
@@ -26,10 +28,10 @@ contains `authenticity_token` value. This might simply be done by changing all
26
28
 
27
29
  This gem does a few things to your application:
28
30
 
29
- * Disable access to the OAuth request phrase using HTTP GET method.
30
- * Insert a Rails CSRF token verifier at before request phrase.
31
+ * Disable access to the OAuth request phase using HTTP GET method.
32
+ * Insert a Rails CSRF token verifier at the before request phase.
31
33
 
32
- These actions mitigate you from the attack vector described in CVE-2015-9284.
34
+ These actions mitigate you from the attack vector described in [CVE-2015-9284].
33
35
 
34
36
  ## Contributing
35
37
 
@@ -47,4 +49,4 @@ The gem is available as open source under the terms of the
47
49
 
48
50
  Everyone interacting in the this project’s codebases, issue trackers, chat
49
51
  rooms and mailing lists is expected to follow the
50
- [code of conduct](https://github.com/cookpad/omniauth-rails_csrf_protection/blob/master/CODE_OF_CONDUCT.md).
52
+ [code of conduct](https://github.com/cookpad/omniauth-rails_csrf_protection/blob/main/CODE_OF_CONDUCT.md).
@@ -1,11 +1,11 @@
1
+ require "omniauth"
1
2
  require "omniauth/rails_csrf_protection/token_verifier"
2
3
 
3
4
  module OmniAuth
4
5
  module RailsCsrfProtection
5
6
  class Railtie < Rails::Railtie
6
7
  initializer "omniauth-rails_csrf_protection.initialize" do
7
- OmniAuth.config.allowed_request_methods = [:post]
8
- OmniAuth.config.before_request_phase = TokenVerifier.new
8
+ OmniAuth.config.request_validation_phase = TokenVerifier.new
9
9
  end
10
10
  end
11
11
  end
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module RailsCsrfProtection
3
- VERSION = "0.1.2".freeze
3
+ VERSION = "1.0.1".freeze
4
4
  end
5
5
  end
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ["lib"]
29
29
 
30
30
  spec.add_dependency "actionpack", ">= 4.2"
31
- spec.add_dependency "omniauth", ">= 1.3.1"
31
+ spec.add_dependency "omniauth", "~> 2.0"
32
32
 
33
33
  spec.add_development_dependency "bundler"
34
34
  spec.add_development_dependency "minitest"
@@ -11,14 +11,16 @@ class ApplicationTest < Minitest::Test
11
11
 
12
12
  def test_request_phrase_without_token_via_post
13
13
  post "/auth/developer"
14
+ follow_redirect!
14
15
 
15
- assert last_response.unprocessable?
16
+ assert last_response.not_found?
16
17
  end
17
18
 
18
19
  def test_request_phrase_with_bad_token_via_post
19
20
  post "/auth/developer", authenticity_token: "BAD_TOKEN"
21
+ follow_redirect!
20
22
 
21
- assert last_response.unprocessable?
23
+ assert last_response.not_found?
22
24
  end
23
25
 
24
26
  def test_request_phrase_with_correct_token_via_post
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-rails_csrf_protection
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cookpad Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-04 00:00:00.000000000 Z
11
+ date: 2022-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: omniauth
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.3.1
33
+ version: '2.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.3.1
40
+ version: '2.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -124,7 +124,7 @@ homepage: https://github.com/cookpad/omniauth-rails_csrf_protection
124
124
  licenses:
125
125
  - MIT
126
126
  metadata: {}
127
- post_install_message:
127
+ post_install_message:
128
128
  rdoc_options: []
129
129
  require_paths:
130
130
  - lib
@@ -139,8 +139,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
139
  - !ruby/object:Gem::Version
140
140
  version: '0'
141
141
  requirements: []
142
- rubygems_version: 3.0.3
143
- signing_key:
142
+ rubygems_version: 3.2.32
143
+ signing_key:
144
144
  specification_version: 4
145
145
  summary: Provides CSRF protection on OmniAuth request endpoint on Rails application.
146
146
  test_files: