omniauth-rails_csrf_protection 1.0.1 → 1.0.2

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: b7c9f0953f60f411b88e66c914509308274d46c44a5fa42e1531740fc94c0be5
4
- data.tar.gz: 1420e37a8f982fded587e1960309871054fc7e4a6ae4e237d5783025983a4c31
3
+ metadata.gz: ca8b6b6b0f1b3f05b0317c4e0f629529a44158edc57497fee9eec34a1422125d
4
+ data.tar.gz: 640c1535d81dea4a56fac9e851dc595f351d05dfc53e11ef3a720aeba1d2b770
5
5
  SHA512:
6
- metadata.gz: 95efbe6ce15fd93acf8e4953ffbc058e681dda33f0a129a3b0a33c1c9000faf25a4bb789de45cd89603cfa2e5702b15c51db6468bbf616754199cf54e55cf750
7
- data.tar.gz: dabea2ed5fddeda77f46fd7cee2a4f1b5f79d8dc042eba02dc64fda6ef304f828cce81d63c42a2592cd059511d080a6dd77db4ceb5de8dc17740e6d58fea04fb
6
+ metadata.gz: 9db585b6633c9a06372ed96fd2c4a59502d75f7eb39c69f25c92bd0706ad5d2f0ae03d8471fd8ff19342cf98b01159ed742251eb568b200960eb031956b3976a
7
+ data.tar.gz: d6ff32d88319e0072a760853da4a7dca07bfab9ad6a5243552df8eeb7a603ee133f69a38686ce3d591c29b4bb131217348c0a6bc8010c1e45aea3478235e0cb5
data/README.md CHANGED
@@ -5,8 +5,6 @@ Forgery on the request phase when using OmniAuth gem with a Ruby on Rails
5
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/main.svg?style=svg)](https://circleci.com/gh/cookpad/omniauth-rails_csrf_protection/tree/main)
9
-
10
8
  [CVE-2015-9284]: https://nvd.nist.gov/vuln/detail/CVE-2015-9284
11
9
 
12
10
  ## Usage
@@ -28,6 +28,10 @@ module OmniAuth
28
28
  end
29
29
 
30
30
  def call(env)
31
+ dup._call(env)
32
+ end
33
+
34
+ def _call(env)
31
35
  @request = ActionDispatch::Request.new(env.dup)
32
36
 
33
37
  unless verified_request?
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module RailsCsrfProtection
3
- VERSION = "1.0.1".freeze
3
+ VERSION = "1.0.2".freeze
4
4
  end
5
5
  end
data/test/test_helper.rb CHANGED
@@ -18,7 +18,12 @@ silence_warnings do
18
18
  gemfile do
19
19
  source "https://rubygems.org"
20
20
 
21
- gem "rails"
21
+ if ENV["RAILS_VERSION"] == "edge"
22
+ gem "rails", git: "https://github.com/rails/rails.git", branch: "main"
23
+ else
24
+ gem "rails"
25
+ end
26
+
22
27
  gem "omniauth"
23
28
  gem "omniauth-rails_csrf_protection", path: File.expand_path("..", __dir__)
24
29
  end
@@ -34,7 +39,7 @@ require "minitest/autorun"
34
39
  class TestApp < Rails::Application
35
40
  config.root = __dir__
36
41
  config.session_store :cookie_store, key: "cookie_store_key"
37
- secrets.secret_key_base = "secret_key_base"
42
+ config.secret_key_base = "secret_key_base"
38
43
  config.eager_load = false
39
44
  config.hosts = []
40
45
 
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: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cookpad Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-07 00:00:00.000000000 Z
11
+ date: 2024-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -105,19 +105,12 @@ executables: []
105
105
  extensions: []
106
106
  extra_rdoc_files: []
107
107
  files:
108
- - ".circleci/config.yml"
109
- - ".gitignore"
110
- - ".rubocop.yml"
111
- - CODE_OF_CONDUCT.md
112
- - Gemfile
113
108
  - LICENSE.txt
114
109
  - README.md
115
- - Rakefile
116
110
  - lib/omniauth/rails_csrf_protection.rb
117
111
  - lib/omniauth/rails_csrf_protection/railtie.rb
118
112
  - lib/omniauth/rails_csrf_protection/token_verifier.rb
119
113
  - lib/omniauth/rails_csrf_protection/version.rb
120
- - omniauth-rails_csrf_protection.gemspec
121
114
  - test/application_test.rb
122
115
  - test/test_helper.rb
123
116
  homepage: https://github.com/cookpad/omniauth-rails_csrf_protection
@@ -139,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
132
  - !ruby/object:Gem::Version
140
133
  version: '0'
141
134
  requirements: []
142
- rubygems_version: 3.2.32
135
+ rubygems_version: 3.5.3
143
136
  signing_key:
144
137
  specification_version: 4
145
138
  summary: Provides CSRF protection on OmniAuth request endpoint on Rails application.
data/.circleci/config.yml DELETED
@@ -1,241 +0,0 @@
1
- version: 2.1
2
-
3
- build_steps: &build_steps
4
- steps:
5
- - checkout
6
- - run:
7
- name: Install dependencies
8
- command: bundle update
9
- - run:
10
- command: |-
11
- echo "Ruby version:" $(ruby -v)
12
- echo "Rails version: " $(rails -v)
13
- name: Show build information
14
- - run:
15
- name: Run tests
16
- command: rake
17
-
18
- ruby-2-4: &ruby-2-4
19
- docker:
20
- - image: circleci/ruby:2.4
21
-
22
- ruby-2-5: &ruby-2-5
23
- docker:
24
- - image: cimg/ruby:2.5
25
-
26
- ruby-2-6: &ruby-2-6
27
- docker:
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
41
-
42
- rails-4-2: &rails-4-2
43
- environment:
44
- RAILS_VERSION: "~> 4.2.0"
45
-
46
- rails-5-0: &rails-5-0
47
- environment:
48
- RAILS_VERSION: "~> 5.0.0"
49
-
50
- rails-5-1: &rails-5-1
51
- environment:
52
- RAILS_VERSION: "~> 5.1.0"
53
-
54
- rails-5-2: &rails-5-2
55
- environment:
56
- RAILS_VERSION: "~> 5.2.0"
57
-
58
- rails-6-0: &rails-6-0
59
- environment:
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"
69
-
70
- rails-edge: &rails-edge
71
- environment:
72
- RAILS_BRANCH: "main"
73
-
74
- jobs:
75
- "ruby-2-4-rails-4-2":
76
- <<: *ruby-2-4
77
- <<: *rails-4-2
78
- <<: *build_steps
79
- "ruby-2-4-rails-5-0":
80
- <<: *ruby-2-4
81
- <<: *rails-5-0
82
- <<: *build_steps
83
- "ruby-2-4-rails-5-1":
84
- <<: *ruby-2-4
85
- <<: *rails-5-1
86
- <<: *build_steps
87
- "ruby-2-4-rails-5-2":
88
- <<: *ruby-2-4
89
- <<: *rails-5-2
90
- <<: *build_steps
91
-
92
- "ruby-2-5-rails-5-0":
93
- <<: *ruby-2-5
94
- <<: *rails-5-0
95
- <<: *build_steps
96
- "ruby-2-5-rails-5-1":
97
- <<: *ruby-2-5
98
- <<: *rails-5-1
99
- <<: *build_steps
100
- "ruby-2-5-rails-5-2":
101
- <<: *ruby-2-5
102
- <<: *rails-5-2
103
- <<: *build_steps
104
- "ruby-2-5-rails-6-0":
105
- <<: *ruby-2-5
106
- <<: *rails-6-0
107
- <<: *build_steps
108
- "ruby-2-5-rails-6-1":
109
- <<: *ruby-2-5
110
- <<: *rails-6-1
111
- <<: *build_steps
112
- "ruby-2-5-rails-edge":
113
- <<: *ruby-2-5
114
- <<: *rails-edge
115
- <<: *build_steps
116
-
117
- "ruby-2-6-rails-5-0":
118
- <<: *ruby-2-6
119
- <<: *rails-5-0
120
- <<: *build_steps
121
- "ruby-2-6-rails-5-1":
122
- <<: *ruby-2-6
123
- <<: *rails-5-1
124
- <<: *build_steps
125
- "ruby-2-6-rails-5-2":
126
- <<: *ruby-2-6
127
- <<: *rails-5-2
128
- <<: *build_steps
129
- "ruby-2-6-rails-6-0":
130
- <<: *ruby-2-6
131
- <<: *rails-6-0
132
- <<: *build_steps
133
- "ruby-2-6-rails-6-1":
134
- <<: *ruby-2-6
135
- <<: *rails-6-1
136
- <<: *build_steps
137
- "ruby-2-6-rails-edge":
138
- <<: *ruby-2-6
139
- <<: *rails-edge
140
- <<: *build_steps
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
-
205
- workflows:
206
- version: 2
207
- build:
208
- jobs:
209
- - "ruby-2-4-rails-4-2"
210
- - "ruby-2-4-rails-5-1"
211
- - "ruby-2-4-rails-5-2"
212
-
213
- - "ruby-2-5-rails-5-0"
214
- - "ruby-2-5-rails-5-1"
215
- - "ruby-2-5-rails-5-2"
216
- - "ruby-2-5-rails-6-0"
217
- - "ruby-2-5-rails-6-1"
218
-
219
- - "ruby-2-6-rails-5-0"
220
- - "ruby-2-6-rails-5-1"
221
- - "ruby-2-6-rails-5-2"
222
- - "ruby-2-6-rails-6-0"
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/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- /.bundle/
2
- /.rubocop-*
3
- /.yardoc
4
- /Gemfile.lock
5
- /_yardoc/
6
- /coverage/
7
- /doc/
8
- /pkg/
9
- /spec/reports/
10
- /tmp/
data/.rubocop.yml DELETED
@@ -1,9 +0,0 @@
1
- inherit_from:
2
- - https://raw.githubusercontent.com/cookpad/global-style-guides/master/.rubocop.yml
3
-
4
- AllCops:
5
- TargetRubyVersion: 2.5
6
-
7
- # Disable this as this does not apply to rack-test
8
- Rails/HttpPositionalArguments:
9
- Enabled: false
data/CODE_OF_CONDUCT.md DELETED
@@ -1,75 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age,
8
- body size, disability, ethnicity, gender identity and expression, level of
9
- experience, nationality, personal appearance, race, religion, or sexual
10
- identity and orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an
52
- appointed representative at an online or offline event. Representation of a
53
- project may be further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at kaihatsu@cookpad.com. All complaints
59
- will be reviewed and investigated and will result in a response that is deemed
60
- necessary and appropriate to the circumstances. The project team is obligated
61
- to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage],
71
- version 1.4, available at
72
- [http://contributor-covenant.org/version/1/4][version]
73
-
74
- [homepage]: http://contributor-covenant.org
75
- [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile DELETED
@@ -1,11 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # rubocop:disable Bundler/DuplicatedGem
4
- if ENV["RAILS_VERSION"]
5
- gem "rails", ENV["RAILS_VERSION"]
6
- elsif ENV["RAILS_BRANCH"]
7
- gem "rails", git: "https://github.com/rails/rails.git", branch: ENV["RAILS_BRANCH"]
8
- end
9
- # rubocop:enable Bundler/DuplicatedGem
10
-
11
- gemspec
data/Rakefile DELETED
@@ -1,10 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList["test/**/*_test.rb"]
8
- end
9
-
10
- task default: :test
@@ -1,37 +0,0 @@
1
- lib = File.expand_path("lib", __dir__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "omniauth/rails_csrf_protection/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "omniauth-rails_csrf_protection"
7
- spec.version = OmniAuth::RailsCsrfProtection::VERSION
8
- spec.authors = ["Cookpad Inc."]
9
- spec.email = ["kaihatsu@cookpad.com"]
10
-
11
- spec.summary = <<~SUMMARY
12
- Provides CSRF protection on OmniAuth request endpoint on Rails application.
13
- SUMMARY
14
-
15
- spec.description = <<~DESCRIPTION
16
- This gem provides a mitigation against CVE-2015-9284 (Cross-Site Request
17
- Forgery on the request phrase when using OmniAuth gem with a Ruby on Rails
18
- application) by implementing a CSRF token verifier that directly utilize
19
- `ActionController::RequestForgeryProtection` code from Rails.
20
- DESCRIPTION
21
-
22
- spec.homepage = "https://github.com/cookpad/omniauth-rails_csrf_protection"
23
- spec.license = "MIT"
24
-
25
- spec.files = `git ls-files`.split("\n")
26
- spec.test_files = `git ls-files -- test/*`.split("\n")
27
-
28
- spec.require_paths = ["lib"]
29
-
30
- spec.add_dependency "actionpack", ">= 4.2"
31
- spec.add_dependency "omniauth", "~> 2.0"
32
-
33
- spec.add_development_dependency "bundler"
34
- spec.add_development_dependency "minitest"
35
- spec.add_development_dependency "rails"
36
- spec.add_development_dependency "rake"
37
- end