Bump flask-appbuilder to 5.2.1 and mirror new auth event hooks#66841
Merged
Conversation
Contributor
|
Quickest fix: git fetch upstream main && git rebase upstream/main
rm uv.lock && uv lock
git add uv.lock && git rebase --continue
git push --force-with-leaseAutomated nudge — ignore if you're not ready to rebase. This comment is updated in place on future |
vincbeck
approved these changes
May 13, 2026
Upstream FAB 5.2.1 was released to PyPI on 2026-04-09 (no GitHub release was cut, only a master commit `5dae8164` titled "release: 5.2.1"). It adds three vendored-relevant items on top of 5.2.0: - PR apache#2450 (commit 63e7708e) — three new no-op hook methods on BaseSecurityManager: on_user_login, on_user_login_failed, on_user_logout. update_user_auth_stat now calls on_user_login or on_user_login_failed at the end. AuthView.logout / SAML SLO call on_user_logout. Hook defaults are no-ops; subclasses can override for audit logging. - PR apache#2451 — _is_user_detached / _get_safe_user helpers + a rewrite of has_access to handle DetachedInstanceError on g.user (LocalProxy or detached ORM instance after some session boundary). Inherited automatically; not vendored in override.py so no mirror needed. - PR apache#2440 — security log redactions: OAuth tokens / responses no longer logged at debug level. Inherited; the redacted code paths are not vendored in override.py. Mirror the auth-event-hook pieces into FabAirflowSecurityManagerOverride since update_user_auth_stat is vendored. Without this mirror, the new hooks would not fire in Airflow because override.py shadows the upstream implementation. Specifically: - Add no-op on_user_login / on_user_login_failed / on_user_logout methods on FabAirflowSecurityManagerOverride mirroring the FAB defaults. - Append the on_user_login / on_user_login_failed dispatch at the end of FabAirflowSecurityManagerOverride.update_user_auth_stat, matching the upstream order (called after update_user, so the counters / last_login are already persisted before the hook runs). Bump EXPECTED_FAB_VERSION in test_fab_alignment.py to 5.2.1; all 7 alignment tests + 39 security_manager unit tests pass locally with flask-appbuilder==5.2.1 installed. The pyjwt floor pin from the parent commit on this branch is unchanged; the lock-file bump for it is included here because uv re-resolved the graph for the FAB version bump.
dfed5e1 to
a7cef48
Compare
This was referenced May 16, 2026
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.
Summary
Upstream Flask-AppBuilder 5.2.1 was released to PyPI on 2026-04-09 (commit
5dae8164titled "release: 5.2.1"). The maintainer did not cut a GitHub release / tag, which is whygh api .../tagsstill showsv5.2.0as the latest. The release has three changes that matter for our vendoredBaseSecurityManager:on_user_login/on_user_login_failed/on_user_logoutno-op hooks;update_user_auth_statnow callson_user_login{,_failed};AuthView.logout/ SAML SLO callon_user_logoutupdate_user_auth_statis inoverride.py, so the hook calls must be mirrored or the hooks never fire in Airflow. This PR mirrors them._is_user_detached/_get_safe_userhelpers;has_accessrewrite handlingDetachedInstanceErrorong.user(LocalProxy or detached ORM)has_accessis not vendored inoverride.py. No mirror needed.Changes
providers/fab/pyproject.toml— bumpflask-appbuilder==5.2.0→==5.2.1providers/fab/src/airflow/providers/fab/auth_manager/security_manager/override.py— add no-opon_user_login/on_user_login_failed/on_user_logoutmirroring FAB's defaults; append the hook dispatch at the end ofupdate_user_auth_statmatching the upstream call order (afterupdate_user, so counters andlast_loginare persisted before the hook runs).providers/fab/tests/unit/fab/auth_manager/security_manager/test_fab_alignment.py— bumpEXPECTED_FAB_VERSIONto"5.2.1".uv.lock— re-resolved.generated/provider_dependencies.jsonandproviders/fab/docs/index.rstregenerated by prek.Validation
test_fab_alignment.py— all 7 alignment tests pass withflask-appbuilder==5.2.1installed (the test comparesFabAirflowSecurityManagerOverrideagainstBaseSecurityManagerfrom FAB).providers/fab/tests/unit/fab/auth_manager/security_manager/— all 39 unit tests pass.Note on the upstream PyJWT root cause
This PR builds on #66840 (parent branch
pin-pyjwt-in-fab-provider), which adds a defensivepyjwt>=2.11.0pin toproviders/fab/pyproject.tomlto keep the FAB provider installable against olderairflow-corereleases. The actual root cause is inflask-jwt-extended, not FAB:flask_jwt_extended/tokens.pydoesfrom jwt.types import Options, andjwt.types.Optionswas first added in PyJWT 2.11.0flask-jwt-extended4.7.3 (2026-05-08) bumpedrequirements.txttoPyJWT==2.12.1but did not lift the floor insetup.py::install_requires, which still readsPyJWT>=2.0,<3.0flask-jwt-extended4.7.3 with PyJWT 2.10.x and still hit the broken importA follow-up issue against
vimalloc/flask-jwt-extendedto lift their distributed-package install_requires floor toPyJWT>=2.11.0would be the cleanest long-term fix; until then, FAB'sPyJWT>=2.0.0,<3.0.0pin is also too permissive but matchesflask-jwt-extended's. Our airflow-side defensive pin (#66840) closes the loop without waiting on either upstream.Test plan
test_fab_alignment.pypasses in CI (it was the canary test we were supposed to run on every FAB version bump per the comment atpyproject.toml:80)related: #66840
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 4.7) following the guidelines