Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to adjust bcrypt hashing cost #375

Merged
merged 1 commit into from
Jan 2, 2024

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
8 checks passed
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.

None yet

2 participants