Skip to content

fix(datasets): respect application root in database management link#36986

Merged
rusackas merged 1 commit intoapache:masterfrom
prokube:fix/database-link-respect-app-root
Jan 23, 2026
Merged

fix(datasets): respect application root in database management link#36986
rusackas merged 1 commit intoapache:masterfrom
prokube:fix/database-link-respect-app-root

Conversation

@geier
Copy link
Contributor

@geier geier commented Jan 8, 2026

SUMMARY

The 'Manage your databases here' link in the AddDataset LeftPanel was hardcoded as /databaseview/list, which didn't respect the configured HTTP prefix in subdirectory deployments (e.g., when
APPLICATION_ROOTis set to a path like/superset`).

This fix uses ensureAppRoot() to properly prefix the URL with the application root, ensuring the link works correctly in all deployment configurations.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A - Link behavior fix only

TESTING INSTRUCTIONS

  1. Configure Superset with a subdirectory deployment by setting APPLICATION_ROOT = "/superset" in your config
  2. Navigate to the Datasets page and click "Add Dataset"
  3. In the LeftPanel, click the "Manage your databases here" link
  4. Verify the link navigates to /superset/databaseview/list instead of just /databaseview/list
  5. Verify the link works correctly in default deployments (without APPLICATION_ROOT configured)

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

The 'Manage your databases here' link in the AddDataset LeftPanel
was hardcoded as /databaseview/list, which didn't respect the
configured HTTP prefix in subdirectory deployments.

This fix uses ensureAppRoot() to properly prefix the URL with
the application root, ensuring the link works correctly in all
deployment configurations.
@codeant-ai-for-open-source
Copy link
Contributor

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Jan 8, 2026

Code Review Agent Run #380d7c

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 245e385..245e385
    • superset-frontend/src/features/datasets/AddDataset/LeftPanel/index.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@dosubot dosubot bot added the change:frontend Requires changing the frontend label Jan 8, 2026
@codeant-ai-for-open-source
Copy link
Contributor

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • Full page reload
    The code uses an anchor href to navigate to the databases list: using href={ensureAppRoot('/databaseview/list')} will trigger a full page reload instead of client-side navigation. Prefer using the app router (Link / navigate) so navigation stays within the SPA and preserves state/history.

<span>
{t('Manage your databases')}{' '}
<Typography.Link href="/databaseview/list">
<Typography.Link href={ensureAppRoot('/databaseview/list')}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: A malicious or misconfigured ensureAppRoot could return a non-relative or unsafe URL (for example a javascript: or external URL). Constrain the value to a safe internal path (e.g. ensure it starts with '/') and fallback if not, to prevent link injection/XSS-like issues. [security]

Severity Level: Critical 🚨

Suggested change
<Typography.Link href={ensureAppRoot('/databaseview/list')}>
<Typography.Link href={((): string => { const p = ensureAppRoot('/databaseview/list'); return p && p.startsWith('/') ? encodeURI(p) : '/databaseview/list'; })()}>
Why it matters? ⭐

Valid security concern: untrusted or misconfigured ensureAppRoot could return an external or unsafe URL (javascript: scheme etc). The proposed guard (verify it starts with '/' and fallback) prevents link injection and is a reasonable defensive measure. It's a legitimate fix when the origin of ensureAppRoot's value isn't strictly controlled.

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/src/features/datasets/AddDataset/LeftPanel/index.tsx
**Line:** 195:195
**Comment:**
	*Security: A malicious or misconfigured `ensureAppRoot` could return a non-relative or unsafe URL (for example a javascript: or external URL). Constrain the value to a safe internal path (e.g. ensure it starts with '/') and fallback if not, to prevent link injection/XSS-like issues.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have checked, and a lot of other existing links in the project use the very same pattern as above, not the much more complicated (but more secure) version you suggested. Can you check what the convention in the existing code base is?

@codeant-ai-for-open-source
Copy link
Contributor

CodeAnt AI finished reviewing your PR.

@netlify
Copy link

netlify bot commented Jan 8, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 245e385
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/695fee5711fec1000821ba7c
😎 Deploy Preview https://deploy-preview-36986--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@rusackas
Copy link
Member

@martyngigg any thoughts on this one?

@rusackas rusackas requested a review from eschutho January 12, 2026 18:28
Copy link
Contributor

@martyngigg martyngigg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rusackas I tested it with the docker-compose-light config and it looks okay to me.

It's consistent with the way this is currently handled across the frontend and also aligns with similar changes in #36058.

Copy link
Member

@rusackas rusackas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, folks!

@rusackas rusackas merged commit 34418d7 into apache:master Jan 23, 2026
77 of 78 checks passed
sadpandajoe pushed a commit that referenced this pull request Jan 23, 2026
@sadpandajoe sadpandajoe added the v6.0 Label added by the release manager to track PRs to be included in the 6.0 branch label Jan 23, 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/XS v6.0 Label added by the release manager to track PRs to be included in the 6.0 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants