-
Notifications
You must be signed in to change notification settings - Fork 69
Open
Labels
bugVerified defect in functionalityVerified defect in functionalitynewNew issue that has not been worked on yetNew issue that has not been worked on yet
Description
During implementation of #4408 was found an issue with initialization of salt:
Lines 154 to 166 in 344f6ff
| private String initializeSalt() throws CachingServiceClientException, SecureTokenInitializationException { | |
| String localSalt; | |
| try { | |
| CachingServiceClient.KeyValue keyValue = cachingServiceClient.read("salt"); | |
| localSalt = keyValue.getValue(); | |
| } catch (CachingServiceClientException | StorageException e) { | |
| byte[] newSalt = generateSalt(); | |
| storeSalt(newSalt); | |
| localSalt = new String(newSalt); | |
| } | |
| return localSalt; | |
| } |
There are two potential issues:
- if clusters are not in sync, multiple salt could be generated
- if two or more threads trying to initialize salt at the moment one has to fail.
It should be solved by using lock, but in this case the lock should be available through HTTP.
The best solution should be:
- try to read the salt
- if salt does not exist
- create a lock
- read salt
- if salt still doesn't exist create a new one
- unlock
Metadata
Metadata
Assignees
Labels
bugVerified defect in functionalityVerified defect in functionalitynewNew issue that has not been worked on yetNew issue that has not been worked on yet
Type
Projects
Status
New