Skip to content

fix(app-root): prevent double-prefixed logout link under SUPERSET_APP_ROOT - #42848

Closed
TamayiM-WHO wants to merge 1 commit into
apache:6.2from
TamayiM-WHO:fix/logout-single-prefix-6.2
Closed

fix(app-root): prevent double-prefixed logout link under SUPERSET_APP_ROOT#42848
TamayiM-WHO wants to merge 1 commit into
apache:6.2from
TamayiM-WHO:fix/logout-single-prefix-6.2

Conversation

@TamayiM-WHO

Copy link
Copy Markdown

SUMMARY

Backport of the RightMenu.tsx hunk of #38033 to the 6.2 release branch, plus the regression test added in #39925.

navbarRight.user_logout_url comes from Flask-AppBuilder's get_url_for_logout, which resolves through Flask's url_for and is therefore already SCRIPT_NAME-aware. On 6.2 it is still wrapped in ensureAppRoot(), which prefixes the application root a second time, so the Logout menu item points outside the mount point and 404s under a sub-path deployment.

This is the asymmetry that makes the bug easy to miss: menu_data emits user_info_url as the relative literal /user_info/ (so it does need prefixing), while user_logout_url arrives already rooted. Both were being wrapped identically, so exactly one of them doubled.

# superset/views/base.py
"user_info_url": (None if is_feature_enabled("MENU_HIDE_USER_INFO") else "/user_info/"),
"user_logout_url": appbuilder.get_url_for_logout,   # already SCRIPT_NAME-prefixed

This was reported as #40576 and closed as fixed on master, but the fix never reached a release branch. Evaluating the shipped ensureAppRoot body on each ref against the value the backend actually emits (APPLICATION_ROOT=/app-superset):

origin/6.1     Logout href -> /app-superset/app-superset/logout/   (broken)
origin/6.2     Logout href -> /app-superset/app-superset/logout/   (broken)
origin/master  Logout href -> /app-superset/logout/                (ok)

6.1.0 already shipped this, and 6.2 would ship it again without this backport.

master additionally carries an idempotence guard inside ensureAppRoot() itself. That is deliberately not backported here — the one-line RightMenu.tsx change is sufficient and is the smaller risk on a release branch.

Happy to open the equivalent PR against 6.1 if maintainers want it there too.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before (APPLICATION_ROOT=/app-superset), Settings → Logout:

href="/app-superset/app-superset/logout/"   -> 404

After:

href="/app-superset/logout/"                -> logs out

TESTING INSTRUCTIONS

Automated — this PR ports the regression test #39925 added on master, where it passes. It asserts the Logout href stays single-prefixed when the backend supplies an already-rooted URL, so it fails against 6.2's current ensureAppRoot() wrapping:

cd superset-frontend
npm run test -- src/features/home/RightMenu.test.tsx -t "single-prefixed"

Manual:

  1. Run Superset with SUPERSET_APP_ROOT=/app-superset (or APPLICATION_ROOT) behind a proxy that routes only /app-superset/*.
  2. Log in, open the Settings menu, and inspect the Logout item's href.
  3. It should be /app-superset/logout/, not /app-superset/app-superset/logout/, and clicking it should log you out rather than 404.

ADDITIONAL INFORMATION

…_ROOT

`navbarRight.user_logout_url` is produced by Flask-AppBuilder's
`get_url_for_logout`, which resolves through Flask's `url_for` and is
therefore already SCRIPT_NAME-aware. Wrapping it in `ensureAppRoot()`
prefixed the application root a second time, so under a sub-path
deployment the Logout menu item pointed at `/app-root/app-root/logout/`
and returned 404.

Unlike `user_info_url`, which `menu_data` emits as the relative literal
`/user_info/` and therefore does need prefixing, the logout URL arrives
already rooted. Dropping the wrapper leaves it single-prefixed.

This cherry-picks the `RightMenu.tsx` hunk of apache#38033 onto the 6.2 release
branch, together with the regression test added in apache#39925. `master` also
carries an idempotence guard inside `ensureAppRoot()`; that is
deliberately not backported here to keep the release-branch change
minimal.

Refs apache#40576

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dosubot dosubot Bot added the change:frontend Requires changing the frontend label Aug 6, 2026
@bito-code-review

Copy link
Copy Markdown
Contributor

Bito Automatic Review Skipped - Branch Excluded

Bito didn't auto-review because the source or target branch is excluded from automatic reviews.
No action is needed if you didn't intend for the agent to review it. Otherwise, to manually trigger a review, type /review in a comment and save.
You can change the branch exclusion settings here, or contact your Bito workspace admin at evan@preset.io.

@netlify

netlify Bot commented Aug 6, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 4fcb3c0
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a749f2e5ebb1100087bb39f
😎 Deploy Preview https://deploy-preview-42848--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@sadpandajoe

Copy link
Copy Markdown
Member

Closing this as this isn't how we would introduce changes into official release branches.

@sadpandajoe sadpandajoe closed this Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:frontend Requires changing the frontend size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants