Skip to content

hcvault: SOPS_VAULT_TOKEN_FILE environment variable#2169

Draft
Dexmachi wants to merge 4 commits intogetsops:mainfrom
Dexmachi:feat/hcv-env
Draft

hcvault: SOPS_VAULT_TOKEN_FILE environment variable#2169
Dexmachi wants to merge 4 commits intogetsops:mainfrom
Dexmachi:feat/hcv-env

Conversation

@Dexmachi
Copy link
Copy Markdown

@Dexmachi Dexmachi commented May 3, 2026

closes #2168

Implements the SOPS_VAULT_TOKEN_FILE environment variable to decide which path to read the vault token from.

Details

  • If the env variable is set, SOPS will attempt to read only from the provided path, no fallbacks.

  • If the env variable is set and SOPS fails to read it, it returns an explicit error.

  • If the env variable is not set, it uses the current bahaviour, falling back to ~/.vault-token and returns no error if there is an error reading it.

  • Supports ephemerally bound files (e.g., FDs)

  • All automated tests passing

Dexmachi added 2 commits May 3, 2026 16:24
Signed-off-by: Caio Rocha de Oliveira <caiorocoli@gmail.com>
Signed-off-by: Caio Rocha de Oliveira <caiorocoli@gmail.com>
@felixfontein felixfontein changed the title feat(hcvault): SOPS_VAULT_TOKEN_FILE environment variable hcvault: SOPS_VAULT_TOKEN_FILE environment variable May 3, 2026
@felixfontein
Copy link
Copy Markdown
Contributor

This PR has the same problem that #2163 fixes for age: the file is read more than once, and thus it won't work with fifos etc.

@Dexmachi
Copy link
Copy Markdown
Author

Dexmachi commented May 3, 2026

This PR has the same problem that #2163 fixes for age: the file is read more than once, and thus it won't work with fifos etc.

To solve this issue without bringing changes from #2163, I had to essentially replicate the fix I made over there

I'd say against merging this PR until we decide how to go through with that PR in order to avoid duplicate logic. As such, I'll make this into a draft.

Signed-off-by: Caio Rocha de Oliveira <caiorocoli@gmail.com>
@Dexmachi Dexmachi marked this pull request as draft May 3, 2026 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FR: Hashicorp Vault Token File Environment Variable`

2 participants