spring-cloud / spring-cloud/spring-cloud-commons
Spring Cloud Bootstrap not properly decrypting ENV
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 751
- Forks
- 744
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 9
Description
Describe the bug
Spring Cloud Bootstrap is not properly decryping an environment variable if it is written with _ (as it should be) instead of . (not recommended).
During runtime it then appears to be still encrypted and with the {cipher}-prefix.
For example:
If i have an environment variable named CONFIGPROPS_VAR2ENCRYPTED and Autowire a related @ConfigurationProperties-Bean -> it's still encrypted :(
If i have an environment variable named CONFIGPROPS.VAR3ENCRYPTED and Autowire a related @ConfigurationProperties-Bean -> it's decrypted :o
Sample
I made a minimum sample project that shows this bug: https://github.com/mdlck/spring-cloud-bug
Just start the JUnit-Test with the ENV-Variables from the README.md.
From my point of view, it should not fail, but it does. :/
Spring Boot Version: 2.7.6
Spring Cloud Version: 2021.0.5
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked minimum sample project and its README.md, then run the JUnit test using the documented environment variables to reproduce the difference between underscore and dot names. Trace Spring Cloud Bootstrap's environment-variable handling and add a regression test showing that the underscore form is decrypted without the {cipher} prefix; done means both forms produce the decrypted @ConfigurationProperties value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100