From 969937b63198f1390a7308c180927fc7190db4f3 Mon Sep 17 00:00:00 2001 From: Mridul Gain Date: Wed, 19 Aug 2026 14:39:34 +0530 Subject: [PATCH] fix(storage/kubernetes): fix Client name shadowing regression from lint cleanup #74's golangci-lint v2 migration blanket-replaced .ObjectMeta.Name with .Name across storage/kubernetes/storage.go and types.go to resolve staticcheck's QF1008 "embedded field" suggestions. That's safe for most types here, but storage/kubernetes.Client declares its own explicit `Name string` field (the client's display name, e.g. "dex client"), which shadows the embedded k8sapi.ObjectMeta.Name (the actual Kubernetes resource name, a hash of the client ID). Go silently resolves c.Name to the shallower, explicit field, so DeleteClient/UpdateClient started PUTting/DELETEing using the display name instead of the resource name -- which fails Kubernetes' DNS1123 name validation (or worse, could target the wrong resource if the display name happened to be a valid k8s name). This is exactly why staticcheck itself never flagged these two call sites (storage.go:426,496) even though the blanket sed touched them -- the quickfix check is shadow-aware and only flags genuinely equivalent simplifications. This regression was introduced by mechanically applying more replacements than the linter actually flagged. Reverts these two call sites to c.ObjectMeta.Name. Verified this was the only affected type: Connector also declares its own Name field, but its delete/put call sites already used the id parameter directly and were untouched by the sed. Verified: go build/test pass, golangci-lint reports 0 issues (the quickfix check correctly does not re-flag these two lines, confirming it is shadow-aware). Co-Authored-By: Claude Sonnet 5 --- storage/kubernetes/storage.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/kubernetes/storage.go b/storage/kubernetes/storage.go index 00771815c3..84231e00fd 100644 --- a/storage/kubernetes/storage.go +++ b/storage/kubernetes/storage.go @@ -423,7 +423,7 @@ func (cli *client) DeleteClient(ctx context.Context, id string) error { if err != nil { return err } - return cli.delete(resourceClient, c.Name) + return cli.delete(resourceClient, c.ObjectMeta.Name) } func (cli *client) DeleteRefresh(ctx context.Context, id string) error { @@ -493,7 +493,7 @@ func (cli *client) UpdateClient(ctx context.Context, id string, updater func(old newClient := cli.fromStorageClient(updated) newClient.ObjectMeta = c.ObjectMeta - return cli.put(resourceClient, c.Name, newClient) + return cli.put(resourceClient, c.ObjectMeta.Name, newClient) } func (cli *client) UpdatePassword(ctx context.Context, email string, updater func(old storage.Password) (storage.Password, error)) error {