[MeshSync] MESHSYNC_REDACT_SECRETS leaves Secret values in the last-applied-configuration annotation
Current Behavior
With MESHSYNC_REDACT_SECRETS=true, ParseList (pkg/model/model_converter.go) replaces a Secret's data, stringData and binaryData values with [REDACTED]. Its annotations are published unchanged.
kubectl apply (and kubectl create ... --save-config) stores the whole applied manifest in the kubectl.kubernetes.io/last-applied-configuration annotation. For a Secret that manifest contains the same data and binaryData values, and stringData in plain text. So with redaction on, the values still leave the cluster in the annotation, and Meshery Server stores them with the other annotations.
Expected Behavior
When redaction is on, the Secret values inside last-applied-configuration are redacted the same way (keys kept, values replaced), so the opt-in actually keeps Secret values from being published. Other annotations, other kinds, and the default (redaction off) stay unchanged.
Screenshots/Logs
A unit test against master (Secret with the annotation, redaction on) fails with:
last-applied-configuration still contains Secret value "cGFzc3dvcmQ=" (and the same for the stringData value plaintext-token).
To Reproduce
- Run MeshSync with
MESHSYNC_REDACT_SECRETS=true. kubectl create secret generic db-creds --from-literal=password=hunter2 --dry-run=client -o yaml | kubectl apply -f -- Look at the published Secret:
data.passwordis[REDACTED], butmetadata.annotations["kubectl.kubernetes.io/last-applied-configuration"]still has"password":"aHVudGVyMg==".
Environment
- meshsync master @ 39bbd51 (redaction added in #574)