Repository navigation
Conversation
Code Review Agent Run #4d4f94Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Code Review Agent Run #d815dfActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #37773 +/- ##
=======================================
Coverage 66.19% 66.19%
=======================================
Files 2949 2949
Lines 177374 177413 +39
Branches 41102 41109 +7
=======================================
+ Hits 117411 117437 +26
- Misses 57460 57467 +7
- Partials 2503 2509 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Superset uses Git pre-commit hooks courtesy of pre-commit. To install run the following:
This will install the hooks in your local repository. From now on, a series of checks will automatically run whenever you make a Git commit. To run pre-commit manually run the following:
|
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
I’ve run |
Code Review Agent Run #d6e5b3Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
|
Running CI 🤞 |
|
Thanks once again and CI surfaced two remaining issues I’m addressing now: • A ruff E501 (line length) in security/manager.py, which I’ll fix by wrapping the comment. The fixes will be pushed shortly. |
Code Review Agent Run #08d3efActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
|
Thanks for sticking with this @jayvenn21. It's gone conflicting with master, so it'll need a rebase. One open question from @dpgaspar still stands: he floated doing this as a FAB config (like FAB_ADD_SECURITY_VIEWS) so the views just never register, which is cleaner than gating here. Worth deciding which direction we want before we run CI again? |
c143394 to
561d932
Compare
|
@rusackas Thanks for the feedback! It’s been a while since I touched this, so I rebased the PR on current I also revisited the implementation. Instead of registering the legacy FAB password reset views and then trying to remove/unregister them afterward, this now skips registering those views during FAB security view registration. That gets closer to the FAB config direction discussed earlier, without requiring a new FAB release/dependency bump for this PR. Here are the validation tests:
Note: I attempted |
Code Review Agent Run #95daebActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
|
| Language | Fuzzy before | Fuzzy after | New |
|---|---|---|---|
fi |
4814 | 4817 | +3 |
fr |
1004 | 1014 | +10 |
it |
1665 | 1667 | +2 |
ko |
1519 | 1521 | +2 |
th |
4814 | 4817 | +3 |
tr |
585 | 786 | +201 |
How to fix
1. Install dependencies (if not already set up):
pip install -r superset/translations/requirements.txt
sudo apt-get install gettext # or: brew install gettext2. Re-extract strings and sync .po files:
./scripts/translations/babel_update.shThis rewrites superset/translations/messages.pot from the current source files and merges the changes into every .po file. Strings whose msgid changed will be marked #, fuzzy.
3. Resolve the fuzzy entries in the affected language files (fi, fr, it, ko, th, tr):
grep -n '#, fuzzy' superset/translations/<lang>/LC_MESSAGES/messages.poFor each fuzzy entry, either rewrite the msgstr to match the new string and remove the #, fuzzy line, or clear the msgstr to "" if you cannot provide a translation.
4. Commit your changes to the .po files.
EnxDev's Review Agent — #37773 · HEAD 561d932comment — Fix works and is tested for the default path, but a maintainer steered toward an upstream FAB config and the self-service password-change path needs confirming. 🔴 Functional
🟡 Should-fix
🔵 Nits
|
|
Thanks for chasing this down, @jayvenn21. Think there seems to be a regression here though:
Also, @dpgaspar's suggestion of a cleaner FAB-side config flag (like |
Code Review Agent Run #48d118Actionable Suggestions - 0Additional Suggestions - 1
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
| ): | ||
| assert "ResetPasswordView" in view_menus | ||
| else: | ||
| assert "ResetPasswordView" not in view_menus |
There was a problem hiding this comment.
Could we make this assertion independent of pre-existing role metadata? I can reproduce a failure with:
pytest tests/integration_tests/core_tests.py -k "admin_only_menu_views or legacy_fab_password_views_are_not_registered" -q
ResetPasswordView is still attached to Admin until sync_role_definitions() runs, because skipping route registration does not itself rewrite persisted role assignments. That makes this test depend on whether the test database was created fresh or upgraded. The unit test below already covers the role-sync behavior, so the cleanest option may be to keep this integration test focused on the registered endpoints; alternatively, explicitly run/setup role sync before asserting the role contents.
There was a problem hiding this comment.
Good catch. I dropped the Admin assertion from that integration test, so it only checks that Alpha/Gamma never get ResetPasswordView, and left the role-sync behavior to the unit tests.
| def add_view_no_menu_without_legacy_password_views( | ||
| baseview: Any, *args: Any, **kwargs: Any | ||
| ) -> Any: | ||
| if isinstance(baseview, legacy_password_views) or ( |
There was a problem hiding this comment.
The FAB user-info and admin-user pages still render their reset actions, but those POST handlers call url_for() for the views skipped here, so clicking either button now raises BuildError and returns a 500. Could the flag also suppress or redirect those actions so every still-reachable launcher has a valid destination?
There was a problem hiding this comment.
Yeah, that was a 500 waiting to happen. With the views skipped, the matching resetpasswords / resetmypassword actions on the user view are now hidden from the show and list widgets, and a direct request to either answers 404 instead of hitting url_for.
|
|
||
| pvms = self._get_all_pvms() | ||
|
|
||
| if excluded_view_menus := self._legacy_password_view_menus_to_exclude(): |
There was a problem hiding this comment.
After superset init runs with the default flags, this filter removes the reset-view permissions, but changing either flag only re-registers routes on web startup. An operator who later enables the documented escape hatch still gets access denied, while enabling forced password change can redirect affected users to a view they cannot access; could route registration and role assignment be kept in sync without requiring another undocumented init?
There was a problem hiding this comment.
No other FAB view-registration setting hot-reloads, and Superset builds the appbuilder with update_perms=False, so permissions only ever move at superset init anyway. I documented that in the config comment and UPDATING.md instead: flipping either flag means a restart plus superset init.
| ### Legacy FAB password reset routes are no longer registered by default | ||
|
|
||
| The legacy Flask-AppBuilder SSR password reset views are no longer registered | ||
| by default. `/superset/resetpassword` (admin-triggered password reset) is no |
There was a problem hiding this comment.
These paths do not match the FAB routes: the forms are mounted at /resetpassword/form and /resetmypassword/form, without a /superset prefix. Could this migration note name the actual URLs so operators audit and update the right links?
There was a problem hiding this comment.
Oops, fixed. The note (and the config comment) now name /resetpassword/form and /resetmypassword/form.
|
Still conflicting with |
eeeed14 to
6ba4884
Compare
There was a problem hiding this comment.
Code Review Agent Run #147aa7
Actionable Suggestions - 4
-
tests/unit_tests/security/manager_test.py - 2
- Inline Imports Violate Rule · Line 4342-4343
- Dead Redundant Assignment · Line 4371-4373
-
tests/integration_tests/core_tests.py - 2
- Missing docstrings on new test · Line 124-127
- Missing docstring on new test · Line 144-144
Additional Suggestions - 3
-
tests/unit_tests/security/manager_test.py - 3
-
Duplicated Config Restore Pattern · Line 4358-4369This hand-rolled save/restore of `current_app.config` (save at 4358-4365, restore in the finally at 4379) duplicates the `mocker.patch.dict` pattern this same file already uses at line 70, with a comment there explaining it prevents config leaks into the module-scoped app. Prefer `mocker.patch.dict` here and in the sibling test at 4894-4905 for consistency and less teardown boilerplate.
-
Duplicated Config Restore Pattern · Line 4894-4905Second instance of the hand-rolled config save/restore (save at 4894-4901, restore at 4905), duplicating the `mocker.patch.dict` idiom documented at line 68-74 of this file and the sibling test at 4358-4380. Using `mocker.patch.dict` removes the try/finally boilerplate and keeps config isolation uniform across the module.
-
Fragile Mock Args Unpack · Line 4907-4908`role_name, _classifier_fn, synced_pvms = call.args` assumes `set_role` is always invoked positionally; a keyword-arg call would leave `call.args` empty and raise `ValueError: not enough values to unpack`, masking the intended assertion message. Today `sync_role_definitions` passes positionally (manager.py:3103-3116), so this is forward-proofing rather than a current failure.
-
Review Details
-
Files reviewed - 4 · Commit Range:
a40425a..6ba4884- superset/config.py
- superset/security/manager.py
- tests/integration_tests/core_tests.py
- tests/unit_tests/security/manager_test.py
-
Files skipped - 1
- UPDATING.md - Reason: Filter setting
-
Tools
- MyPy (Static Code Analysis) - ✔︎ Successful
- Astral Ruff (Static Code Analysis) - ✔︎ Successful
- 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 an incremental AI Review. -
/review full- 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 [email protected].
Documentation & Help
| from flask import current_app | ||
| from flask_appbuilder.security.views import ResetMyPasswordView, ResetPasswordView |
There was a problem hiding this comment.
from flask import current_app at 4342 duplicates the module-level import on line 27, and the flask_appbuilder.security.views import has no circular-dependency justification (this module already imports flask_appbuilder at top level, lines 28-29). Repo rule requires module-level imports unless a documented circular dependency exists; delete the flask re-import and hoist the FAB view import.
Code Review Run #147aa7
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
There was a problem hiding this comment.
Fair, hoisted both to module level and dropped the duplicate current_app import.
There was a problem hiding this comment.
The changes correctly address the review suggestion by moving the imports to the module level and removing the duplicate import. This aligns with the repository's import rules and maintains clean code structure.
| original_add_view_no_menu: Callable[..., Any] = fake_appbuilder.add_view_no_menu | ||
| try: | ||
| original_add_view_no_menu = sm._skip_legacy_fab_password_view_registration() |
There was a problem hiding this comment.
Line 4371 initializes original_add_view_no_menu from fake_appbuilder.add_view_no_menu, but line 4373 immediately rebinds it to _skip_legacy_fab_password_view_registration() return value before any read; on the early-raise path the finally at 4380 restores a value identical to what the namespace already holds. Drop the 4371 initializer and the now-unused Callable import added on line 23.
Code Review Run #147aa7
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
There was a problem hiding this comment.
Yep, dropped the initializer and the Callable import.
There was a problem hiding this comment.
Understood. Removing the redundant initializer and the unused import is the correct approach to clean up the code in that test case.
| def test_admin_only_menu_views(self) -> None: | ||
| def assert_admin_view_menus_in( | ||
| role_name: str, assert_func: Callable[[str, list[str]], None] | ||
| ) -> None: |
There was a problem hiding this comment.
New test method test_admin_only_menu_views and its nested helper assert_admin_view_menus_in carry no docstrings. BITO.md adaptive rule 12147 requires docstrings on all new Python functions, helpers, and test methods, and rule 12148 covers new test functions specifically. Adding one-line docstrings keeps the new typing-heavy signature consistent with the org documentation standard.
Code Review Run #147aa7
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
| assert_admin_view_menus_in("Alpha", self.assertNotIn) | ||
| assert_admin_view_menus_in("Gamma", self.assertNotIn) | ||
|
|
||
| def test_legacy_fab_password_views_are_not_registered(self) -> None: |
There was a problem hiding this comment.
New test test_legacy_fab_password_views_are_not_registered has no docstring. BITO.md adaptive rule 12148 mandates a docstring on every newly added test function documenting purpose, scenario, and expected outcome. It is especially useful here because the assertions branch on ENABLE_LEGACY_FAB_PASSWORD_VIEWS and ENABLE_FORCE_PASSWORD_CHANGE rather than asserting a single fixed outcome.
Code Review Run #147aa7
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
Prevent direct URL access to /superset/resetpassword and /superset/resetmypassword when ENABLE_LEGACY_FAB_PASSWORD_VIEWS is False (default). Unregister FAB ResetPasswordView and ResetMyPasswordView blueprints so these SSR views are not user-accessible post-frontend port. Fixes apache#37700
…w gating Addresses two open review comments on this PR: document what _skip_legacy_fab_password_view_registration does/returns, and note the route-removal behavior change in UPDATING.md so operators relying on the legacy SSR password reset routes know how to opt back in. Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5 <[email protected]>
On an upgraded install, a ResetPasswordView permission/view-menu row persisted from before ENABLE_LEGACY_FAB_PASSWORD_VIEWS existed would still get handed to Admin by sync_role_definitions even though the flag disables the view's registration. Exclude it (and ResetMyPasswordView, when applicable) from role sync when the flag says they shouldn't be registered, and add a regression test covering the stale-row case. Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Sonnet 5 <[email protected]>
…nly flag Review follow-ups for the ENABLE_LEGACY_FAB_PASSWORD_VIEWS gate: - Hide the user view's "Reset Password" / "Reset my password" actions when their target view is skipped, and answer 404 on a direct request, instead of letting FAB's url_for raise BuildError (a 500). - Centralize the skip rule in _legacy_password_views_to_skip so route registration, launcher hiding and role sync all agree. - Document that the flag is read at startup and permissions only move at `superset init`, and name the actual /resetpassword/form and /resetmypassword/form routes in config.py and UPDATING.md. - Make the admin-only-menu integration test independent of persisted role metadata, add docstrings to the new tests, hoist the test imports and drop the dead assignment. Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]>
6ba4884 to
9a24ed8
Compare
|
@msyavuz to answer your question: yes, with the flag off there's no UI left for an admin to reset someone else's password. The FAB "Reset Password" button is hidden (it was 500ing anyway), the SPA edit-user modal has no password field, and only Also rebased on |
Code Review Agent Run #f13cd5Actionable Suggestions - 0Additional Suggestions - 1
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
EnxDev
left a comment
There was a problem hiding this comment.
Went through the latest push. The reset launchers are hidden and dispatch to the 404 handler in the real app's user view, not just the unit test's stub, the UPDATING paths are right, and the stale-perm exclusion does what it says.
Two notes inline: the red unit-tests job, and the forced-change redirect loop. babel-extract and the pot-drift test fail on master too, and execution_claim_test passes locally, so that one looks like a flake.
| return () | ||
| if current_app.config.get("ENABLE_FORCE_PASSWORD_CHANGE", False): | ||
| return (ResetPasswordView,) | ||
| return (ResetPasswordView, ResetMyPasswordView) |
There was a problem hiding this comment.
This is what's turning unit-tests red: the positive control at the end of test_enforcement_exempts_health_blueprint (tests/unit_tests/security/test_password_change.py:146) expects / to redirect to /resetmypassword/form, but that test's app boots with ENABLE_FORCE_PASSWORD_CHANGE off, so the view gets skipped here and the hook falls back to /logout/. Passes on master, fails GET and HEAD on this branch.
Booting the app with the flag on fixes it (that file plus manager_test.py go 202/202 locally):
@pytest.mark.parametrize("app", [{"ENABLE_FORCE_PASSWORD_CHANGE": True}], indirect=True)
@pytest.mark.parametrize("method", ["GET", "HEAD"])
def test_enforcement_exempts_health_blueprint(|
|
||
| :returns: view-menu names to exclude from role assignment | ||
| """ | ||
| return {view.__name__ for view in self._legacy_password_views_to_skip()} |
There was a problem hiding this comment.
If the superset init step gets missed after turning ENABLE_FORCE_PASSWORD_CHANGE on, flagged users don't get an access-denied page, they get an endless redirect: with no built-in role holding can_this_form_get on ResetMyPasswordView, the form bounces to /login/ and the hook sends /login/ straight back (reproduced locally, Admin included since its perms go through this filter too).
Could ResetMyPasswordView stay out of this exclusion set? A perm on an unrouted view is harmless, and upgraded installs would then keep working whichever way the flag gets flipped.
|
Thanks again for pushing this along, @jayvenn21. Mulling it over, I'd rather not carry a flag for pages nobody asked to keep, so I went the other way and removed the views outright, with the SPA picking up the admin reset, self-service and forced-change flows. That's up as #44626, with your registration intercept and tests carried over and you credited as co-author. Closing this one in favor of it. |
…rd resets into the SPA The Flask-AppBuilder server-rendered ResetPasswordView and ResetMyPasswordView (/resetpassword/form, /resetmypassword/form) survived the SPA migration and were still reachable in 6.0 (#37700). Rather than gating them behind a config flag (#37773), remove them for good and make the SPA cover every flow they served: - register_views() intercepts add_view_no_menu for the duration of FAB's own registration so the two views never reach the URL map; the "Reset Password" / "Reset my password" launchers on the FAB user pages are hidden and answer 404 instead of raising BuildError; and sync_role_definitions stops assigning the stale ResetPasswordView, ResetMyPasswordView and UserDBModelView launcher permissions that an upgraded metadata database still carries. - The Users list edit modal gains optional "New password" / "Confirm new password" fields wired to PUT /api/v1/security/users/<id>, the admin path that never required a current password. PUT /api/v1/me/ keeps requiring current_password for self-service changes. - The profile page's "Reset my password" modal now sends current_password, which /api/v1/me/ has required since #42934, so the SPA self-service flow works again. - The forced-password-change hook (ENABLE_FORCE_PASSWORD_CHANGE) redirects to /user_info/ instead of the removed view, exempting the profile page, the current-user API and the CSRF endpoint so the page is usable, and a successful self-service change through /api/v1/me/ clears password_must_change in the same unit of work as the new hash. Fixes #37700 Supersedes #37773 Co-authored-by: jayvenn21 <[email protected]> Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]>
…rd resets into the SPA The Flask-AppBuilder server-rendered ResetPasswordView and ResetMyPasswordView (/resetpassword/form, /resetmypassword/form) survived the SPA migration and were still reachable in 6.0 (#37700). Rather than gating them behind a config flag (#37773), remove them for good and make the SPA cover every flow they served: - register_views() intercepts add_view_no_menu for the duration of FAB's own registration so the two views never reach the URL map; the "Reset Password" / "Reset my password" launchers on the FAB user pages are hidden and answer 404 instead of raising BuildError; and sync_role_definitions stops assigning the stale ResetPasswordView, ResetMyPasswordView and UserDBModelView launcher permissions that an upgraded metadata database still carries. - The Users list edit modal gains optional "New password" / "Confirm new password" fields wired to PUT /api/v1/security/users/<id>, the admin path that never required a current password. PUT /api/v1/me/ keeps requiring current_password for self-service changes. - The profile page's "Reset my password" modal now sends current_password, which /api/v1/me/ has required since #42934, so the SPA self-service flow works again. - The forced-password-change hook (ENABLE_FORCE_PASSWORD_CHANGE) redirects to /user_info/ instead of the removed view, exempting the profile page, the current-user API and the CSRF endpoint so the page is usable, and a successful self-service change through /api/v1/me/ clears password_must_change in the same unit of work as the new hash. Fixes #37700 Supersedes #37773 Co-authored-by: jayvenn21 <[email protected]> Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]>
Summary
After the frontend porting in Superset 6.0.0, most user-facing views were migrated to the React SPA and rendered via
render_app_template. However, the legacy Flask-AppBuilder password reset views (ResetPasswordandResetMyPassword) remain directly accessible via URL and render using server-side templates.This results in inconsistent behavior and exposes legacy SSR FAB views that were not intended to be accessible post-migration.
What this PR does
What this PR does not do
Rationale
This change addresses an unintended side effect of the FAB → SPA migration and keeps Superset’s frontend behavior consistent without expanding scope into broader authentication or UX changes.
Related Issue
Fixes #37700