-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Enhance pbkdf2 password hashing #24132
Enhance pbkdf2 password hashing #24132
Conversation
1c79675
to
141ce84
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we make changes in the HMAC hash algorithm, will it be backward compatible with the existing password hash of the earlier deployments that are getting used with HMAC-SHA1?
@agrawalreetika
If we change the HMAC from SHA-1 to SHA-256, output hash will differ even for the same inputPassword and other input parameters. |
Thanks for confirming. |
Right, Password authentication for users who have hashed their passwords with SHA-1 will fail unless we migrate their existing hash to SHA-256. I am proposing below approach to migrate users with SHA-1 password to SHA-256 (1) Detecting the Hash Algorithm:
(2) Migration Logic:
@agrawalreetika please let me know if we implement above migration approach then will it break Password authentication? |
@adkharat For the solution that you are proposing for migration, what additional changes need to be done to the code? |
@anandamideShakyan , @agrawalreetika We will need to update method and class in : EncryptionUtil.java
Unknow to me is, What is the storage location where user password hash is stored? and how can I store back migrated hash? 1. Update method : doesPBKDF2PasswordMatch()
2. Add new method : migrateSHA1toSHA256()
3. Update class : PBKDF2Password
|
In my opinion, Presto shouldn't be responsible for migrating the password hashing. We can hear from others in the community about the options to handle this. |
141ce84
to
c777462
Compare
c777462
to
2f4ea64
Compare
f41432e
to
daea2ce
Compare
Thank @agrawalreetika . |
@adkharat Can you please add/update the documentation as well? |
@agrawalreetika Do you have any example to share on how to add documentation. |
I can help you get started with that, I hope. You will need to update an existing doc file, or create a new doc file, in Presto documentation is written in reStructuredText format. See the presto-docs README for information on how to locally build and view the doc to test. Add the doc change in your branch for this PR as a new commit. If you have other questions about the Presto documentation, please ask, and thank you in advance for the doc! |
@steveburnett @agrawalreetika I have added documentation. Can you please review it. |
Thanks for the release note entry! Just a couple of nits addressed in the draft below:
|
Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the documentation!
In general, documentation describes the current state of the software without too much emphasis on a change event. The phrasing of this doc feels like it fits a "news" topic, such as the Highlights section of the Release Notes for the upcoming release. (Note: when the release notes are written for the release this code change is included in, I believe it should be mentioned in the Highlights for the release as valuable information for Presto users.)
I suggest that you consider revising the text slightly for the tone I am describing. I’ve made a few suggestions, but based on this draft's quality I'll trust you to revise this documentation for a consistent tone if I miss something.
@adkharat Did you check the existing Password File Authentication document? Should it go in the same? cc: @steveburnett |
Thank you, @agrawalreetika! @adkharat, consider if your new topic can be added to the existing Password File Authentication documentation instead of a separate page. |
7786289
to
4292820
Compare
Thanks @steveburnett @agrawalreetika . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the revision using the existing doc page! A few minor edits and suggestions for you to consider.
08f55d2
to
e42e57e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick revision!
Pull updated branch, new local doc build, reviewed new local doc build, everything looks good.
...-password-authenticators/src/main/java/com/facebook/presto/password/file/EncryptionUtil.java
Show resolved
Hide resolved
db78e50
to
4f51da0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! (docs)
Pull updated branch, new local doc build, reviewed local build, looks good. Thanks!
fb9a851
Fallback to PBKDF2WithHmacSHA1 added depricated doc Update security documentation for Password validation Update security documentation for Password validation Update security documentation for Password validation fix remove colon Removed redundant statement reinstated malformed check Add pbkdff2 sha256 updated Duplicate User for pbkdf2
f7dfd28
to
811c58c
Compare
@tdcmeehan @agrawalreetika updated test cases. |
Description
CWE : 759
Using SHA-256 (256 bit) cipher for PBKDF2 while fallback option with SHA1 (160 bit) cipher
Motivation and Context
SHA-1 is no longer considered secure for modern cryptographic applications due to vulnerabilities that allow attackers to perform collision attacks or brute force the hash more efficiently. Security standards (e.g., NIST guidelines) recommend moving away from SHA-1 to SHA-256.
Impact
Release Notes