fix: transmit data from spring cloud config server controller to getEncryptor#2253
Conversation
ryanjbaxter
left a comment
There was a problem hiding this comment.
Could you please add tests?
| public String encrypt(@PathVariable String name, @PathVariable String profiles, @RequestBody String data, | ||
| @RequestHeader("Content-Type") MediaType type) { | ||
| TextEncryptor encryptor = getEncryptor(name, profiles, ""); | ||
| TextEncryptor encryptor = getEncryptor(name, profiles, data); |
There was a problem hiding this comment.
Shouldn't we be passing input instead? Thats what the original code used
There was a problem hiding this comment.
done in commit e7669e1 and use retrieved encryptor to encrypt message here https://github.com/spring-cloud/spring-cloud-config/pull/2253/files#diff-f18a83930fb437413479ed50adc18dedbf115b37e560d8481185a796c24444d8R111
| public String decrypt(@PathVariable String name, @PathVariable String profiles, @RequestBody String data, | ||
| @RequestHeader("Content-Type") MediaType type) { | ||
| TextEncryptor encryptor = getEncryptor(name, profiles, ""); | ||
| TextEncryptor encryptor = getEncryptor(name, profiles, data); |
There was a problem hiding this comment.
We don't even need this line, encryptor is not used in the catch block so we can just move the variable definition into the try block which already passes data.
|
Ping @RouxAntoine see feedback |
hello, sorry for delay not so many time on my part, I take a look |
f1ee7fb to
e7669e1
Compare
|
I just added two assert in a existing test. To check the key in encryptorLocator |
attention point to methods
https://github.com/spring-cloud/spring-cloud-config/blob/main/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/encryption/EncryptionController.java#L93
https://github.com/spring-cloud/spring-cloud-config/blob/main/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/encryption/EncryptionController.java#L84
which always have same bug but could not be properly fixed due to missing data in Get request
Fixes gh-2252