Skip to content

chore(deps): bump flask-appbuilder from 5.2.2 to 5.2.3 - #44400

Merged
Vitor-Avila merged 2 commits into
masterfrom
bump-flask-appbuilder-5-2-3
Sep 17, 2026
Merged

Vitor-Avila merged 2 commits into
masterfrom
bump-flask-appbuilder-5-2-3

Conversation

@aminghadersohi

@aminghadersohi aminghadersohi commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

SUMMARY

Bumps flask-appbuilder from 5.2.2 to 5.2.3.

Diffing the two sdists, the release contains exactly two functional changes; every
other changed file (baseviews.py, cli.py, widgets.py, views.py, filemanager.py,
models/mixins.py, _compat.py, …) is reformatting from a newer black.

1. AuthView._get_safe_next_url() (security/views.py)

A new helper, get_safe_redirect(request.args.get("next", self.appbuilder.get_url_for_index)),
is applied at the five "already authenticated" early-return sites in
AuthDBView, AuthLDAPView, AuthOAuthView, AuthOIDView and AuthRemoteUserView.
Those sites previously redirected unconditionally to the index.

This is inert for Superset:

  • SupersetAuthView (superset/views/auth.py) overrides login() and is registered at
    /login/ for every auth type except AUTH_REMOTE_USER
    (SupersetSecurityManager.register_views), so FAB's own login views never handle the
    route and the helper is never called.
  • For AUTH_REMOTE_USER — the one case where FAB's view does claim the route — 5.2.2
    already did redirect(get_safe_redirect(request.args.get("next", ""))), and
    get_safe_redirect("") already fell back to get_url_for_index. The refactor is
    behaviour-preserving there.

2. has_access now returns 403 for authorization failures (security/decorators.py)

if current_user.is_authenticated and current_user.is_active:
    abort(403)
flash(as_unicode(FLAMSG_ERR_SEC_ACCESS_DENIED), "danger")
return redirect(url_for(..., next=request.url))

This one is live in Superset: has_access is imported from Flask-AppBuilder directly
at ~42 legacy view methods and is not overridden.

  • Unauthenticated users are unaffected. The new branch requires
    current_user.is_authenticated and current_user.is_active, so anonymous requests still
    get the flash and the 302 to the login view with next=.
  • Authenticated users now get 403 where they were previously redirected to the login
    view (which, being already authenticated, bounced them on to the index with a flash).

That is the intended fix upstream — an authenticated user failing an authorization check
is not an authentication problem and should not be sent to a login page — and it matches
what Superset's own view code already does (superset/views/core.py redirects to login
only when there is no current user, and otherwise aborts).

One consequence worth flagging for reviewers: Superset registers no 403 error page, and
show_http_exception (superset/views/error_handling.py) only serves a static HTML page
for 404 and 500. A browser navigating to a legacy view the logged-in user lacks permission
for will therefore render a JSON error body rather than an HTML page. Adding a 403 static
page alongside the existing 404.html/500.html would be a reasonable follow-up; it is
left out of this PR to keep the bump reviewable on its own.

No configuration changes are required by this bump.

One existing test asserted the old behaviour and is updated here:
tests/integration_tests/sqllab_tests.py::TestSqlLab::test_sqllab_no_access logs in as
Gamma, requests /sqllab/ and /sqllab/history/, and asserted 302 ("Redirects to the
main page"). That is precisely the case above, so it now asserts 403. A companion
test_sqllab_no_access_anonymous is added to pin the other half of the distinction —
logged out, the same endpoints still redirect to the login view.

TESTING INSTRUCTIONS

The pinned files were regenerated with the repo's own tooling rather than hand-edited:

# after bumping the floor in pyproject.toml
./scripts/uv-pip-compile.sh

That produced a one-line change in each of requirements/base.txt and
requirements/development.txt and no transitive drift — 5.2.3 leaves install_requires
untouched, so nothing else in the resolution moves.

To exercise the behaviour change above:

  1. Log in as a Gamma user.
  2. Navigate to a legacy view that role lacks the permission for (e.g. /sqllab/).
  3. Expect 403; before this bump the response was a 302 to /login/?next=…, which then
    redirected on to the index.
  4. Log out and repeat step 2 — the response should still be a 302 to the login view.

CI is the verification for the suite as a whole; this is a dependency bump, so the backend
unit and integration jobs are the relevant signal. The first run surfaced exactly one
failure, test_sqllab_no_access (assert 302 == 403) in the test-postgres-hive and
test-postgres-presto legs, which is the test updated above.

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

Flask-AppBuilder 5.2.3 distinguishes authentication from authorization in
has_access: an authenticated, active user failing the permission check is
now forbidden rather than redirected to the login view. Pin both halves of
that distinction.
@aminghadersohi
aminghadersohi marked this pull request as ready for review September 17, 2026 20:19
@codecov

codecov Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.41%. Comparing base (77dbaaf) to head (5e12c08).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #44400      +/-   ##
==========================================
- Coverage   80.41%   80.41%   -0.01%     
==========================================
  Files        2932     2932              
  Lines      174621   174621              
  Branches    40559    40559              
==========================================
- Hits       140422   140416       -6     
- Misses      31532    31538       +6     
  Partials     2667     2667              
Flag Coverage Δ
hive 37.34% <ø> (+<0.01%) ⬆️
mysql 56.59% <ø> (ø)
postgres 56.60% <ø> (-0.01%) ⬇️
presto 39.23% <ø> (+<0.01%) ⬆️
python 84.77% <ø> (-0.01%) ⬇️
sqlite 56.30% <ø> (ø)
unit 76.41% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Vitor-Avila
Vitor-Avila merged commit 4c3a890 into master Sep 17, 2026
143 of 154 checks passed
@Vitor-Avila
Vitor-Avila deleted the bump-flask-appbuilder-5-2-3 branch September 17, 2026 21:18
@bito-code-review

Copy link
Copy Markdown
Contributor

Bito Automatic Review Skipped – PR Already Merged

Bito scheduled an automatic review for this pull request, but the review was skipped because this PR was merged before the review could be run.
No action is needed if you didn't intend to review it. To get a review, you can type /review in a comment and save it

villebro added a commit that referenced this pull request Nov 14, 2026
…5922)

7.0 was on 5.2.2, so this takes master's two bumps together, including
#44400's SQL Lab test update for FAB answering an authenticated user without
permission with 403 instead of a login redirect.

(cherry picked from commit 4c3a890, reduced)
(cherry picked from commit 966104b, reduced)
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.

2 participants