Skip to content

Fix FAB FastAPI PATCH users to respect FAB_PASSWORD_HASH_METHOD - #73110

Merged
vincbeck merged 1 commit into
apache:mainfrom
auyua9:fix/fab-api-hash-method-config
Sep 14, 2026
Merged

vincbeck merged 1 commit into
apache:mainfrom
auyua9:fix/fab-api-hash-method-config

Conversation

@auyua9

@auyua9 auyua9 commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

What's changed

The FastAPI users service PATCH path now hashes new passwords through security_manager._hash_password instead of calling werkzeug's generate_password_hash directly. The existing service test asserts the new contract.

Why

#65735 made the security manager honor FAB_PASSWORD_HASH_METHOD via _hash_password, but the FastAPI PATCH /users/{username} path was missed: REST-API password updates were always hashed with the default method while CLI/UI updates used the configured one, producing mixed hash schemes in the DB and breaking deployments that rely on a specific method (the exact problem class #65735 / #65728 fixed for the other paths).

Testing

  • uv run pytest providers/fab/tests/unit/fab/auth_manager/api_fastapi/services/test_users.py → 24 passed

PR apache#65735 made the security manager honor FAB_PASSWORD_HASH_METHOD
through _hash_password, but the FastAPI users service PATCH path
still called werkzeug's generate_password_hash directly, so REST-API
password updates were always hashed with the default method while
CLI/UI updates used the configured one - producing mixed hash
schemes in the DB and breaking deployments that rely on a specific
method. Route the PATCH path through
security_manager._hash_password and update the existing service
test to assert the new contract.

@Vamsi-klu Vamsi-klu left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

​

@vincbeck
vincbeck merged commit e2a0e8a into apache:main Sep 14, 2026
79 checks passed
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.

3 participants