devise_revocable_session 0.1.4 → 0.1.6

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: f121d19ea59cbf8337a25cc083d8a408c6aec671d6f55f34bf2302386abe64ce
4
- data.tar.gz: 274c68241060e072ac0b49f2adcb0dff13d3728066ea7281c38a5b00b2e77f52
3
+ metadata.gz: 5b7209edf540e2961cce60a3d781de9e60b2b5d057cb52b176f503c1a8016df3
4
+ data.tar.gz: 5679f680c85705d06ec77814e62e9596abb97d8a067ded5d596c6424a98ac880
5
5
  SHA512:
6
- metadata.gz: '06992900b962228b692e2502366c101f06daf873a324c306ea2325c5204e5714bd3da5c7e7d282f100462133ff60a12c508e3c96f7a4c580f7dc614fa0272b50'
7
- data.tar.gz: 7d8bf87dbf7a9e76bdbdd43a92739b4ca70587e243e56e33755b8a5891d6504b763532da61b0cf00aeb8924984f2b3ba429c02cfaea9792128381f073a8086e3
6
+ metadata.gz: a6180589c5d4ac5317619ae7dc5286b9652cda3f35cac2a276ad85722b76b08858c667664e1b84d035bd753f78b1829ce68ab42f41633cf19c56063a69cab732
7
+ data.tar.gz: '084174bdc4bd370dd65ce3720908bf38ecdb48ebdb0413070df6772c5856a7b0ebf0b689bc73d25f36ec584a47195c0355bb0ebc4943f728403d719307a9403c'
@@ -0,0 +1,21 @@
1
+ <!--
2
+ Your audience for this issue description is **other engineers**. Help them understand the technical requirements, questions, etc involved.
3
+ -->
4
+
5
+ ## What's the issue?
6
+
7
+ <!--
8
+ What is wrong, or what is the reason you're making this issue? Is there a bug, general question, just want a reminder note of something, etc?
9
+ -->
10
+
11
+ ## Related URLs
12
+
13
+ <!--
14
+ Links to bug tickets, user stories, or other merge requests.
15
+ -->
16
+
17
+ ## Anything else people should know?
18
+
19
+ <!--
20
+ What else should readers of this issue know? If there's a bug, how do you reproduce it and what is the expected behavior? If it's a feature request, what other solutions have you considered? Do you have any suggestions for how else to fix this issue?
21
+ -->
@@ -0,0 +1,47 @@
1
+ <!--
2
+ Your audience for this merge request description is **code reviewers**. Help them understand the technical implications involved in this change. The JIRA ticket should outline the user-facing details.
3
+
4
+ Remember that Product and QA teams may have other test cases, verifications, and requirements associated with this change. Your Verification and QA plan should be directed towards Code Reviewers.
5
+ -->
6
+
7
+ ## What and Why
8
+
9
+ <!--
10
+ What are you changing? Describe impact and scope. Why is this being changed? Provide some context that may help future developers understand the reasoning behind these changes. Quote and/or link to requirements, keeping in mind that JIRA links may not be available in the future.
11
+ -->
12
+
13
+ ## Deploy Plan
14
+
15
+ <!--
16
+ Is there anything special about this deploy? Are migrations present? Are there other merge requests that need to be shipped before this one? Are there any manual steps required, such as data migrations, search reindexes, etc?
17
+ -->
18
+
19
+ ## Rollback Plan
20
+
21
+ <!--
22
+ Is there anything special about this rollback plan? Does this merge request anything that may need to be cleaned up manually (data migrations, search reindexes, etc)? Are there other associated merge requests that would also need to be reverted?
23
+ -->
24
+
25
+ To roll back this change, revert the merge with: `git revert -m 1 MERGE_SHA` and perform another deploy.
26
+
27
+ ## Related URLs
28
+
29
+ <!--
30
+ Links to bug tickets, user stories, or other merge requests.
31
+ -->
32
+
33
+ ## Verification and QA Plan
34
+
35
+ <!--
36
+ Fill in scenarios below in checklist format and complete them before merging. Evaluate the risk level and label this merge request or indicate risk in this description. Ensure the Verification and QA Plan matches the risk level appropriately.
37
+
38
+ Consider these topics:
39
+ * regressions (did we break something else related to this change?)
40
+ * edge cases (weird scenarios we don't immediately think of, but could occur)
41
+ * happy path (testing the new feature directly)
42
+ * data model changes
43
+ * data elements to add or remove from indexes
44
+ * changes in data models requiring migrations to be performed
45
+ -->
46
+
47
+ - [ ] Example scenario
@@ -0,0 +1,8 @@
1
+ [allowlist]
2
+ description = 'A list of commits and secrets to skip when scanning for secrets'
3
+ commits = [
4
+ 'ExampleCommit'
5
+ ]
6
+ regexes = [
7
+ 'ExampleSecret'
8
+ ]
@@ -0,0 +1,29 @@
1
+ name: Scheduled
2
+ on:
3
+ schedule:
4
+ - cron: "0 4 * * 1" # 4am UTC on Mondays (10pm/11pm CT on Sundays)
5
+
6
+ jobs:
7
+ bundler-audit:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/checkout@v3
11
+ with:
12
+ fetch-depth: 0
13
+ - uses: ruby/setup-ruby@v1
14
+ with:
15
+ bundler-cache: true
16
+ - run: |
17
+ gem install bundler-audit
18
+ bundler-audit update
19
+ bundler-audit
20
+ bundle-outdated:
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - uses: actions/checkout@v3
24
+ with:
25
+ fetch-depth: 0
26
+ - uses: ruby/setup-ruby@v1
27
+ with:
28
+ bundler-cache: true
29
+ - run: bundle outdated --strict
@@ -0,0 +1,50 @@
1
+ name: Test
2
+ on:
3
+ push:
4
+ branches: [ main ]
5
+ pull_request:
6
+ branches: [ main ]
7
+
8
+ env:
9
+ GITLEAKS_VERSION: v8.13.0
10
+
11
+ jobs:
12
+ pronto:
13
+ if: github.EVENT_NAME == 'pull_request'
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v3
17
+ with:
18
+ fetch-depth: 0
19
+ - uses: HeRoMo/pronto-action@v1.32.0
20
+ with:
21
+ github_token: ${{ secrets.GITHUB_TOKEN }}
22
+ gitleaks:
23
+ if: github.EVENT_NAME == 'pull_request'
24
+ runs-on: ubuntu-latest
25
+ steps:
26
+ - uses: actions/checkout@v3
27
+ with:
28
+ fetch-depth: 0
29
+ - run: |
30
+ curl -H "Accept: application/vnd.github.v3.raw" \
31
+ -L "https://api.github.com/repos/zricethezav/gitleaks/contents/config/gitleaks.toml?ref=${{ env.GITLEAKS_VERSION }}" \
32
+ >> ${{ github.WORKSPACE }}/.github/workflows/original.toml
33
+ sed "/\[allowlist\]/,/^$/d" ${{ github.WORKSPACE }}/.github/workflows/original.toml >> ${{ github.WORKSPACE }}/.github/workflows/official.toml
34
+ cat .github/workflows/gitleaks.toml >> .github/workflows/official.toml
35
+ if [[ ${{ github.REF }} == 'refs/heads/main' ]]; then
36
+ CURRENT_COMMIT="${{ github.SHA }}"
37
+ else
38
+ CURRENT_COMMIT="${{ github.EVENT.PULL_REQUEST.HEAD.SHA }}"
39
+ fi
40
+ echo "LOG_OPTS='^origin/main $CURRENT_COMMIT'" >> $GITHUB_ENV
41
+ - uses: addnab/docker-run-action@v3
42
+ with:
43
+ image: zricethezav/gitleaks:${{ env.GITLEAKS_VERSION }}
44
+ options: -v ${{ github.WORKSPACE }}:/app
45
+ run: |
46
+ cd /app
47
+ git config --global --add safe.directory /app
48
+ gitleaks detect --verbose --source='./' \
49
+ --config='.github/workflows/official.toml' \
50
+ --log-opts=${{ env.LOG_OPTS }}
data/.rubocop.yml ADDED
@@ -0,0 +1,48 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ SuggestExtensions: false
4
+ TargetRubyVersion: 3.1
5
+ Exclude:
6
+ - vendor/**/*
7
+
8
+ Gemspec/RequiredRubyVersion:
9
+ Enabled: false
10
+
11
+ Gemspec/RequireMFA:
12
+ Enabled: false
13
+
14
+ Style/Documentation:
15
+ Enabled: false
16
+
17
+ Layout/LineLength:
18
+ Exclude:
19
+ - spec/**/*
20
+
21
+ Lint/EmptyClass:
22
+ Enabled: false
23
+
24
+ Lint/EmptyBlock:
25
+ Enabled: false
26
+
27
+ Lint/MissingSuper:
28
+ Enabled: false
29
+
30
+ Metrics/BlockLength:
31
+ Enabled: true
32
+ Exclude:
33
+ - spec/**/*
34
+ - ninny.gemspec
35
+
36
+ Metrics/MethodLength:
37
+ Max: 15
38
+
39
+ Style/AccessModifierDeclarations:
40
+ EnforcedStyle: inline
41
+
42
+ Style/BlockDelimiters:
43
+ Enabled: true
44
+ Exclude:
45
+ - spec/**/*
46
+
47
+ Style/OptionalBooleanParameter:
48
+ Enabled: false
data/.ruby_version ADDED
@@ -0,0 +1 @@
1
+ 3.1.2
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Dispatch
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A module for devise to revoke sessions.
4
4
 
5
- This is borrowed heavily from: https://github.com/mkhairi/devise_revocable and https://www.jonathanleighton.com/articles/2013/revocable-sessions-with-devise/
5
+ This is borrowed heavily from: https://github.com/mkhairi/devise_revocable and https://www.jonathanleighton.com/articles/2013/revocable-sessions-with-devise/.
6
6
 
7
7
  ## Installation
8
8
 
@@ -14,26 +14,57 @@ gem 'devise_revocable_session'
14
14
 
15
15
  And then execute:
16
16
 
17
- $ bundle
17
+ ```bash
18
+ $ bundle install
19
+ ```
18
20
 
19
21
  Or install it yourself as:
20
22
 
21
- $ gem install devise_revocable_session
23
+ ```bash
24
+ $ gem install devise_revocable_session
25
+ ```
22
26
 
23
27
  ## Usage
24
28
 
25
29
  Install using the generator
26
30
 
27
- $ rails g devise_revocable_sessions
31
+ ```bash
32
+ $ rails g devise_revocable_sessions
33
+ ```
34
+
35
+ Add `:revocable_session` to your model's devise declaration.
36
+
37
+ ## Development
28
38
 
39
+ ### Making Changes
29
40
 
30
- Add `:revocable_session` to your model's devise declaration
41
+ 1. Clone or fork the repository
42
+ 2. Create a feature branch for your changes
43
+ 3. Run `bundle install`
44
+ 4. Make your changes
45
+ 6. Test the gem locally
46
+ * Run `gem build *.gemspec` to build the gem locally
47
+ * Run `gem install --local devise_revocable_session-X.X.X.gem` to install the gem locally
48
+ 7. Make a pull request back to this repository
31
49
 
50
+ ### Releasing
51
+
52
+ 1. Make sure the `lib/devise_revocable_session/version.rb` file is updated with a new version
53
+ 2. Run `git tag vX.X.X && git push --tag`
54
+ 3. Run `gem build *.gemspec`
55
+ 4. Run `gem push *.gem` to push the new version to RubyGems
56
+ 5. Run `rm *.gem` to clean up your local repository
57
+
58
+ To set up your local machine to push to RubyGems via the API, see the [RubyGems documentation](https://guides.rubygems.org/publishing/#publishing-to-rubygemsorg).
32
59
 
33
60
  ## Contributing
34
61
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/carlallen/devise_revocable_session. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
62
+ Bug reports and pull requests are welcome on GitHub at https://github.com/dispatchitinc/devise_revocable_session. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
63
+
64
+ ## Code of Conduct
65
+
66
+ Everyone interacting in the DeviseRevocableSession project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
67
 
37
- ## License
68
+ ## Copyright
38
69
 
39
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
70
+ Copyright (c) 2022 Dispatch. See [MIT License](LICENSE.txt) for further details.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Devise
2
4
  class RevocableSession < ApplicationRecord
3
5
  belongs_to :resource, polymorphic: true
@@ -1,26 +1,31 @@
1
- $:.push File.expand_path("../lib", __FILE__)
2
- require "devise_revocable_session/version"
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'devise_revocable_session/version'
3
6
 
4
7
  Gem::Specification.new do |spec|
5
- spec.name = "devise_revocable_session"
8
+ spec.name = 'devise_revocable_session'
9
+ spec.license = 'MIT'
6
10
  spec.version = DeviseRevocableSession::VERSION
7
- spec.authors = ['Carl Allen']
8
- spec.email = ["github@allenofmn.com"]
11
+ spec.authors = ['DispatchIt, Inc. Engineers']
12
+ spec.email = ['engineers@dispatchit.com']
9
13
 
10
14
  spec.summary = 'A module for devise to revoke sessions'
11
15
  spec.description = 'A module for devise to revoke sessions'
12
- spec.homepage = 'http://github.com/carlallen/devise_revocable_session'
13
- spec.license = 'MIT'
16
+ spec.homepage = 'http://github.com/dispatchitinc/devise_revocable_session'
17
+ spec.metadata = { 'rubygems_mfa_required' => 'false' }
14
18
 
15
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
16
- f.match(%r{^(test|spec|features)/})
19
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
21
  end
18
- spec.bindir = "exe"
22
+
23
+ spec.bindir = 'exe'
19
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
- spec.require_paths = ["lib"]
25
+ spec.require_paths = ['lib']
26
+
27
+ spec.add_development_dependency 'rake', '~> 10.0'
21
28
 
22
- spec.add_development_dependency "bundler", "~> 1.16"
23
- spec.add_development_dependency "rake", "~> 10.0"
24
- spec.add_dependency "devise"
25
- spec.add_dependency "activemodel"
29
+ spec.add_dependency 'activemodel'
30
+ spec.add_dependency 'devise'
26
31
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # After authenticating, we’re removing any session activation that may already
2
4
  # exist, and creating a new session# activation. We generate our own random id
3
5
  # (in User#activate_session) and store it in the auth_id key. There is already
@@ -58,9 +58,7 @@ module Devise
58
58
  def devise_writer_wrapper
59
59
  role = Rails.application.config.active_record.writing_role || :writing
60
60
  ActiveRecord::Base.connected_to(role: role) do
61
- ActiveRecord::Base.connection_handler.while_preventing_writes(false) do
62
- yield
63
- end
61
+ ActiveRecord.legacy_connection_handling
64
62
  end
65
63
  end
66
64
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeviseRevocableSession
4
- VERSION = "0.1.4"
4
+ VERSION = '0.1.6'
5
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "devise_revocable_session/version"
2
4
  require 'devise'
3
5
  require 'devise_revocable_session/hooks/revocable_session'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rails/generators/migration'
2
4
 
3
5
  class DeviseRevocableSessionGenerator < Rails::Generators::Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreateRevocableSessions < ActiveRecord::Migration<%= migration_version %>
2
4
  def change
3
5
  create_table :revocable_sessions do |t|
@@ -21,4 +23,3 @@ class CreateRevocableSessions < ActiveRecord::Migration<%= migration_version %>
21
23
  end
22
24
  end
23
25
  end
24
-
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_revocable_session
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
- - Carl Allen
8
- autorequire:
7
+ - DispatchIt, Inc. Engineers
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-24 00:00:00.000000000 Z
11
+ date: 2022-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.16'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.16'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rake
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +25,7 @@ dependencies:
39
25
  - !ruby/object:Gem::Version
40
26
  version: '10.0'
41
27
  - !ruby/object:Gem::Dependency
42
- name: devise
28
+ name: activemodel
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
31
  - - ">="
@@ -53,7 +39,7 @@ dependencies:
53
39
  - !ruby/object:Gem::Version
54
40
  version: '0'
55
41
  - !ruby/object:Gem::Dependency
56
- name: activemodel
42
+ name: devise
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
45
  - - ">="
@@ -68,14 +54,21 @@ dependencies:
68
54
  version: '0'
69
55
  description: A module for devise to revoke sessions
70
56
  email:
71
- - github@allenofmn.com
57
+ - engineers@dispatchit.com
72
58
  executables: []
73
59
  extensions: []
74
60
  extra_rdoc_files: []
75
61
  files:
62
+ - ".github/issue_template.md"
63
+ - ".github/pull_request_template.md"
64
+ - ".github/workflows/gitleaks.toml"
65
+ - ".github/workflows/scheduled.yml"
66
+ - ".github/workflows/test.yml"
76
67
  - ".gitignore"
68
+ - ".rubocop.yml"
69
+ - ".ruby_version"
77
70
  - Gemfile
78
- - LICENSE
71
+ - LICENSE.txt
79
72
  - README.md
80
73
  - Rakefile
81
74
  - app/models/devise/revocable_session.rb
@@ -88,11 +81,12 @@ files:
88
81
  - lib/devise_revocable_session/version.rb
89
82
  - lib/generators/devise_revocable_session/devise_revocable_session_generator.rb
90
83
  - lib/generators/devise_revocable_session/templates/migration.rb
91
- homepage: http://github.com/carlallen/devise_revocable_session
84
+ homepage: http://github.com/dispatchitinc/devise_revocable_session
92
85
  licenses:
93
86
  - MIT
94
- metadata: {}
95
- post_install_message:
87
+ metadata:
88
+ rubygems_mfa_required: 'false'
89
+ post_install_message:
96
90
  rdoc_options: []
97
91
  require_paths:
98
92
  - lib
@@ -107,8 +101,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
101
  - !ruby/object:Gem::Version
108
102
  version: '0'
109
103
  requirements: []
110
- rubygems_version: 3.0.4
111
- signing_key:
104
+ rubygems_version: 3.3.7
105
+ signing_key:
112
106
  specification_version: 4
113
107
  summary: A module for devise to revoke sessions
114
108
  test_files: []
data/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2019 Carl Allen
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.