spring-cloud-commons icon indicating copy to clipboard operation
spring-cloud-commons copied to clipboard

Properties decryption not working correctly when they are on a list (yaml)

Open FuRi0n opened this issue 2 years ago • 5 comments

When we have properties on a list that are encrypted and we overwrite them on another profile they will keep their initial value and ignore other profiles. This happens even to other properties but if we add them also ciphered on the other profiles then it will work correctly. I have a sample application to reproduce the issue: https://github.com/FuRi0n/decrypt

In the sample, with this yml file:

application:
  list:
    - plain: good
      cipher: '{cipher}4ffef96df11b9e9ca7b33aa5ccd60b6ed8406ec5edb68618b2469208fceb2626'

---

application:
  list:
    - plain: updated
      cipher: 'updated'
spring:
  config:
    activate:
      on-profile: decrypt

When running 'decrypt' profile it will print on console plain='good' and cipher='bad' but, if we update the 'cipher' value on 'decrypt' profile to be also encrypted then we will get plain='updated' and cipher='updated'

The expected behaviour is that properties in the profile with higher priority must overwrite other profiles even if those properties values are not encrypted.

FuRi0n avatar Jul 07 '23 07:07 FuRi0n