Description
Describe the bug
When rendering an invalid Secret, ArgoCD will leak the sensitive stringData in both the error message and diff view.
To Reproduce
To reproduce, create a simple secret with arbitrary values, and then set a value as an integer instead of a string. You will get an error like this (with sensitive and identifying info omitted):
one or more objects failed to apply, reason: "" is invalid: patch: Invalid value: patch: Invalid value: "map[ ....]" cannot convert int64 to string.
Additionally, the resource and app diffs will show unredacted stringData, regardless of whether the original Secret used data or stringData.
Expected behavior
The secret's data should be redacted during a failed sync of an invalid resource in the same way that a successfully synced Secret resource has its data redacted in the Argo UI.
Version
$ argocd version
argocd: v2.8.6+113b538
BuildDate: 2023-10-31T14:18:21Z
GitCommit: 113b53859dbf01cee7f1abac255cb112ad30bd8b
GitTreeState: clean
GoVersion: go1.20.10
Compiler: gc
Platform: linux/amd64