Skip to content

fix: transmit data from spring cloud config server controller to getEncryptor#2253

Merged
ryanjbaxter merged 1 commit intospring-cloud:mainfrom
RouxAntoine:fix/2252-getencryptor-custom-keys
May 5, 2023
Merged

fix: transmit data from spring cloud config server controller to getEncryptor#2253
ryanjbaxter merged 1 commit intospring-cloud:mainfrom
RouxAntoine:fix/2252-getencryptor-custom-keys

Conversation

Copy link
Copy Markdown
Contributor

@ryanjbaxter ryanjbaxter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we be passing input instead? Thats what the original code used

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in commit e7669e1

@ryanjbaxter
Copy link
Copy Markdown
Contributor

Ping @RouxAntoine see feedback

@RouxAntoine
Copy link
Copy Markdown
Contributor Author

RouxAntoine commented May 4, 2023

Ping @RouxAntoine see feedback

hello, sorry for delay not so many time on my part, I take a look

@RouxAntoine RouxAntoine force-pushed the fix/2252-getencryptor-custom-keys branch from f1ee7fb to e7669e1 Compare May 4, 2023 22:11
@RouxAntoine
Copy link
Copy Markdown
Contributor Author

I just added two assert in a existing test. To check the key in encryptorLocator

@ryanjbaxter ryanjbaxter merged commit 66724a9 into spring-cloud:main May 5, 2023
@RouxAntoine RouxAntoine deleted the fix/2252-getencryptor-custom-keys branch May 5, 2023 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

encrypt and decrypt endpoint lost data for encryptor retrievement

3 participants