Ensure SHA256 is not used in tests#42289
Conversation
SHA256 was recently added to the Hasher class in order to be used in the TokenService. A few tests were still using values() to get the available algorithms from the Enum and it could happen that SHA256 would be picked up by these. This change adds an extra convenience method (Hasher#getAvailableAlgoCacheHash) and enures that only this and Hasher#getAvailableAlgoStoredHash are used for getting the list of available password hashing algorithms in our tests.
|
Pinging @elastic/es-security |
|
my two cents is that we should probably make values for hasher a forbidden API or just change Hasher so that it is not an enum. It seems like it would be too easy for this to pop back up. |
|
I contemplated other options too. I attempted to change this from an Enum when doing #31234 but circled back, not really sure what was the issue though. I also thought about moving the |
This is what I was thinking of. |
some tests are failing after the introduction of elastic#41792. relates elastic#42267 and elastic#42289.
|
fyi, I found another test that relates to this and muted two related tests in #42304 |
SHA256 was recently added to the Hasher class in order to be used in the TokenService. A few tests were still using values() to get the available algorithms from the Enum and it could happen that SHA256 would be picked up by these. This change adds an extra convenience method (Hasher#getAvailableAlgoCacheHash) and enures that only this and Hasher#getAvailableAlgoStoredHash are used for getting the list of available password hashing algorithms in our tests.
some tests are failing after the introduction of elastic#41792. relates elastic#42267 and elastic#42289.
SHA256 was recently added to the Hasher class in order to be used in the TokenService. A few tests were still using values() to get the available algorithms from the Enum and it could happen that SHA256 would be picked up by these. This change adds an extra convenience method (Hasher#getAvailableAlgoCacheHash) and enures that only this and Hasher#getAvailableAlgoStoredHash are used for getting the list of available password hashing algorithms in our tests.
SHA256 was recently added to the Hasher class in order to be used
in the TokenService. A few tests were still using values() to get
the available algorithms from the Enum and it could happen that
SHA256 would be picked up by these.
This change adds an extra convenience method
(Hasher#getAvailableAlgoCacheHash) and enures that only this and
Hasher#getAvailableAlgoStoredHash are used for getting the list of
available password hashing algorithms in our tests.
Resolves #42267