Repository navigation
fix: locale switch crash without Referer (Sentry ADMIN-6H) + Sentry investigation doc - #299
Merged
Merged
Conversation
Browsers that omit the Referer header crashed POST /locale with redirect(external: nil) (Sentry ADMIN-6H). Keep only the referer's path and query, falling back to /, which also closes the open redirect.
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.
Fix: ADMIN-6H
POST /localeredirected withredirect(external: referrer). When the browser sends noRefererheader (privacy extensions or settings, strict referrer policy),referrerisniland Phoenix raisesArgumentError: expected :to or :external option in redirect/2. The visitor gets a 500 and the language change is lost. Sentry has 32 events since 2026-07-09, all in production.change_localenow redirects to the referer's path and query, and falls back to/when the header is missing or the path starts with//. This also removes the open redirect to any URL inReferer.Tests in
locales_test.exs:Referer→ redirects to/(reproduced the Sentry stack trace before the fix)Referer→ keeps only the path and queryDoc: investigating Sentry issues
docs/agents/sentry.md, linked fromAGENTS.md:sentry-clicommands, pluscurlagainst the REST API for event stack traces, whichsentry-clican't showevent:read,project:read)Our events mark every frame
inApp: false, so the doc identifies our code by thelib/adminpath instead.