Skip to content

Commit

Permalink
add remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
cbarbian-sap committed Mar 3, 2024
1 parent 2b94bb6 commit 916968f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/manifests/helm/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ func (g *HelmGenerator) Generate(ctx context.Context, namespace string, name str
}(t.Name()),
}
var buf bytes.Buffer
// TODO: templates (accidentally or intentionally) could modify data,e.g. by deep-copying things upfront
if err := t0.ExecuteTemplate(&buf, t.Name(), data); err != nil {
return nil, err
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/manifests/kustomize/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ func (g *KustomizeGenerator) Generate(ctx context.Context, namespace string, nam
Funcs(funcMapForGenerateContext(serverInfo, component, namespace, name))
}
var buf bytes.Buffer
// TODO: templates (accidentally or intentionally) could modify data, or even some of the objects supplied through builtin functions;
// such as serverInfo or component; this should be hardened, e.g. by deep-copying things upfront, or serializing them; see the comment in
// funcMapForGenerateContext()
if err := t0.ExecuteTemplate(&buf, t.Name(), data); err != nil {
return nil, err
}
Expand Down

0 comments on commit 916968f

Please sign in to comment.