Skip to content

fix(connection): let SupersetClient.postForm accept an absolute url - #45204

Merged
rusackas merged 3 commits into
masterfrom
adopt/38069-suggested-adopt
Oct 13, 2026
Merged

rusackas merged 3 commits into
masterfrom
adopt/38069-suggested-adopt

Conversation

@rusackas

Copy link
Copy Markdown
Member

SUMMARY

Picking up #38069 from a fresh branch (thanks @martyngigg for the original work). Most of that PR already landed on master via other PRs, so what was left is small. exploreChart hands getExploreUrl's absolute URL to postForm as an endpoint, so the SQL Lab CTAS Explore button posts to something like https://host/<root>/https://host/explore/... when an app root is set.

postForm now takes either the existing endpoint string (so positional callers, including DrillDetailPane, keep working) or a { endpoint, url } object where url is used as is. exploreChart uses the url form.

Supersedes #38069.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A

TESTING INSTRUCTIONS

Set SUPERSET_APP_ROOT=/analytics, run a SQL Lab query with CTAS and click Explore. The posted URL should not contain the host twice. I did not run jest or the frontend hooks locally (node_modules lockfile mismatch in my worktree), so CI is the first real run.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration
  • Introduces new feature or API
  • Removes existing feature or API

🤖 Generated with Claude Code

postForm only took an endpoint, so exploreChart (used by the SQL Lab CTAS
Explore button) passed an absolute URL that got the app root prefixed onto
it. postForm now accepts either an endpoint string (unchanged, so existing
positional callers keep working) or a { endpoint, url } object, where url is
used as is.

Supersedes #38069.

Co-Authored-By: Martyn Gigg <[email protected]>
Co-Authored-By: Evan Rusackas <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@codeant-ai-for-open-source

codeant-ai-for-open-source Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

CodeAnt PR Risk: Low Risk

  • The PR appears safe to merge.
  • Explicit URLs are restricted to the page or configured client origin before CSRF and guest tokens are added to the form.
  • Tests cover allowed URLs and rejection of a cross-origin URL.

Assessed commit: 0cbb4135fd2e

Co-Authored-By: Evan Rusackas <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@netlify

netlify Bot commented Oct 12, 2026

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 4b33325
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6acc9fa5fd13eb9069f372f9
😎 Deploy Preview https://deploy-preview-45204--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.

@martyngigg martyngigg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I've tested out the explore button from a CTAS query in SQL lab and it posts to the correct URL and shows the expected chart.

@martyngigg

Copy link
Copy Markdown
Contributor

@rusackas Thanks for picking out these changes from #38069. Sorry for silence on that side of this for such a long time.

Just to confirm, this is the final set of changes need from #38069 and I can close it?

@rusackas
rusackas requested a review from sadpandajoe October 12, 2026 11:46
Co-Authored-By: Evan Rusackas <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@aminghadersohi
aminghadersohi self-requested a review October 12, 2026 23:42

@aminghadersohi aminghadersohi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Mutation-tested postForm: dropping the client-host entry fails the new https://host test, dropping the page origin fails the localhost one, and disabling the throw fails the cross-origin test, so the token guard is pinned. Nit: renaming the inner target (e.g. targetUrl) avoids a shadow.

@rusackas
rusackas merged commit f18c034 into master Oct 13, 2026
75 checks passed
@rusackas
rusackas deleted the adopt/38069-suggested-adopt branch October 13, 2026 07:14
@rusackas

Copy link
Copy Markdown
Member Author

Yep, that's the last of it! The backend next-param piece had already landed via #37942, and the rest of the app-root plumbing came in piecemeal elsewhere, so the postForm doubling here was genuinely the only bit still outstanding. Feel free to close #38069 whenever, I'll link it from there too.

Thanks for catching the original bug, and no worries on the silence, that happens to all of us. You're on the fix commit as a co-author, so it'll show up as yours on the repo. Looking forward to the next one :)

villebro pushed a commit that referenced this pull request Oct 16, 2026
…45204)

Co-authored-by: Martyn Gigg <[email protected]>
Co-authored-by: Claude Sonnet 5.5 <[email protected]>
(cherry picked from commit f18c034)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants