Skip to content

Releases

v2.4.2

Choose a tag to compare

@sferik sferik released this 18 Nov 16:43
2045f32

Added

  • OmniAuth.config.max_remembered_sign_ins and OmniAuth.config.max_remembered_params_bytesize set how many sign-ins session['omniauth.sign_ins'] keeps and how many bytes of params each one remembers. They default to 3 and 512, as before. (#1184)

Full Changelog: v2.4.1...v2.4.2

v2.4.1

Choose a tag to compare

@github-actions github-actions released this 14 Nov 17:25
29b3f8e

Fixed

  • A sign-in with no origin param or referer of its own no longer gets the origin of an earlier sign-in that was abandoned, for a strategy that remembers sign-ins, such as omniauth-oauth2's. remember_sign_in now moves the origin from session['omniauth.origin'] into the sign-in instead of copying it, which also stops the cookie session from storing it twice. An origin the app stores in session['omniauth.origin'] before the request phase still goes to that sign-in. A callback whose key isn't remembered now gets no origin, instead of the latest sign-in's. Strategies that don't remember sign-ins keep a single omniauth.origin, as before.

Full Changelog: v2.4.0...v2.4.1

v2.4.0

Choose a tag to compare

@github-actions github-actions released this 14 Nov 15:25
a2e6377

Added

  • A strategy can store its own values for the callback in the sign-in it remembers, such as an OAuth 2.0 PKCE verifier, by passing them to remember_sign_in(key, data), and read them back in the callback from remembered_sign_in, which is nil when no sign-in is remembered for the callback's key. This lets omniauth-oauth2 keep one entry per sign-in instead of a second map that stores each state again. See the README. (omniauth-oauth2#195)

Changed

  • session['omniauth.sign_ins'] keeps the latest 3 sign-ins instead of 5, and each one stores less: no origin when there isn't one, and no params when they're empty or with more than 512 bytes in their keys and values, in which case OmniAuth logs a warning and the callback gets empty omniauth.params. With 5 sign-ins, each with a referer and params, a few abandoned sign-ins could overflow Rails' 4 KB cookie session and make the next one fail with ActionDispatch::Cookies::CookieOverflow. (omniauth-oauth2#195)

Fixed

  • Strategy#redirect no longer raises Encoding::CompatibilityError for a URI in an encoding that isn't ASCII-compatible, such as UTF-16 or UTF-32. The URI is transcoded to UTF-8 first, with invalid or unmappable characters replaced, so both the :iframe script and the 302 work.

Security

  • Strategy#redirect now escapes the target URI before interpolating it into the inline <script> emitted when the :iframe option is enabled. Previously the URI was written verbatim, so a value containing a quote, </script>, or a line terminator could break out of the JavaScript string literal and execute in the application's origin (CWE-116/79). The :iframe branch also only emits the script for an http(s) or relative/protocol-relative target; a javascript:, data:, or vbscript: URI (which escaping cannot neutralize) falls through to the ordinary 302, whose Location header is inert. The non-iframe branch now HTML-escapes the URI it writes into the 302 body, and both branches send a text/html Content-Type.
  • Strategy#store_origin now refuses to persist an omniauth.origin (from the origin param or the referer) whose scheme can run as script (javascript:, data:, vbscript:), so any code that later redirects to the stored origin can't execute it. Behavior change: an origin param with one of those schemes, or one that isn't a String (such as origin[]=...), is dropped and no longer falls back to the referer. Other schemes, including non-web deep links such as myapp:// used by mobile sign-in, are still stored.

Full Changelog: v2.3.1...v2.4.0

v2.3.1

Choose a tag to compare

@sferik sferik released this 10 Nov 13:08
5813803

Fixed

  • remember_sign_in no longer raises KeyError when called outside the request phase, before omniauth.params is stored, as when a provider gem's specs call authorize_params directly.

Full Changelog: v2.3.0...v2.3.1

v2.3.0

Choose a tag to compare

@sferik sferik released this 10 Nov 13:08
9db25e1

Added

  • Let strategies keep the origin and params of several sign-ins in progress at once, for example in several tabs, so each callback gets its own instead of the latest sign-in's. A strategy opts in by calling remember_sign_in in its request phase with a value the provider sends back, such as OAuth 2.0's state, and overriding callback_sign_in_key. The latest 5 are stored in session['omniauth.sign_ins'], and omniauth.origin and omniauth.params still hold the latest one. See the README. (omniauth-oauth2#195)

Changed

  • The gem no longer includes CHANGELOG.md, which was about half its size. Its changelog_uri links to the changelog on GitHub.

Full Changelog: v2.2.0...v2.3.0

v2.2.0

Choose a tag to compare

@sferik sferik released this 10 Nov 13:08
0d38078

Added

  • Add a full_host option for each strategy, as a string or a proc that takes the Rack env. It takes precedence over OmniAuth.config.full_host. (#835)
  • Ship RBS type signatures for OmniAuth in sig/.
  • Document the Rack env keys OmniAuth sets, CSRF protection, sending origin as a form field, and how SameSite session cookies affect the callback in the README. (#909, #1075, #1048, #1149)
  • Add this changelog.

Changed

  • omniauth.params now includes params posted to the request phase's form, not just its query string, so they survive the POST-only request phase introduced in 2.0. The authenticity_token param is never included (see CVE-2017-18076 under 1.3.2). If your request form posts other fields, they now appear in omniauth.params and are stored in the session until the callback. (#975)
  • OmniAuth::Builder builds its middleware stack on the first request and reuses it, instead of rebuilding every strategy on every request. Providers added after the first request are ignored. (#1083, #970)
  • Strategy#call sends a request that isn't on the strategy's request or callback path straight to the app, instead of duplicating the strategy for it. It still duplicates it in test mode, with an other_phase, with path lambdas, or when the strategy overrides how #call! dispatches. Methods patched directly onto OmniAuth::Strategy, rather than overridden in a subclass, aren't detected, so a patched #call! no longer runs for requests outside the strategy's paths. (#1172)
  • Require Ruby 2.5 or later (was 2.2). (#1167)
  • Require Rack 2.2.8 or later (was 2.2.3), rack-protection 2.2.0 or later, and hashie 3.5.2 or later (was 3.4.6).
  • The gem now contains only lib, sig, the license, the README, the changelog, and the security policy.

Fixed

  • Run the before_callback_phase hook for mocked failures in test mode, as for real callbacks. (#1043, #1171)
  • Recognize callback paths with a format suffix, such as /auth/:provider/callback.json. (#618, #1170)
  • Don't fail callbacks when the app defines a method named uid, info, credentials, or extra on Object. (#898, #1169)
  • Don't add a calculated name to the info hash subsets returned by slice, except, select, and reject. (#892, #1168)
  • Collapse repeated slashes in the request path, as Rails routing does, so //auth/:provider from a misconfigured proxy reaches the strategy. (#1079)
  • Avoid "instance variable not initialized" warnings on Ruby before 3.0.

Security

  • Guard against forged hosts in callback URLs. Unless a full_host is set, OmniAuth builds the callback URL it sends to the provider from the request's Host, X-Forwarded-Host, or Forwarded header, which a client can forge. The new OmniAuth.config.allowed_hosts, a list of strings and regexps, makes the request and callback phases fail with invalid_host unless the request's host matches one of them. Until full_host or allowed_hosts is set, the request phase logs a warning. The README's full_host example, which copied the Host header, is fixed. (GHSA-m27g-v28p-f9fx, CVE-2026-63183)
  • Run request_validation_phase before writing omniauth.params to the session, so a cross-site POST rejected by the authenticity check can no longer store attacker-controlled params. (#1162)

Full Changelog: v2.1.4...v2.2.0

v2.1.4

Choose a tag to compare

@BobbyMcWho BobbyMcWho released this 01 Oct 17:14

What's Changed

Full Changelog: v2.1.3...v2.1.4

You may now configure an after_request_phase callback on your omniauth builder instance. This callback will be run after the request phase before returning the request result.

v2.1.3

Choose a tag to compare

@BobbyMcWho BobbyMcWho released this 27 Feb 18:50

What's Changed

New Contributors

Full Changelog: v2.1.2...v2.1.3

v2.1.2

Choose a tag to compare

@BobbyMcWho BobbyMcWho released this 27 Feb 18:44

What's Changed

New Contributors

Full Changelog: v2.1.1...v2.1.2

v2.1.1

Choose a tag to compare

@BobbyMcWho BobbyMcWho released this 27 Feb 18:43
d2fd0fc

What's Changed

New Contributors

Full Changelog: v2.1.0...v2.1.1