villebro opened a new pull request, #45896: URL: https://github.com/apache/superset/pull/45896
### SUMMARY `superset.extensions.csrf` is a module-level `CSRFProtect` singleton, so the CSRF-exempt blueprints registered by one unit-test app stay exempt for every app the `app` fixture builds afterwards. `tests/unit_tests/extensions/test_api_registration.py` builds an app with `FAB_API_KEY_ENABLED`, which exempts FAB's `ApiKeyApi`; when the suite runs serially (as on the 7.0 release branch, where it failed `unit-tests (next)`), `test_csrf_exempt_blueprints` in `tests/unit_tests/security/api_test.py` then sees `ApiKeyApi` in the exempt set and fails. Master's parallel runs usually put the two files in different workers, which hides it. The `app` fixture already resets the `appbuilder` views and menu for the same singleton reason; this resets `csrf._exempt_views` and `csrf._exempt_blueprints` there as well, before the app is initialized, so each app registers only its own exemptions. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF Not applicable. ### TESTING INSTRUCTIONS - `pytest tests/unit_tests/extensions/test_api_registration.py tests/unit_tests/security/api_test.py`: before, `test_csrf_exempt_blueprints` fails with `ApiKeyApi` as an extra exempt blueprint; after, all 23 tests pass. - `pytest tests/unit_tests/security tests/unit_tests/extensions tests/unit_tests/views tests/unit_tests/mcp_service/test_auth_api_key.py tests/unit_tests/initialization`: 1480 passed. ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] 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 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
