Skip to content

Commit 916968f

Browse files
committed
add remarks
1 parent 2b94bb6 commit 916968f

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

pkg/manifests/helm/generator.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ func (g *HelmGenerator) Generate(ctx context.Context, namespace string, name str
297297
}(t.Name()),
298298
}
299299
var buf bytes.Buffer
300+
// TODO: templates (accidentally or intentionally) could modify data,e.g. by deep-copying things upfront
300301
if err := t0.ExecuteTemplate(&buf, t.Name(), data); err != nil {
301302
return nil, err
302303
}

pkg/manifests/kustomize/generator.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ func (g *KustomizeGenerator) Generate(ctx context.Context, namespace string, nam
191191
Funcs(funcMapForGenerateContext(serverInfo, component, namespace, name))
192192
}
193193
var buf bytes.Buffer
194+
// TODO: templates (accidentally or intentionally) could modify data, or even some of the objects supplied through builtin functions;
195+
// such as serverInfo or component; this should be hardened, e.g. by deep-copying things upfront, or serializing them; see the comment in
196+
// funcMapForGenerateContext()
194197
if err := t0.ExecuteTemplate(&buf, t.Name(), data); err != nil {
195198
return nil, err
196199
}

0 commit comments

Comments
 (0)