providers/filesystem: honor SIGSTORE_OIDC_TOKEN_FILE env var#4934
Open
dustinkirkland wants to merge 1 commit into
Open
providers/filesystem: honor SIGSTORE_OIDC_TOKEN_FILE env var#4934dustinkirkland wants to merge 1 commit into
dustinkirkland wants to merge 1 commit into
Conversation
The filesystem token provider currently reads from a hardcoded path (/var/run/sigstore/cosign/oidc-token). On container/Kubernetes workloads that's fine — the orchestrator bind-mounts the path at startup. On desktop or developer workstations, however, using this provider requires a one-time 'sudo mkdir -p /var/run/sigstore/cosign && sudo chown $USER' setup before anything writable can land there. This change lets SIGSTORE_OIDC_TOKEN_FILE override the default path with any user-writable location (e.g. ~/.sigstore/token), so the provider can be used unprivileged on dev machines. Behavior is unchanged when the env var is unset — the historical hardcoded path is still the default. Signed-off-by: Dustin Kirkland <dustin.kirkland@chainguard.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The filesystem token provider currently reads from a hardcoded path (
/var/run/sigstore/cosign/oidc-token). On container / Kubernetes workloads that's fine — the orchestrator bind-mounts the path at pod startup. On desktop or developer workstations, however, using this provider requires a one-timesudo mkdir -p /var/run/sigstore/cosign && sudo chown \$USERsetup before anything writable can land there. That sudo step is the only privileged moment in an otherwise unprivileged "headless signing" workflow.This PR lets
SIGSTORE_OIDC_TOKEN_FILEoverride the default path with any user-writable location (e.g.~/.sigstore/token), so the provider can be used unprivileged on dev machines. Behavior is unchanged when the env var is unset — the historical hardcoded path remains the default.Why this matters
I'm prototyping a fully-headless gitsign signing flow against the public Fulcio for SSH-only dev workflows (where opening a graphical browser on the dev host is the original UX pain point — see https://github.com/sigstore/sigstore/blob/main/pkg/oauthflow/device.go). The flow:
works end-to-end today with one wart: every user has to run
sudo mkdiron every dev machine before they can write the token file. This PR removes that wart.Tests
Three new tests cover the default path, env-var override, and Provide() reading from the env-var-pointed location. No existing tests changed.
Backward compatibility
Strictly additive. The new env var is opt-in; every existing caller that doesn't set it sees the previous behavior.
🤖 Generated with Claude Code