Skip to content

feat: allow provisioner password from env var or file - #365

Merged
maraino merged 2 commits into
masterfrom
feat/add-provisioner-password-sources
Jun 25, 2026
Merged

feat: allow provisioner password from env var or file#365
maraino merged 2 commits into
masterfrom
feat/add-provisioner-password-sources

Conversation

@joshdrake

Copy link
Copy Markdown
Contributor

Summary

Adds two optional, mutually-exclusive ways to supply the JWK provisioner password to a StepIssuer / StepClusterIssuer, alongside the existing Kubernetes Secret reference:

Field Reads from Use case
spec.provisioner.passwordRef (existing) a key in a Kubernetes Secret default
spec.provisioner.passwordEnv an environment variable in the controller pod password injected as an env var
spec.provisioner.passwordFile a file path in the controller pod password rendered to a file (e.g. a Vault Agent template)

Motivation

Requested by a user deploying step-issuer who manages secrets with HashiCorp Vault / Vault Agent and hasn't adopted Kubernetes Secrets. Previously the password could only come from a Secret read via the Kubernetes API, so there was no way to consume a password that Vault injects into the controller pod. passwordEnv / passwordFile read from the controller's own environment / filesystem, so they need no Secret and no extra RBAC.

Details

  • passwordRef is now optional; validation requires exactly one of the three sources (controllers/password.go: validateProvisionerPasswordSource).
  • Password resolution is factored into resolveProvisionerPassword and shared by both issuer controllers.
  • The source is configured per issuer (env var name / file path), so multiple issuers with distinct passwords are still supported.
  • A trailing newline is trimmed from the env/file sources (templating tools commonly add one); Secret data is used verbatim, so existing behavior is unchanged.
  • CRDs regenerated to expose the new fields; README documents the options with a Vault example.

Test plan

  • go build ./..., go vet ./..., gofmt
  • go test ./api/... ./controllers/... — new unit tests for resolution + validation
  • golangci-lint with the smallstep/workflows config — 0 issues
  • make generate — CRDs + deepcopy regenerate cleanly
  • Manual: deploy with a Vault-injected passwordFile / passwordEnv and confirm the issuer reaches Ready

🤖 Generated with Claude Code

The provisioner password could previously only be supplied through a
Kubernetes Secret referenced by spec.provisioner.passwordRef. Add two
optional, mutually-exclusive alternatives that read the password from the
step-issuer controller pod itself:

- passwordEnv:  name of an environment variable
- passwordFile: path to a file on the controller's filesystem

This lets the password be injected with tools like HashiCorp Vault / Vault
Agent without first storing it in a Kubernetes Secret, and needs no extra
RBAC. A trailing newline is trimmed from both sources. passwordRef is now
optional; validation requires exactly one of the three sources. Because the
env var name / file path is configured per issuer, multiple issuers with
distinct passwords remain supported.

Password resolution is factored into resolveProvisionerPassword and shared
by the StepIssuer and StepClusterIssuer controllers. Regenerated the CRDs to
expose the new fields, documented the options in the README, and added unit
tests for resolution and validation.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@CLAassistant

CLAassistant commented Jun 24, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ maraino
❌ joshdrake
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions Bot added the needs triage Waiting for discussion / prioritization by team label Jun 24, 2026
@joshdrake
joshdrake marked this pull request as ready for review June 24, 2026 16:33
@joshdrake
joshdrake requested review from a team and maraino as code owners June 24, 2026 16:33
maraino
maraino previously approved these changes Jun 24, 2026

@maraino maraino left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I've tested the 3 options and they work.

This commit fixes a couple of vulnerabilities reported by govulncheck
@maraino
maraino merged commit 733e5f6 into master Jun 25, 2026
11 of 12 checks passed
@maraino
maraino deleted the feat/add-provisioner-password-sources branch June 25, 2026 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs triage Waiting for discussion / prioritization by team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants