Skip to content

Match Devise mappings by path segment - #5860

Open
OskarEichler wants to merge 1 commit into
heartcombo:mainfrom
OskarEichler:codex/match-mapping-path-segments-upstream
Open

Match Devise mappings by path segment#5860
OskarEichler wants to merge 1 commit into
heartcombo:mainfrom
OskarEichler:codex/match-mapping-path-segments-upstream

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

  • match mappings on complete URL path segments instead of arbitrary substrings
  • prevent an earlier users mapping from capturing an OmniAuth failure under /superusers/auth/...
  • preserve nested prefixes, multi-segment full paths, and the existing empty-path behavior

Devise::Mapping.find_by_path! is used by the default OmniAuth failure handler. With users registered before superusers, the current substring lookup resolves /superusers/auth/github/callback to users and can dispatch failure handling through the wrong mapping/controller.

Verification

  • baseline reproduction resolves /superusers/auth/github/callback to user
  • fixed main and release-based models resolve it to superuser
  • prefixed /localized/users/... still resolves to user
  • /superusers_extra/... no longer partially matches
  • full Active Record suite: 878 runs, 2,470 assertions, 0 failures
  • release-based suite: 878 runs, 2,469 assertions, 0 failures
  • Ruby syntax check passes

No public API or route format changes are intended; only partial-segment matches are rejected. No test files were changed. Prepared with Codex assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant