Repository navigation
fix(bmc-discovery): Narrow the credential Role and check its namespace - #223
Conversation
Discovery reads credential Secrets only through its label-selected cache and the --once list, so the Role's get verb was never used. Drop it and pin the Role with a manifest test and an envtest that runs the real Secret cache and --once list under the shipped Role, and checks that a get by name and another namespace are refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RBAC cannot narrow discovery's Secret Role to the labelled credential Secrets, so any Secret in its namespace is readable by discovery. Render every Kustomize entry point under config/ and fail when a Secret without the credential label and Device annotations lands in a namespace that holds discovery, a credential Secret, or the new credential-namespace label, which the site's Redfish credential namespace now carries. A namespace found in any root is checked in every root, and discovery's own Milo kubeconfig is admitted only beside discovery. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Record why the Secret Role stays namespace-wide, what the render check enforces, and how a sidecar deployment keeps its credential namespace separate from the host pod's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ecv
left a comment
There was a problem hiding this comment.
Approve.
Discovery's Role drops get on Secrets, and every read path already goes through list and watch: the label-selected cache in credentialCluster and the one-shot SecretList for --once. TestShippedRoleServesTheCredentialCacheAndRefusesGet runs both under the shipped Role and asserts that a read by name and a list in another namespace are Forbidden. The new validator renders every Kustomize entry point, treats a namespace as a credential namespace if it is labelled, holds discovery's Role or ServiceAccount, or holds a labelled credential, and fails on any Secret there that is not a credential naming a Device, apart from discovery's own Milo kubeconfig. It also fails when no entry point renders a credential namespace, so it cannot pass vacuously.
- Dropping
getnarrows little on its own:liststill returns every Secret's data in the namespace, as the updated Role comment and guide say. The guard is keeping the namespace credential-only, and the validator checks that only for renders in this repo. A deploying repository needs to run it against its own overlays, or one stray Secret there is readable by discovery.
Follow-ups:
- Ship the validator so a deploying repository can run it against its own config root, for example as a released binary or a documented
go runagainst a pinned tag, and say so in the guide.
Related to #182, as a follow-up to its review.
BMC discovery could read every Secret in its namespace, and RBAC can't limit it to the labelled credentials. Discovery now has list and watch only, and CI fails when any other Secret lands in a credential namespace.
The discovery guide says why the Role stays namespace-wide.
Test plan
Decisions for a person
🤖 Generated with Claude Code