Conversation
Fivell
force-pushed
the
fix/sso-redirect-respects-default-namespace
branch
from
September 30, 2026 10:07
a179648 to
cf05737
Compare
Every dummy app in the suite mounts ActiveAdmin at /admin, so nothing
covers hosts that set `config.default_namespace = false` and mount it
at /. On those hosts the post-SSO redirect lands on /admin, which does
not exist.
spec/dummy_root/ is spec/dummy/ with that one config line flipped.
spec/root/ drives a full OmniAuth handshake against it and asserts the
landing page. CI runs each dummy app as its own step so the failing
host shape is named rather than buried in a combined run.
Red on purpose: `rake spec:root` fails with
expected: "/"
got: "/admin"
ActionController::RoutingError: No route matches [GET] "/admin"
The two specs that do pass pin the harness down — the dummy really has
no /admin, and the stored-location path (the reason the bug looks
intermittent in production) already works.
json 3.0.2 removed the `quirks_mode` keyword that ActiveSupport::JSON.decode/encode still passes to JSON.parse and JSON.generate. CI resolves without a lockfile, so it picked up json 3.x as soon as it was released and every request spec now fails with `ArgumentError: unknown keyword: quirks_mode` — unrelated to anything in this branch, and it masks the suite it is supposed to run.
Fivell
force-pushed
the
fix/sso-redirect-respects-default-namespace
branch
from
September 30, 2026 10:12
43a4a38 to
301a913
Compare
`after_sign_in_path_for` fell back to a hardcoded '/admin' whenever Devise had no stored location. Resolve the landing page through ActiveAdmin::Devise::Controller#root_path instead, which reads `ActiveAdmin.application.default_namespace` — the same helper ActiveAdmin uses for its own logout redirect. `/admin` stays the answer for default hosts; hosts mounted at / now get /. Turns spec/root/ green.
Member
Author
|
close if favour of #17 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
OmniauthCallbacksController#after_sign_in_path_forfell back to a hardcoded'/admin':ActiveAdmin does not always mount at
/admin. A host that setsconfig.default_namespace = falsemounts it at/. On those hosts the post-SSO redirect landed on a path that does not exist.It presented as intermittent, which is what made it hard to place: the redirect is correct whenever
stored_location_foris set — i.e. when the user hit a protected page while logged out and Devise's failure app storedadmin_user_return_toin the session cookie. It 404s when the sign-in started at the login page itself, or when that cookie was rotated or expired during the IdP round-trip.Observed in production on a host with ActiveAdmin at
/and Zitadel as the IdP:Why nothing caught it
All three existing dummy apps (
spec/dummy,spec/dummy_engine,spec/dummy_isolated) mount ActiveAdmin at/admin, so the hardcoded fallback happened to be right in every one of them.Commits
Written red-first, so the reproduction is reviewable on its own.
1.
4c09f08— reproduce (CI red)spec/dummy_root/—spec/dummy/with one config line flipped:config.default_namespace = false. No hostrootroute, so anything the gem redirects to outside the ActiveAdmin route table 404s.spec/root/— drives the full OmniAuth handshake against it.rake spec:root, added tospec:all.spec:all, so a failure names the host shape that broke.CI on this commit:
The two examples that pass pin the harness down: the dummy really has no
/admin, and the stored-location path (the reason this looks intermittent in production) already worked.2.
301a913— pinjson < 3Unrelated to this branch, but it masked the suite. json 3.0.2 removed the
quirks_modekeyword thatActiveSupport::JSON.decode/encodestill passes toJSON.parse/JSON.generate(activesupport 7.2 and 8.0,lib/active_support/json/{decoding,encoding}.rb). CI resolves without a lockfile, so it picked json 3.x up as soon as it was released and every request spec died withArgumentError: unknown keyword: quirks_mode.mainlast went green on 2026-09-03, before that release.3.
216d5fb— fix (CI green)root_pathcomes fromActiveAdmin::Devise::Controllerand resolves the namespace root fromActiveAdmin.application.default_namespace— the same helper ActiveAdmin uses for its own logout redirect./adminremains the answer for default hosts; hosts mounted at/now get/.All four suites green across the full matrix (Ruby 3.2/3.3/3.4 × ActiveAdmin 3.5/4.0).