Repository navigation
feat(credentials): authenticate to Vault with the Kubernetes auth method - #3487
khrisrichardson wants to merge 3 commits into
Conversation
PR validation —
|
| Status | Policy | Material | Messages |
|---|---|---|---|
pr-min-approvals |
pr-info |
|
|
| ✅ Passed | pr-description-required |
pr-info |
- |
| ✅ Passed | pr-user-story-linked |
pr-info |
- |
AI Session Checks — ⏭️ bypassed by label
AI Coding Session Check Bypassed
This PR carries the skip-ai-session label, so the AI coding session check was bypassed.
Learn more about Chainloop Trace.
Security Checks — ✅ 7 passing
✅ AI Security Analysis
Nothing this change touches re-opens a recorded security fix.
View in Chainloop ↗ · How this works ↗
✅ secret-scan
| Status | Policy | Messages |
|---|---|---|
| ✅ Passed | secrets-detection |
- |
✅ sast-scan
| Status | Policy | Messages |
|---|---|---|
| ✅ Passed | owasp-top10-2025 |
- |
| ✅ Passed | sast |
- |
| ✅ Passed | cwe-top25 |
- |
| ✅ Passed | cwe-top26-40-cusp |
- |
✅ iac-scan
| Status | Policy | Messages |
|---|---|---|
| ✅ Passed | iac-misconfiguration |
- |
Scans not applied (2)
| Scan | Reason |
|---|---|
vulnerability-scan |
no manifest/lockfile changed |
github-actions-scan |
no workflow files changed |
Powered by Chainloop and Chainloop Trace
There was a problem hiding this comment.
All reported issues were addressed across 9 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
7f44807 to
6a9d1e6
Compare
|
Thank you for this contribution. Before we can merge it, please fix these items:
|
9920516 to
6b2bfa7
Compare
The Vault backend took only a static token (config.proto carried "TODO: Use application role auth instead"). A static token must be stored, and either never expires or has to be replaced by hand. Add an optional kubernetes_auth block (role, mount_path, token_path) as the alternative to token; exactly one of them is required. chainloop logs in with the pod's service account token, renews the resulting lease with Vault's lifetime watcher, and logs in again (re-reading the projected token, which the kubelet rotates) when renewal ends. Works with OpenBao, which serves the same auth API. The chart renders kubernetes_auth when secretsBackend.vault.kubernetesAuth.role is set, and still requires the token otherwise. Signed-off-by: Khris Richardson <khris.richardson@gmail.com> Assisted-by: Claude Code
…ken and kubernetes_auth The either/or rule was enforced only in vault.NewManager. A protovalidate message oneof states it in the schema, so an invalid configuration is rejected when it is validated, with the Go API unchanged (a proto oneof would have replaced the existing Token field). Signed-off-by: Khris Richardson <khris.richardson@gmail.com> Assisted-by: Claude Code
…faults, and start renewal only once the client is valid Review follow-ups on the Vault Kubernetes auth change: - The chart sets automountServiceAccountToken: false on controlplane and cas, so the kubelet's default token path does not exist in their pods and a login with the chart's defaults could not succeed. When kubernetesAuth is selected, both pods now get a projected service account token (1h expiry, optional audience) mounted at /var/run/secrets/chainloop/vault, and token_path defaults to it. Automount stays off. - The renewal goroutine started before client validation, so a failed validation left it running. It now starts only after validation succeeds, and keepLoggedIn takes a context that ends every wait. - Tests: a lease that ends is replaced by a login that re-reads the (rotated) token file, and the loop stops with its context; a manager that fails validation logs in once and starts no renewer. Signed-off-by: Khris Richardson <khris.richardson@gmail.com> Assisted-by: Claude Code
6b2bfa7 to
135977d
Compare
|
Thanks for the review. Rebased on main. All three commits are now signed, carry Checks run locally (container golang:1.27.3; chainloop main d4fc985 vs this branch): CI: the Actions workflows (Test, Lint, CodeQL) have never run on this PR. As a first-time contributor's fork PR they waited for approval and expired after 30 days. Could a maintainer approve the runs after this push? The integration tests (testcontainers: Vault, AWS, the credentials manager) only run there; we ran everything else locally. |
Part of #3488.
The Vault backend took only a static token. A static token has to be stored, and it either never expires or has to be
replaced by hand; the config already noted that role-based auth was the intended direction.
This adds an optional
kubernetes_authblock (role,mount_path,token_path) as the alternative totoken. Theschema requires exactly one of the two, as a protovalidate message oneof, so the Go API is unchanged.
How the login is kept alive:
Chart:
automountServiceAccountToken: false. WhenkubernetesAuth.roleis set, each gets aprojected service account token (1h expiry, optional
kubernetesAuth.audience) mounted at/var/run/secrets/chainloop/vault, andtoken_pathdefaults to it.token.This works with OpenBao, which serves the same auth API.
Chart version bumped to 1.493.1.
AI assistance: this PR was written with the help of Claude Code. Each commit carries an
Assisted-by: Claude Codetrailer.