Skip to content

Add option to adjust bcrypt hashing cost#375

Merged
techknowlogick merged 1 commit intocesanta:mainfrom
orbit-online:ft-bcrypt-cost
Jan 2, 2024
Merged

Add option to adjust bcrypt hashing cost#375
techknowlogick merged 1 commit intocesanta:mainfrom
orbit-online:ft-bcrypt-cost

Conversation

@andsens
Copy link
Contributor

@andsens andsens commented Nov 1, 2023

The default bcrypt hashing cost can be quite problematic when serving many requests at once. Depending on token expiration times and other security considerations, lowering the cost can be a valid fix. This PR adds the token_hash_cost to all TokenDB configs (redis, GCS, LevelDB). Note that the level db config was a simple string previously, I had to change it to a struct with {path: string, token_hash_cost: int}.

Note that this PR is built on top of #374.

Copy link
Collaborator

@techknowlogick techknowlogick left a comment

Choose a reason for hiding this comment

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

Thanks for this PR! Could you resolve conflicts :)

The defualt cost of 10 can be very prohibitive when the
server is hit with more than ~10 simultaneous requests and
only one CPU is available
@andsens
Copy link
Contributor Author

andsens commented Jan 2, 2024

Done!

@techknowlogick techknowlogick merged commit 497467b into cesanta:main Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants