mastodon icon indicating copy to clipboard operation
mastodon copied to clipboard

Update omniauth packages (major)

Open renovate[bot] opened this issue 2 years ago • 1 comments

Mend Renovate

This PR contains the following updates:

Package Update Change
omniauth major '~> 1.9' -> '~> 2.0'
omniauth-rails_csrf_protection major '~> 0.1' -> '~> 1.0'
omniauth-saml major '~> 1.10' -> '~> 2.0'

Release Notes

omniauth/omniauth (omniauth)

v2.1.1

Compare Source

v2.1.0

Compare Source

This release adds Ruby 3.0+ support.

Due to kwarg changes in ruby 3, we have bumped the minimum required version of Rack to 2.2.3, which is where ruby3 support was added.

Releasing as a minor as dependency resolution should fail at install if an application is locked to a rack below new minimum.

Full Changelog: https://github.com/omniauth/omniauth/compare/v2.0.4...v2.1.0

v2.0.4

Compare Source

This release removes unnecessary warning logging when accessing GET routes that are not related to the OmniAuth request path.

Thanks to @​charlie-wasp and @​sponomarev at Evil Martians for the bug find and subsequent PR.

v2.0.3: Fix rescuing of application errors when call_app! is used.

Compare Source

As a consequence of the changes that were merged in #​689, errors thrown by strategies that utilize other_phase (or more specifically call_app!), would be caught by omniauth, causing headaches for folks looking to have those errors handled by their application. This should allow for errors that come from the app to pass through, while passing errors that come from the authentication phases to the fail! handler.

Resolves #​1030

v2.0.2: Fix for incorrect order of request_validation_phase in test_mode.

Compare Source

@​jsdalton gave an awesome report of the issue present in test_mode in #​1033

The current implementation of mock_call was verifying the token for all requests, regardless of whether the current path is on the omniauth request path. The change was introduced recently in 1b784ff. See #​1032 for details.

This creates two problems:

  1. When test mode is on, the authenticity verification logic is run inappropriately against requests where this may not even be wanted.
  2. The behavior varies from actual production behavior, potentially allowing bugs to be introduced by unwary developers.

Note that this bug was only present when OmniAuth was configured for test_mode and using the mock_call phases.

v2.0.1: Allow passing rack-protection configuration to default request_validation_phase

Compare Source

This release now properly allows an instance of OmniAuth::AuthenticityTokenProtection (with passed in rack-protection configuration) to be used as the request_validation_phase.

Thanks @​jkowens #​1027

If you haven't already read the release notes for v2.0.0, you should do so.

v2.0.0

Compare Source

Version 2.0 of OmniAuth includes some changes that may be breaking depending on how you use OmniAuth in your app.

Many thanks to the folks who contributed in code and discussion for these changes.

OmniAuth now defaults to only POST as the allowed request_phase method.

Hopefully, you were already doing this as a result of the warnings due to CVE-2015-9284.
For detailed context, see:
#​960
#​809
Resolving CVE-2015-9284

This change also includes an additional configurable phase: request_validation_phase.

Rack/Sinatra

By default, this uses rack-protection's AuthenticityToken class to validate authenticity tokens. If you are using a rack based framework like sinatra, you can find an example of how to add authenticity tokens to your view here.

Rails

Because Rails handles its CSRF protection in its RequestForgeryProtection class, and stores tokens in a non-vanilla-rack friendly way, you must pass a rails-friendly validator in instead, similar to what omniauth-rails_csrf_protection does.

Update: omniauth-rails_csrf_protection has released v1.0.0, which means if you're using this library already, you should be able to upgrade omniauth to the 2.0 series as long as omniauth-rails_csrf_protection is also upgraded '~> 1.0'

An example of creating your own non-dependency implementation is below, though I would recommend using the gem.


### Derived from https://github.com/cookpad/omniauth-rails_csrf_protection/blob/master/lib/omniauth/rails_csrf_protection/token_verifier.rb
### This specific implementation has been pared down and should not be taken as the most correct way to do this.
class TokenVerifier
  include ActiveSupport::Configurable
  include ActionController::RequestForgeryProtection

  def call(env)
    @​request = ActionDispatch::Request.new(env.dup)
    raise OmniAuth::AuthenticityError unless verified_request?
  end

  private
  attr_reader :request
  delegate :params, :session, to: :request
end

### in an initializer
OmniAuth.config.request_validation_phase = TokenVerifier.new

Example Rails App

If you're using Rails' form helpers, they automatically include an authenticity token.

If you are using hyperlinks or buttons styled to redirect to your login route, you should update these to be a submit input or a submit type button wrapped in a form.

- <a href='/auth/developer'>Login with Developer</a>
+ <%= form_tag('/auth/developer', method: 'post') do %>
+  <button type='submit'>Login with Developer</button>
+ <% end %>
GET

Because using GET for login poses concerns (see OWASP Cheatsheet), after upgrading OmniAuth will log a :warn level log with every GET request to a login path when your OmniAuth.config.allowed_request_methods include :get.

If you have a workflow that absolutely requires you to use GET for the request_phase, you can disable this warning using

OmniAuth.config.silence_get_warning = true

It is very important that you do not do this just to circumvent having to change your inputs or login flow, as using GET for most auth workflows is not what you want.

Unhandled Exceptions

OmniAuth now catches exceptions raised during the options_call, request_call, callback_call, and other_phase, and passes them to the OmniAuth.config.on_failure handler. For most apps, this means they are passed to the default FailureEndpoint class that OmniAuth provides, and redirected to /auth/failure. If your app is wrapping OmniAuth in another middleware such as this example in Discourse, then you may need to instead write your own failure handler.

Provider Namespacing

OmniAuth will no longer find constants from an ancestor class when looking for the strategy class. What this means is that

OmniAuth.builder.new(@&#8203;app) do
  provider :my_provider
end

Will no longer find ::MyProvider as a strategy, and instead will only look under the OmniAuth::Strategies namespace for the MyProvider class.

Failure Route

The failure route will now respect a strategy's path_prefix option, meaning if your strategy uses /external instead of /auth as its path prefix, the failure route for that strategy will be /external/failure.

Thread Safety

The OmniAuth middleware should now be thread-safe, as we run tests with rack-freeze to check for middleware mutability. This does not guarantee that the downstream strategy is thread-safe however. If you have concerns, ask your strategy maintainers.

Frozen Strings

OmniAuth will no longer throw errors if trying to run it in an app with RUBYOPT="--enable-frozen-string-literal".

Relative Root Apps

OmniAuth now respects the 'SCRIPT_NAME' env value, so if your app lives at myapp.com/super, your request path will be /super/auth/provider, your callback path /super/auth/provider/callback and your failure path /super/auth/failure.

cookpad/omniauth-rails_csrf_protection (omniauth-rails_csrf_protection)

v1.0.1: Version 1.0.1

Compare Source

  • Fix an issue when Omniauth gem is not explicitly specified and required in the Gemfile.

v1.0.0: Version 1.0.0

Compare Source

  • Drop support for omniauth <= 2.0.0 (#​9)
  • Utilize OmniAuth's 2.0.0 new request_validation_phase= configuration instead of before_request_phase=. (#​9)

Please See OmniAuth 2.0.0 Release Note for more details.

omniauth/omniauth-saml (omniauth-saml)

v2.1.0

Compare Source

Refactor
  • Rename usage of deprecated SAML options (74ed8df)
Chores
  • bump ruby-saml to 1.12 (15c156a)

v2.0.0

Compare Source

Chores
  • Allow OmniAuth 2.0.0 (f7ec7ee)

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.


  • [ ] If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

renovate[bot] avatar Jul 08 '23 09:07 renovate[bot]

⚠ Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

♻ Renovate will retry this branch, including artifacts, only when one of the following happens:

  • any of the package files in this branch needs updating, or
  • the branch becomes conflicted, or
  • you click the rebase/retry checkbox if found above, or
  • you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

File name: Gemfile.lock
[10:58:30.333] INFO (10): Installing tool ruby v3.2.2...
[10:58:30.337] INFO (10): Preparing legacy tool ruby ...
installing v2 tool ruby v3.2.2
linking tool ruby v3.2.2
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
gem 3.4.10
RubyGems Environment:
  - RUBYGEMS VERSION: 3.4.10
  - RUBY VERSION: 3.2.2 (2023-03-30 patchlevel 53) [x86_64-linux]
  - INSTALLATION DIRECTORY: /tmp/worker/e562dd/98638d/cache/others/bundler
  - USER INSTALLATION DIRECTORY: /home/ubuntu/.local/share/gem/ruby/3.2.0
  - RUBY EXECUTABLE: /opt/containerbase/tools/ruby/3.2.2/bin/ruby
  - GIT EXECUTABLE: /usr/bin/git
  - EXECUTABLE DIRECTORY: /tmp/worker/e562dd/98638d/cache/others/bundler/bin
  - SPEC CACHE DIRECTORY: /home/ubuntu/.local/share/gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /usr/local/ruby/3.2.2/etc
  - RUBYGEMS PLATFORMS:
     - ruby
     - x86_64-linux
  - GEM PATHS:
     - /tmp/worker/e562dd/98638d/cache/others/bundler
     - /home/ubuntu/.local/share/gem/ruby/3.2.0
     - /opt/containerbase/tools/ruby/3.2.2/lib/ruby/gems/3.2.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--bindir /home/ubuntu/bin --no-document"
     - :benchmark => false
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /home/ubuntu/.cargo/bin
     - /home/ubuntu/.local/bin
     - /go/bin
     - /home/ubuntu/bin
     - /home/ubuntu/.cargo/bin
     - /home/ubuntu/.local/bin
     - /go/bin
     - /home/ubuntu/bin
     - /home/ubuntu/.cargo/bin
     - /home/ubuntu/.local/bin
     - /go/bin
     - /home/ubuntu/bin
     - /home/ubuntu/bin
     - /home/ubuntu/.cargo/bin
     - /home/ubuntu/.local/bin
     - /go/bin
     - /home/ubuntu/bin
     - /home/ubuntu/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
[10:58:32.238] INFO (10): Installed tool ruby in 1.9s.
[10:58:32.350] INFO (94): Installing tool bundler v2.4.13...
[10:58:32.353] INFO (94): Preparing legacy tool bundler ...
installing v2 tool bundler v2.4.13
Successfully installed bundler-2.4.13
1 gem installed
linking tool bundler v2.4.13
Bundler version 2.4.13
[10:58:32.928] INFO (94): Installed tool bundler in 578ms.
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...

/usr/local/bin/docker: line 4: .: filename argument required
.: usage: . filename [arguments]
Could not find compatible versions

Because omniauth-cas >= 1.1.1 depends on omniauth ~> 1.2
  and Gemfile depends on omniauth-cas ~> 2.0,
  omniauth ~> 1.2 is required.
So, because Gemfile depends on omniauth ~> 2.0,
  version solving has failed.

renovate[bot] avatar Jul 09 '23 10:07 renovate[bot]

Will be done in #24209

renchap avatar Jul 13 '23 09:07 renchap