A packaged deployment template ran user-supplied annotations through a helper that evaluates expressions. Feed it an expression and it can read secrets elsewhere in the release or query the cluster.
What goes wrong
Annotations are supposed to be inert metadata, strings you attach to a deployed object. In this chart they get routed through a helper that renders template expressions. The moment untrusted input reaches that helper, the annotation stops being data and becomes an expression the renderer will execute.
Template expressions here run with the surrounding rendering context, and that context reaches more than the current field. It can read other values defined in the release, secrets among them, and in some setups it can look up live objects in the cluster. Someone who controls the annotation writes an expression that copies a secret into a rendered field, or enumerates resources the rendering identity is allowed to see. The reach is the whole release, not the one annotation they touched.
Keep template evaluation off anything a caller can set. Values that come from users or downstream overrides should be emitted as literal strings. If operator-authored values genuinely need templating, keep that path separate from the caller-controlled one.
The pattern
# helper re-renders whatever it receives
define "render":
return evalTemplate(value, context) # runs the input
metadata:
annotations:
render(userValues.annotations) # user-controlled# emit caller-supplied values as literal strings
metadata:
annotations:
for key, val in userValues.annotations:
emit(key + ": " + quote(val)) # never evalTemplateGrounding and reachability were confirmed. The exploit-path gate would not conclude without the calling code, so the finding was held and an evidence request was raised instead of being reported as fact.
Why it matters to you
Charts rarely stay in one team's hands. Yours might be installed by a platform team, then handed to an app team that supplies its own values, and any of them can reach a field that gets re-rendered. Server-side template evaluation on untrusted input is remote code execution's quieter cousin, and it earns the same suspicion.
Check your own code
- Find every place your templates evaluate a value as an expression and check what feeds it.
- Never run template evaluation on values a chart consumer or user can set.
- Emit caller-supplied annotations and labels as quoted literals.