-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: check if password file exists before running
pass
Currently, `pass-git-helper` doesn't check if a password file exists before running `pass`. This leads to authentication failures when the configured password store entry (aka `target`) points to a directory instead of a file. Example: $ tree -F .password-store .password-store/ └── git/ ├── github.com.gpg └── gitlab.com/ ├── user1.gpg └── user2.gpg If target is `git/gitlab.com`, `pass-git-helper` will get the following output from `pass git/gitlab/com`: git/gitlab.com ├── user1 └── user2 and will then use the first line (`git/gitlab/com`) as password. This commit introduces the following changes: 1. To fix the problem described above, `pass-git-helper` first determines the `pass` password store directory as: - the value of `password_store_dir` if defined in `git_pass_mapping.ini` (and non-empty) - the value of the environment variable `PASSWORD_STORE_DIR` if defined (and non-empty) - the default: `~/.password-store` (the latter two correspond to the implementation of `pass`). `pass-git-helper` will then check if an actual `<target>.gpg` is present in the selected directory (to be clear: only one of the three alternative directories gets checked). The new checks implemented in `pass-git-helper` detect two different error cases: 1. the scenario described above where `target` itself is a directory 2. a (rather obscure) scenario where `<target>.gpg` is a directory In both cases, `pass-git-helper` will now exit with an error after presenting the user with a (hopefully) useful error message. 2. The value of `password_store_dir` in the ini file may now contain a leading `~` (*tilde*) which will get replaced by the users *HOME* (or, on Windows, *USERPROFILE*) directory. The change is documented in README.md. 3. New tests for 1. and 2. Fixes #371
- Loading branch information
Showing
5 changed files
with
222 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Empty file.
Empty file.
This file contains 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