Skip to content

chore: re-add the bcrypt dependency#2029

Open
nhoening wants to merge 2 commits intomainfrom
chore/re-add-bcrypt-dependency
Open

chore: re-add the bcrypt dependency#2029
nhoening wants to merge 2 commits intomainfrom
chore/re-add-bcrypt-dependency

Conversation

@nhoening
Copy link
Contributor

@nhoening nhoening commented Mar 16, 2026

Description

We add bcrypt back to our dependencies (for a while or forever) as old logging in to accounts with older passwords seems to require it.

Flask-Security requires to explicitly install the library used for hashing. The project changed their default hashing algorithm from bcrypt to argon in v5.5.0 (which we use since a long time, I went back to 0.26). We did switch to installing argon explicitly (and not bcrypt anymore). Maybe we did not consider enough that the older passwords were hashed with a different algorithm than newer passwords.

But until now, there was also no issue. This is something we are not able to easily reproduce locally.

Apparently, bcrypt is needed when older passwords that were encrypted with it need to be used/reset. Requesting a new auth token works, but logging in does not (the user did the former regularly, but not the latter). Maybe we had a version live with bcrypt and argon, and that would do a re-hash successfully, and only few users never logged in during that time? Just a theory.

Also, there was a weird error in the logs: "ERROR: Exception in /requestAuthToken endpoint: password cannot be longer than 72 bytes, truncate manually if necessary" This is misleading, as the message is not about the actual password as it appears, see the discussion in pyca/bcrypt#1082. It seem to be a problem with the new bcrypt version 5. It seems version 4.3.0 is safer for now.

One hoster of FlexMeasures saw the problem, and installing bcrypt helped.

Closes https://github.com/SeitaBV/flexmeasures-cloudinfra/issues/283

  • re-add dependency, set bcrypt to the version reported to work well.
  • Added changelog item in documentation/changelog.rst

Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
@nhoening nhoening added this to the 0.31.2 milestone Mar 16, 2026
@nhoening nhoening self-assigned this Mar 16, 2026
@nhoening nhoening added Auth dependencies Pull requests that update a dependency file labels Mar 16, 2026
@nhoening nhoening requested a review from Flix6x March 16, 2026 19:10
@read-the-docs-community
Copy link

Documentation build overview

📚 flexmeasures | 🛠️ Build #31831583 | 📁 Comparing d2b3255 against latest (547a77b)


🔍 Preview build

Show files changed (2 files in total): 📝 2 modified | ➕ 0 added | ➖ 0 deleted
File Status
changelog.html 📝 modified
api/v3_0.html 📝 modified

Copy link
Contributor

@Flix6x Flix6x left a comment

Choose a reason for hiding this comment

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

Okay. Obviously I'll have to take care when backporting this for v0.31.2, which doesn't use uv, but it seems relativity straightforward.

@nhoening
Copy link
Contributor Author

Ah indeed, I forgot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auth dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants