Skip to content

Commit 67b5c3e

Browse files
yehlorenovate[bot]
andauthored
fix(tenantresource): ensure original map is not modified in prepareAdditionalMetadata (#1572)
* fix(tenantresource): avoid side effects by copying metadata map instead of returning reference Signed-off-by: Joshua Leuenberger <[email protected]> * chore(deps): update github/codeql-action digest to 4474150 (#1569) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> chore(tenantresource): make linter happy Signed-off-by: Joshua Leuenberger <[email protected]> * chore(deps): update all-ci-updates (#1571) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update actions/checkout action to v5 (#1577) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency pre-commit/pre-commit-hooks to v6 (#1573) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update github/codeql-action digest to c6dcdfa (#1575) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --------- Signed-off-by: Joshua Leuenberger <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
1 parent 1f4fcce commit 67b5c3e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

controllers/resources/processor.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,13 @@ func prepareAdditionalMetadata(m map[string]string) map[string]string {
4040
return make(map[string]string)
4141
}
4242

43-
return m
43+
// we need to create a new map to avoid modifying the original one
44+
copied := make(map[string]string, len(m))
45+
for k, v := range m {
46+
copied[k] = v
47+
}
48+
49+
return copied
4450
}
4551

4652
func (r *Processor) HandlePruning(ctx context.Context, current, desired sets.Set[string]) (updateStatus bool) {

0 commit comments

Comments
 (0)