You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, as one can see bytes were changed during the traveling from k8s to the service.
Details
Tried to investigate a bit, and it looks like Micronaut uses new String(v.getValue()) here in KubernetesUtils.java, instead of passing byte[] as is. And this conversion to String actually changes byte-representation.
Removing this conversion actually fixes the issue, but requires more changes in core/*/AbstractInitializableBeanDefinition.java, where it does applicationContext.resolvePlaceholders(stringValue), which resolves to String, I think here would be better to resolve to Object and do any conversion later on.
In general I think it's better to pass configurations just as is (byte[]/Object) and do required conversion right before resolving for the service.
Will be happy to provide more details if needed.
I think this may also require enhancement request to micronaut-core.
Environment Information
gcr.io/distroless/java17
JDK17
Example Application
No response
Version
3.3.0
The text was updated successfully, but these errors were encountered:
dima-starosud
changed the title
Secrets with non-printable characters are not properly
Secrets with non-printable characters are corrupted on the app side
Feb 11, 2022
Expected Behavior
All k8s secrets are properly base64-decoded on application side.
Actual Behaviour
Some of the secrets (in particular
ZuD1WklPYQCr
) are corrupted when received by@Value
inside the service.Steps To Reproduce
byte[]
:Details
Tried to investigate a bit, and it looks like Micronaut uses
new String(v.getValue())
here in KubernetesUtils.java, instead of passingbyte[]
as is. And this conversion toString
actually changes byte-representation.Removing this conversion actually fixes the issue, but requires more changes in core/*/AbstractInitializableBeanDefinition.java, where it does
applicationContext.resolvePlaceholders(stringValue)
, which resolves toString
, I think here would be better to resolve to Object and do any conversion later on.In general I think it's better to pass configurations just as is (
byte[]
/Object
) and do required conversion right before resolving for the service.Will be happy to provide more details if needed.
I think this may also require enhancement request to
micronaut-core
.Environment Information
Example Application
No response
Version
3.3.0
The text was updated successfully, but these errors were encountered: