Repository navigation
Releases
Releases · omniauth/omniauth
v2.4.2
Added
OmniAuth.config.max_remembered_sign_insandOmniAuth.config.max_remembered_params_bytesizeset how many sign-inssession['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
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_innow moves the origin fromsession['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 insession['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 singleomniauth.origin, as before.
Full Changelog: v2.4.0...v2.4.1
v2.4.0
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 fromremembered_sign_in, which isnilwhen 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 emptyomniauth.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 withActionDispatch::Cookies::CookieOverflow. (omniauth-oauth2#195)
Fixed
Strategy#redirectno longer raisesEncoding::CompatibilityErrorfor 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:iframescript and the 302 work.
Security
Strategy#redirectnow escapes the target URI before interpolating it into the inline<script>emitted when the:iframeoption 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:iframebranch also only emits the script for anhttp(s)or relative/protocol-relative target; ajavascript:,data:, orvbscript:URI (which escaping cannot neutralize) falls through to the ordinary 302, whoseLocationheader is inert. The non-iframe branch now HTML-escapes the URI it writes into the 302 body, and both branches send atext/htmlContent-Type.Strategy#store_originnow refuses to persist anomniauth.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 asorigin[]=...), is dropped and no longer falls back to the referer. Other schemes, including non-web deep links such asmyapp://used by mobile sign-in, are still stored.
Full Changelog: v2.3.1...v2.4.0
v2.3.1
Fixed
remember_sign_inno longer raisesKeyErrorwhen called outside the request phase, beforeomniauth.paramsis stored, as when a provider gem's specs callauthorize_paramsdirectly.
Full Changelog: v2.3.0...v2.3.1
v2.3.0
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_inin its request phase with a value the provider sends back, such as OAuth 2.0's state, and overridingcallback_sign_in_key. The latest 5 are stored insession['omniauth.sign_ins'], andomniauth.originandomniauth.paramsstill hold the latest one. See the README. (omniauth-oauth2#195)
Changed
- The gem no longer includes
CHANGELOG.md, which was about half its size. Itschangelog_urilinks to the changelog on GitHub.
Full Changelog: v2.2.0...v2.3.0
v2.2.0
Added
- Add a
full_hostoption for each strategy, as a string or a proc that takes the Rack env. It takes precedence overOmniAuth.config.full_host. (#835) - Ship RBS type signatures for OmniAuth in
sig/. - Document the Rack env keys OmniAuth sets, CSRF protection, sending
originas a form field, and howSameSitesession cookies affect the callback in the README. (#909, #1075, #1048, #1149) - Add this changelog.
Changed
omniauth.paramsnow 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. Theauthenticity_tokenparam is never included (see CVE-2017-18076 under 1.3.2). If your request form posts other fields, they now appear inomniauth.paramsand are stored in the session until the callback. (#975)OmniAuth::Builderbuilds 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#callsends 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 another_phase, with path lambdas, or when the strategy overrides how#call!dispatches. Methods patched directly ontoOmniAuth::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_phasehook 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, orextraonObject. (#898, #1169) - Don't add a calculated
nameto the info hash subsets returned byslice,except,select, andreject. (#892, #1168) - Collapse repeated slashes in the request path, as Rails routing does, so
//auth/:providerfrom 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_hostis set, OmniAuth builds the callback URL it sends to the provider from the request'sHost,X-Forwarded-Host, orForwardedheader, which a client can forge. The newOmniAuth.config.allowed_hosts, a list of strings and regexps, makes the request and callback phases fail withinvalid_hostunless the request's host matches one of them. Untilfull_hostorallowed_hostsis set, the request phase logs a warning. The README'sfull_hostexample, which copied theHostheader, is fixed. (GHSA-m27g-v28p-f9fx, CVE-2026-63183) - Run
request_validation_phasebefore writingomniauth.paramsto 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
What's Changed
- Add Ruby 3.4 to CI by @tejasbubane in #1142
- Add after_request_phase callback hook by @gerardo-navarro in #1147
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
What's Changed
- Test against Ruby 3.3 by @enomotodev in #1128
- Exclude (macos, 2.5) from test matrix by @TastyPi in #1137
- Avoid using
URI::ABS_URIby @mame in #1136 - Do not override
omniauth.originin environment in test mode by @TastyPi in #1134
New Contributors
Full Changelog: v2.1.2...v2.1.3
v2.1.2
What's Changed
- Fix
bundle installstep on CI for TruffleRuby by @andrykonchin in #1104 - Use GET with :developer strategy. by @cycomachead in #1106
- Test against Ruby 3.2 by @enomotodev in #1113
- ci: use ubuntu-latest runner by @nschonni in #1109
- chore: add Dependabot for version updates by @nschonni in #1110
- Added Ruby 3.2 to workflow. by @madogiwa0124 in #1102
- chore: Remove conditions for old (J)Ruby by @nschonni in #1118
- fix: conditional delegate require Rack/JRuby by @nschonni in #1122
New Contributors
- @andrykonchin made their first contribution in #1104
- @cycomachead made their first contribution in #1106
- @nschonni made their first contribution in #1109
- @madogiwa0124 made their first contribution in #1102
Full Changelog: v2.1.1...v2.1.2
v2.1.1
What's Changed
- Separate jruby and truffle ruby workflows by @BobbyMcWho in #1065
- Added docs showing how to integrate omniauth with rack_csrf by @HoneyryderChuck in #1070
- Fixed nil error in callback_path by @shreyakurian02 in #1092
New Contributors
- @HoneyryderChuck made their first contribution in #1070
- @shreyakurian02 made their first contribution in #1092
Full Changelog: v2.1.0...v2.1.1