angular_rails_csrf 6.0.0 → 7.0.1

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
  SHA256:
3
- metadata.gz: fd1f93c61de73220bcc0827bc1b460b0fd4440f5ec8597b01687aa2e0d50800e
4
- data.tar.gz: 0a0133f2183e46d61798a0501ce8ebff0c43310210c8fdd245b8436289e10756
3
+ metadata.gz: 93c2203c523539847ce011752c0a50ba0662f1f05aef215343ad3dd8f576cf2c
4
+ data.tar.gz: 19031ae6c4b9c5c9f4fcfdeadeb0853c7cc4c0fcd592768b833b06447d3ffdfe
5
5
  SHA512:
6
- metadata.gz: fff212dd32057d2b57b26331d859354c4e969593e8e03901d8d002ac112b11694a04d47bd8432d4bd7e90ad52d1a3b14ec150e26d297f714891fab72c42a9b6a
7
- data.tar.gz: d126f472156857b4b7460514de8fffe786ee697caee3835059bf8794cfbc5344e1c8c7473312fdb53bed369cf1622950f3b08f3c6acd7d70da009483d8e9e37e
6
+ metadata.gz: 9a4a6a941ccb94e0cdcd18b51db96c3efccf2beecaec88a105cd88a377cf8e1700c92cfb9ba555f86cb0f24452ce80c299154cf2704356da37ab240482270e44
7
+ data.tar.gz: 02431a3ecc99795abcd1d827cb3c1d058e285c12ccb2d3ecb4aa6f788cca4a9cf0e4796f516792aebacdd5d49047d8b077d8900ce4c154c74d420bac6225bb69
data/CHANGELOG.md ADDED
@@ -0,0 +1,125 @@
1
+ # Changelog
2
+
3
+ ## 7.0.1 (11-May-25)
4
+
5
+ * Test with Ruby 3.4
6
+ * Repo moved
7
+ * Add deprecation message
8
+
9
+ ## 7.0.0 (12-Nov-24)
10
+
11
+ * **Breaking change**: require Ruby 3.2+. If you need support for older Rubies, stay on version 6
12
+ * Set Railties dependency to `< 9`
13
+ * Test with Rails 8
14
+ * Do not test with Ruby 3.0 and 3.1
15
+
16
+ ## 6.0.0 (14-Nov-23)
17
+
18
+ * **Breaking change**: drop support for Ruby < 3. If you need to support older Rubies, stay on v5. If you'd like to support *even older stuff*, v4.5.0 is your choice as it plays nicely with Rails 5.1 and Ruby 2.5.
19
+ * Test only with Rails 7
20
+ * Fix some failing tests, minor tweaks
21
+
22
+ ## 5.0.0 (14-Dec-21)
23
+
24
+ * Add support for Rails 7.
25
+ * Test against Rails 6.1 and Rails 7.0.
26
+ * Test against Ruby 3.0.
27
+ * Rails 5.1 is not supported officially anymore (but should still work fine).
28
+ * Ruby < 2.7 is not supported anymore (has reached end of life) but should still work.
29
+
30
+ ## 4.5.0 (21-Sep-20)
31
+
32
+ * Added a new [`HttpOnly` option](https://github.com/jsanders/angular_rails_csrf#httponly-cookie) (thanks, [@Lubo-mir](https://github.com/Lubo-mir))
33
+ * Introduced some code refactorings
34
+
35
+ ## 4.4.0 (04-Aug-20)
36
+
37
+ * Make the gem play nicely with controllers that do not have `protect_against_forgery?` method defined — for example, certain Doorkeeper controllers (thanks, [@amenz](https://github.com/amenz))
38
+ * Updated dependencies and cops
39
+
40
+ ## 4.3.0 (18-May-20)
41
+
42
+ * Ruby version 2.4 is no longer officially supported (though it still should work) - this is also due to the fact that [v2.4 is abanoded by Ruby core team as well](https://www.ruby-lang.org/en/news/2020/04/05/support-of-ruby-2-4-has-ended/). Required Ruby version is now 2.5+ according to [version compatibility](https://github.com/jsanders/angular_rails_csrf/wiki/Version-Compatibility).
43
+ * Dropped backwards compatibility with older versions of Rails (v4 and below). [If you require Rails 4 support, use angular_rails_csrf v3]((https://github.com/jsanders/angular_rails_csrf/wiki/Version-Compatibility)).
44
+ * Increased test coverage up to 100%.
45
+
46
+ ## 4.2.0 (31-Mar-20)
47
+
48
+ * Added a new [`angular_rails_csrf_same_site` option](https://github.com/jsanders/angular_rails_csrf#samesite) which defaults to `:lax` (thanks, [@timobleeker](https://github.com/timobleeker))
49
+ + This option is introduced to comply with the latest changes: https://www.chromium.org/updates/same-site
50
+ * Update cops
51
+
52
+ ## 4.1.0 (03-Feb-20)
53
+
54
+ * Added a new [`angular_rails_csrf_secure` option](https://github.com/jsanders/angular_rails_csrf#secure-cookie) (thanks, [@DougKeller](https://github.com/DougKeller))
55
+ * Tested against Ruby 2.7
56
+
57
+ ## 4.0.1 (23-Dec-19)
58
+
59
+ * Updated dependencies, tested against more recent Rubies and Rails
60
+ * Updated Gemfile for Bundler 2
61
+ * Added Rubocop and SimpleCov
62
+
63
+ ## 4.0.0 (20-Aug-19)
64
+
65
+ Updated:
66
+ * Added support for Rails 6.0
67
+ * Drop support for Rails 4
68
+
69
+ ## 3.2.0
70
+
71
+ New feature:
72
+ * Allow cookie's name to be customized (thanks, [@timobleeker](https://github.com/timobleeker))
73
+
74
+ ## 3.1.0
75
+
76
+ Updated:
77
+ * Added support for Rails 5.2.0
78
+
79
+ Testing:
80
+ * Tested against more recent Ruby/Rails versions
81
+
82
+ ## 3.0.0
83
+
84
+ New feature:
85
+ * Allow cookie domain to be set via `Rails.application.config` (thanks, [@gingermusketeer](https://github.com/gingermusketeer))
86
+
87
+ Updated:
88
+ * Dropped support for Rails < 4
89
+ * Dropped official support for Ruby 2.2 though it should still work
90
+
91
+ Testing:
92
+ * Test against more recent versions of Ruby and Rails
93
+
94
+ ## 2.1.1
95
+
96
+ Updated:
97
+ * Added support for Rails 5.1.1
98
+
99
+ Testing:
100
+ * Test against more recent versions of Ruby
101
+ * Test against Rails 5.1.1
102
+
103
+ ## 2.1.0
104
+
105
+ Updated:
106
+ * Added support for Rails 5.1
107
+
108
+ Testing improvements:
109
+ * Tested against Rails 5.1
110
+ * Tested against Ruby 2.4.0
111
+ * We are no longer testing against Rails < 4.2
112
+
113
+ ## 2.0.0
114
+
115
+ **Breaking changes:**
116
+ * Revert to `after_action` again (fixes [issues with Devise](https://github.com/jsanders/angular_rails_csrf/issues/17) and similar solutions)
117
+ * Introduced a new `exclude_xsrf_token_cookie` class method to exclude setting CSRF token for certain controllers. This is done to take care of [problems with streaming](https://github.com/jsanders/angular_rails_csrf/issues/7).
118
+
119
+ Updated:
120
+ * Added support for Rails 5
121
+ * `rails` dependency changed to `railties`
122
+
123
+ Testing improvements:
124
+ * Tested against Rails 5
125
+ * Tested against Ruby 2.2.5 and 2.3.0
data/LICENSE.md ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2024 James Sanders, Ilya Krukowski
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,16 +1,32 @@
1
1
  ## AngularJS-style CSRF Protection for Rails
2
2
 
3
3
  ![Gem](https://img.shields.io/gem/v/angular_rails_csrf)
4
- ![CI](https://github.com/jsanders/angular_rails_csrf/actions/workflows/ci.yml/badge.svg)
4
+ ![CI](https://github.com/bodrovis/angular_rails_csrf/actions/workflows/ci.yml/badge.svg)
5
5
  ![Downloads total](https://img.shields.io/gem/dt/angular_rails_csrf)
6
6
 
7
+ **Deprecation notice (2025)**
8
+
9
+ James and then me (@bodrovis) have been supporting this gem since 2013. It has been downloaded more than 10 million times and we're glad you guys found it useful. However, after discussing privately we've decided to put angular_rails_csrf under passive maintenance starting from June 2025.
10
+
11
+ In modern frontend–backend architectures (e.g., Angular, React, Vue + Rails APIs), CSRF protection is typically handled via token-based authentication (JWT, OAuth) and not via CSRF cookies. This gem remains relevant only for Rails monoliths that:
12
+
13
+ - Use cookie-based session auth
14
+ - Serve frontend via Rails
15
+ - Expect `XSRF-TOKEN` / `X-XSRF-TOKEN` pattern
16
+
17
+ If you're actively using this gem and want to see it maintained or enhanced, please [open an issue](https://github.com/bodrovis/angular_rails_csrf/issues) describing your use case.
18
+
19
+ Otherwise, this project may be archived in late 2025 or 2026. Thank you!
20
+
21
+ ---
22
+
7
23
  The AngularJS [ng.$http](http://docs.angularjs.org/api/ng.$http) service has built-in CSRF protection. By default, it looks for a cookie named `XSRF-TOKEN` and, if found, writes its value into an `X-XSRF-TOKEN` header, which the server compares with the CSRF token saved in the user's session.
8
24
 
9
25
  This project adds direct support for this scheme to your Rails application without requiring any changes to your AngularJS application. It also doesn't require the use of `csrf_meta_tags` to write a CSRF token into your page markup, so it works for pure JSON API applications.
10
26
 
11
27
  Note that there is nothing AngularJS specific here, and this will work with any other front-end that implements the same scheme.
12
28
 
13
- Check [version compatibility](https://github.com/jsanders/angular_rails_csrf/wiki/Version-Compatibility) to learn which Rails/Rubies are currently supported.
29
+ Check [version compatibility](https://github.com/bodrovis/angular_rails_csrf/wiki/Version-Compatibility) to learn which Rails/Rubies are currently supported.
14
30
 
15
31
  ## Installation
16
32
 
@@ -102,7 +118,7 @@ end
102
118
 
103
119
  ### Exclusions
104
120
 
105
- Sometimes you will want to skip setting the XSRF token for certain controllers (for example, when using SSE or ActionCable, as discussed [here](https://github.com/jsanders/angular_rails_csrf/issues/7)):
121
+ Sometimes you will want to skip setting the XSRF token for certain controllers (for example, when using SSE or ActionCable, as discussed [here](https://github.com/bodrovis/angular_rails_csrf/issues/7)):
106
122
 
107
123
  ```ruby
108
124
  class ExclusionsController < ApplicationController
@@ -128,4 +144,4 @@ $ rake test
128
144
 
129
145
  ## License
130
146
 
131
- Licensed under the [MIT License](https://github.com/jsanders/angular_rails_csrf/blob/master/LICENSE).
147
+ Licensed under the [MIT License](https://github.com/bodrovis/angular_rails_csrf/blob/master/LICENSE.md).
@@ -42,6 +42,8 @@ module AngularRailsCsrf
42
42
  # Fetches the given option from config
43
43
  # If the option is not set, return a default value
44
44
  def option_from(config, option, default = nil)
45
+ return default if config.nil?
46
+
45
47
  config.respond_to?(option) ? config.send(option) : default
46
48
  end
47
49
 
@@ -9,5 +9,16 @@ module AngularRailsCsrf
9
9
  include AngularRailsCsrf::Concern
10
10
  end
11
11
  end
12
+
13
+ initializer 'angular-rails-csrf.deprecation_notice' do |_app|
14
+ unless Rails.env.test? || ENV['ANGULAR_RAILS_CSRF_SILENCE']
15
+ AngularRailsCsrf.deprecator.warn(
16
+ '[angular_rails_csrf] This gem is under passive maintenance and may be sunset in the future. ' \
17
+ 'Open an issue if you rely on it and want it to live on: ' \
18
+ 'https://github.com/bodrovis/angular_rails_csrf/issues. ' \
19
+ 'Set ANGULAR_RAILS_CSRF_SILENCE to silence this warning.'
20
+ )
21
+ end
22
+ end
12
23
  end
13
24
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AngularRailsCsrf
4
- VERSION = '6.0.0'
4
+ VERSION = '7.0.1'
5
5
  end
@@ -1,3 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'angular_rails_csrf/railtie'
4
+
5
+ module AngularRailsCsrf
6
+ def self.deprecator
7
+ @deprecator ||= ActiveSupport::Deprecation.new('7.0', 'angular_rails_csrf')
8
+ end
9
+ end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: angular_rails_csrf
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 7.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Sanders
8
8
  - Ilya Krukowski
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2023-11-14 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: railties
@@ -20,7 +19,7 @@ dependencies:
20
19
  version: '3'
21
20
  - - "<"
22
21
  - !ruby/object:Gem::Version
23
- version: '8'
22
+ version: '9'
24
23
  type: :runtime
25
24
  prerelease: false
26
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -30,7 +29,7 @@ dependencies:
30
29
  version: '3'
31
30
  - - "<"
32
31
  - !ruby/object:Gem::Version
33
- version: '8'
32
+ version: '9'
34
33
  description: AngularJS style CSRF protection for Rails
35
34
  email:
36
35
  - sanderjd@gmail.com
@@ -39,18 +38,20 @@ executables: []
39
38
  extensions: []
40
39
  extra_rdoc_files: []
41
40
  files:
41
+ - CHANGELOG.md
42
+ - LICENSE.md
42
43
  - README.md
43
44
  - Rakefile
44
45
  - lib/angular_rails_csrf.rb
45
46
  - lib/angular_rails_csrf/concern.rb
46
47
  - lib/angular_rails_csrf/railtie.rb
47
48
  - lib/angular_rails_csrf/version.rb
48
- homepage: https://github.com/jsanders/angular_rails_csrf
49
+ homepage: https://github.com/bodrovis/angular_rails_csrf
49
50
  licenses:
50
51
  - MIT
51
52
  metadata:
52
53
  rubygems_mfa_required: 'true'
53
- post_install_message:
54
+ deprecation_warning: Passive maintenance; may be sunset in 2025-2026. See README.
54
55
  rdoc_options: []
55
56
  require_paths:
56
57
  - lib
@@ -58,15 +59,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
58
59
  requirements:
59
60
  - - ">="
60
61
  - !ruby/object:Gem::Version
61
- version: '3.0'
62
+ version: '3.2'
62
63
  required_rubygems_version: !ruby/object:Gem::Requirement
63
64
  requirements:
64
65
  - - ">="
65
66
  - !ruby/object:Gem::Version
66
67
  version: '0'
67
68
  requirements: []
68
- rubygems_version: 3.4.21
69
- signing_key:
69
+ rubygems_version: 3.6.8
70
70
  specification_version: 4
71
71
  summary: Support for AngularJS $http service style CSRF protection in Rails
72
72
  test_files: []