feat: support VS Code variables in path settings + fix age-plugin decryption via locale#86
Open
nightvisi0n wants to merge 1 commit into
Conversation
- Added support for VS Code variables in path settings (`sops.binPath`, `sops.configPath`, `sops.defaults.gcpCredentialsPath`, `sops.defaults.ageKeyFile`), allowing for dynamic path resolution. - Implemented a fallback to set a UTF-8 `LANG` locale for the `sops` subprocess when no locale is configured, addressing issues with age plugins. - Updated documentation and tests to reflect these changes.
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
Two robustness fixes for real-world setups (mise-managed binaries, hardware-backed age keys):
sopsprocess, which unbreaks age plugins (e.g.age-plugin-yubikey).Motivation
sops.binPathat a mise shim with"${workspaceFolder}/.vscode/mise-tools/sops"failed withspawnSync ${workspaceFolder}/.vscode/mise-tools/sops ENOENTas the extension passed the literal${workspaceFolder}tospawnSyncwithout substitution. VS Code does not auto-expand${...}in arbitrary extension settings.age-plugin-yubikeymight have failed for some users withage: yubikey plugin: failed to read line: EOFonly when the editor was launched from the GUI (Finder/Dock), while a manualsops -din a terminal worked with the same binary. Root cause: the plugin exits on startup when no locale is set, and GUI-launched editors inherit noLANG. A terminal does, hence the discrepancy.Changes
sops.binPath,sops.configPath,sops.defaults.gcpCredentialsPath, andsops.defaults.ageKeyFile. Supported:${workspaceFolder},${workspaceFolder:Name}(multi-root),${workspaceFolderBasename},${fileWorkspaceFolder},${userHome},${env:VAR},${pathSeparator}/${/}, and a leading~. Resolution is resource-aware (uses the workspace folder of the file being processed) and usesuri.fsPathfor correct OS paths. Existing relative-path handling is preserved; the.sopsrcabsolute-path check now usespath.isAbsolute(also fixes a latent Windows case).LANG/LC_ALL/LC_CTYPEare all unset, thesopssubprocess is givenLANG=en_US.UTF-8. An explicitly configured locale is always respected.Testing
applyVariableSubstitution(workspace/named/basename/env/~/edge cases) andlocaleEnvFallback(default applied, emptyLANGtreated as unset, explicitLANG/LC_ALL/LC_CTYPErespected).npm run compileandnpm run lintpass.${workspaceFolder}binPath resolves and decrypts via YubiKey when launched from the GUI.Compatibility
${...}/~. The locale fallback is a no-op when a locale is already set.