├── .github ├── dependabot.yml └── workflows │ ├── autorelease.yml │ ├── build.yml │ ├── codeql-analysis.yml │ └── golangci-lint.yml ├── .gitignore ├── .golangci.yml ├── .goreleaser.yml ├── CHANGELOG.md ├── LICENSE ├── Makefile ├── README.md ├── VERSION ├── go.mod ├── go.sum ├── helpers └── changelog │ └── main.go ├── main.go ├── summon-provider.go ├── summon-provider_test.go └── version.go /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | interval: "weekly" 8 | open-pull-requests-limit: 5 9 | -------------------------------------------------------------------------------- /.github/workflows/autorelease.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | 3 | name: release gopass summon provider 4 | 5 | # Controls when the action will run. 6 | on: 7 | # Triggers the workflow on tags starting with v, i.e. release tags 8 | push: 9 | tags: 10 | - 'v*' 11 | 12 | jobs: 13 | goreleaser: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - name: Harden Runner 17 | uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1 18 | with: 19 | egress-policy: audit 20 | 21 | - 22 | name: Checkout 23 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 24 | with: 25 | fetch-depth: 0 26 | - 27 | name: Set up Go 28 | uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 29 | with: 30 | go-version: '1.24' 31 | - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 32 | with: 33 | path: ~/go/pkg/mod 34 | key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} 35 | restore-keys: | 36 | ${{ runner.os }}-go- 37 | - uses: sigstore/cosign-installer@d7d6bc7722e3daa8354c50bcb52f4837da5e9b6a # v3.8.1 38 | - uses: anchore/sbom-action/download-syft@f325610c9f50a54015d37c8d16cb3b0e2c8f4de0 # v0.18.0 39 | - 40 | name: Import GPG signing key 41 | id: import_gpg 42 | uses: crazy-max/ghaction-import-gpg@v6 43 | with: 44 | gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} 45 | passphrase: ${{ secrets.PASSPHRASE }} 46 | - 47 | name: Debug 48 | run: | 49 | echo "GPG ---------------------" 50 | echo "fingerprint: ${{ steps.import_gpg.outputs.fingerprint }}" 51 | echo "keyid: ${{ steps.import_gpg.outputs.keyid }}" 52 | echo "name: ${{ steps.import_gpg.outputs.name }}" 53 | echo "email: ${{ steps.import_gpg.outputs.email }}" 54 | echo "Go env ------------------" 55 | pwd 56 | echo ${HOME} 57 | echo ${GITHUB_WORKSPACE} 58 | echo ${GOPATH} 59 | echo ${GOROOT} 60 | env 61 | - 62 | name: Generate release-notes 63 | run: | 64 | go run helpers/changelog/main.go >../RELEASE_NOTES 65 | - 66 | name: Run GoReleaser 67 | uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0 68 | with: 69 | version: latest 70 | args: release --release-notes=../RELEASE_NOTES 71 | env: 72 | GITHUB_TOKEN: ${{ secrets.GH_PAT }} 73 | GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} 74 | GOPATH: /home/runner/go 75 | - 76 | name: "Upload deb files to apt hosting" 77 | run: | 78 | for D in dist/*.deb; do 79 | curl -H"X-Filename: ${D}" -H"X-Apikey: ${APIKEY}" -XPOST --data-binary @$D https://packages.gopass.pw/repos/gopass/upload 80 | curl -H"X-Filename: ${D}" -H"X-Apikey: ${APIKEY}" -XPOST --data-binary @$D https://packages.gopass.pw/repos/gopass-unstable/upload 81 | done 82 | env: 83 | APIKEY: ${{ secrets.APT_APIKEY }} -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build gopass-summon-provider 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | 11 | linux: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Harden Runner 15 | uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1 16 | with: 17 | egress-policy: block 18 | allowed-endpoints: > 19 | github.com:443 20 | objects.githubusercontent.com:443 21 | proxy.golang.org:443 22 | raw.githubusercontent.com:443 23 | storage.googleapis.com:443 24 | sum.golang.org:443 25 | golang.org:443 26 | go.dev:443 27 | azure.archive.ubuntu.com:443 28 | archive.ubuntu.com:443 29 | security.ubuntu.com:443 30 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 31 | with: 32 | fetch-depth: 0 33 | 34 | - name: Set up Go 35 | uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 36 | with: 37 | go-version: '1.24' 38 | - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 39 | with: 40 | path: ~/go/pkg/mod 41 | key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} 42 | restore-keys: | 43 | ${{ runner.os }}-go- 44 | - name: Ubuntu Dependencies 45 | run: sudo apt-get install --yes git gnupg 46 | - run: git config --global user.name nobody 47 | - run: git config --global user.email foo.bar@example.org 48 | 49 | 50 | - 51 | name: Debug 52 | run: | 53 | echo "Go env ------------------" 54 | pwd 55 | echo ${HOME} 56 | echo ${GITHUB_WORKSPACE} 57 | echo ${GOPATH} 58 | echo ${GOROOT} 59 | env 60 | 61 | - name: Build and Unit Test 62 | run: make gha-linux 63 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ master ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ master ] 20 | schedule: 21 | - cron: '19 21 * * 0' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | 28 | strategy: 29 | fail-fast: false 30 | matrix: 31 | language: [ 'go' ] 32 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] 33 | # Learn more: 34 | # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed 35 | 36 | steps: 37 | - name: Checkout repository 38 | uses: actions/checkout@v4 39 | 40 | # Initializes the CodeQL tools for scanning. 41 | - name: Initialize CodeQL 42 | uses: github/codeql-action/init@v2 43 | with: 44 | languages: ${{ matrix.language }} 45 | # If you wish to specify custom queries, you can do so here or in a config file. 46 | # By default, queries listed here will override any specified in a config file. 47 | # Prefix the list here with "+" to use these queries and those in the config file. 48 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 49 | 50 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 51 | # If this step fails, then you should remove it and run the build manually (see below) 52 | - name: Autobuild 53 | uses: github/codeql-action/autobuild@v2 54 | 55 | # ℹ️ Command-line programs to run using the OS shell. 56 | # 📚 https://git.io/JvXDl 57 | 58 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 59 | # and modify them (or add more) to build your code if your project 60 | # uses a compiled language 61 | 62 | #- run: | 63 | # make bootstrap 64 | # make release 65 | 66 | - name: Perform CodeQL Analysis 67 | uses: github/codeql-action/analyze@v2 68 | -------------------------------------------------------------------------------- /.github/workflows/golangci-lint.yml: -------------------------------------------------------------------------------- 1 | name: golangci-lint 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | permissions: 10 | contents: read 11 | pull-requests: read 12 | 13 | jobs: 14 | golangci: 15 | name: lint 16 | runs-on: ubuntu-latest 17 | steps: 18 | - name: Harden Runner 19 | uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1 20 | with: 21 | disable-sudo: true 22 | egress-policy: block 23 | allowed-endpoints: > 24 | api.github.com:443 25 | github.com:443 26 | golangci-lint.run:443 27 | objects.githubusercontent.com:443 28 | proxy.golang.org:443 29 | raw.githubusercontent.com:443 30 | storage.googleapis.com:443 31 | sum.golang.org:443 32 | 33 | - name: Set up Go 34 | uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 35 | with: 36 | go-version: '1.24' 37 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 38 | - name: golangci-lint 39 | uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0 40 | with: 41 | version: v2.1.1 # we have a list of linters in our .golangci.yml config file 42 | only-new-issues: true 43 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | # Test binary, built with `go test -c` 9 | *.test 10 | 11 | # Output of the go coverage tool, specifically when used with LiteIDE 12 | *.out 13 | 14 | # Dependency directories (remove the comment below to include it) 15 | # vendor/ 16 | 17 | gopass-summon-provider* 18 | dist/ 19 | 20 | -------------------------------------------------------------------------------- /.golangci.yml: -------------------------------------------------------------------------------- 1 | version: "2" 2 | run: 3 | go: "1.24" 4 | output: 5 | sort-order: 6 | - linter 7 | - file 8 | linters: 9 | enable: 10 | - asasalint 11 | - asciicheck 12 | - bidichk 13 | - bodyclose 14 | - containedctx 15 | - copyloopvar 16 | - cyclop 17 | - decorder 18 | - dogsled 19 | - errchkjson 20 | - errname 21 | - errorlint 22 | - exhaustive 23 | - forcetypeassert 24 | - funlen 25 | - ginkgolinter 26 | - gocheckcompilerdirectives 27 | - gochecksumtype 28 | - godot 29 | - goheader 30 | - gomoddirectives 31 | - gomodguard 32 | - goprintffuncname 33 | - gosmopolitan 34 | - grouper 35 | - importas 36 | - intrange 37 | - loggercheck 38 | - makezero 39 | - mirror 40 | - misspell 41 | - nakedret 42 | - nestif 43 | - nilnil 44 | - nlreturn 45 | - nonamedreturns 46 | - nosprintfhostport 47 | - prealloc 48 | - predeclared 49 | - promlinter 50 | - protogetter 51 | - reassign 52 | - sloglint 53 | - spancheck 54 | - tagalign 55 | - testableexamples 56 | - testifylint 57 | - thelper 58 | - unconvert 59 | - usestdlibvars 60 | - usetesting 61 | - whitespace 62 | - zerologlint 63 | settings: 64 | cyclop: 65 | max-complexity: 22 66 | errcheck: 67 | exclude-functions: 68 | - fmt.Fprint 69 | - fmt.Fprintf 70 | - fmt.Fprintln 71 | funlen: 72 | lines: -1 73 | statements: 100 74 | gocyclo: 75 | min-complexity: 22 76 | staticcheck: 77 | checks: 78 | - all 79 | - -SA1019 80 | - -ST1000 81 | exclusions: 82 | generated: lax 83 | rules: 84 | - linters: 85 | - cyclop 86 | path: (.+)_test\.go 87 | paths: 88 | - helpers/ 89 | - third_party$ 90 | - builtin$ 91 | - examples$ 92 | issues: 93 | max-issues-per-linter: 0 94 | max-same-issues: 0 95 | formatters: 96 | enable: 97 | - gofmt 98 | - gofumpt 99 | - goimports 100 | exclusions: 101 | generated: lax 102 | paths: 103 | - helpers/ 104 | - third_party$ 105 | - builtin$ 106 | - examples$ 107 | -------------------------------------------------------------------------------- /.goreleaser.yml: -------------------------------------------------------------------------------- 1 | # goreleaser.yml 2 | # Release automation 3 | # 4 | # Build customization 5 | project_name: gopass-summon-provider 6 | version: 2 7 | 8 | before: 9 | hooks: 10 | - make clean 11 | - make completion 12 | - go mod download 13 | 14 | builds: 15 | - id: gopass-summon-provider 16 | binary: gopass-summon-provider 17 | flags: 18 | - -trimpath 19 | - -tags=netgo 20 | env: 21 | - CGO_ENABLED=0 22 | asmflags: 23 | - all=-trimpath={{.Env.GOPATH}} 24 | gcflags: 25 | - all=-trimpath={{.Env.GOPATH}} 26 | ldflags: | 27 | -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.CommitDate}} -extldflags '-static' 28 | goos: 29 | - darwin 30 | - freebsd 31 | - linux 32 | - openbsd 33 | - windows 34 | goarch: 35 | - amd64 36 | - arm 37 | - arm64 38 | goarm: 39 | - 6 40 | - 7 41 | mod_timestamp: '{{ .CommitTimestamp }}' 42 | archives: 43 | - id: gopass-summon-provider 44 | name_template: "{{.Binary}}-{{.Version}}-{{.Os}}-{{.Arch}}{{ if .Arm }}v{{.Arm }}{{ end }}" 45 | formats: ['tar.gz'] 46 | format_overrides: 47 | - goos: windows 48 | formats: ['zip'] 49 | files: 50 | - CHANGELOG.md 51 | - LICENSE 52 | - README.md 53 | 54 | release: 55 | github: 56 | owner: gopasspw 57 | name: gopass-summon-provider 58 | draft: false 59 | prerelease: auto 60 | 61 | nfpms: 62 | - id: gopass-summon-provider 63 | vendor: Gopass Authors 64 | homepage: "https://www.gopass.pw" 65 | maintainer: "Gopass Authors " 66 | description: |- 67 | gopass password manager - full featured CLI replacement for pass, designed for teams. 68 | . 69 | gopass is a simple but powerful password manager for your terminal. It is a 70 | Pass implementation in Go that can be used as a drop in replacement. 71 | . 72 | Every secret lives inside of a gpg (or: age) encrypted textfile. These secrets 73 | can be organized into meaninful hierachies and are by default versioned using 74 | git. 75 | . 76 | This package contains the summon provider. 77 | license: MIT 78 | formats: 79 | - deb 80 | - rpm 81 | dependencies: 82 | - git 83 | - gnupg2 84 | recommends: 85 | - rng-tools 86 | source: 87 | enabled: true 88 | name_template: "{{.ProjectName}}-{{.Version}}" 89 | 90 | checksum: 91 | name_template: "{{.ProjectName}}_{{.Version}}_SHA256SUMS" 92 | 93 | milestones: 94 | - 95 | repo: 96 | owner: gopasspw 97 | name: gopass-summon-provider 98 | close: true 99 | fail_on_error: false 100 | name_template: "{{ .Major }}.{{ .Minor }}.{{ .Patch }}" 101 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.15.16 2 | 3 | - Bump dependencies to gopass release v1.15.16 4 | 5 | ## 1.15.15 6 | 7 | - Bump dependencies to gopass release v1.15.15 8 | 9 | ## 1.15.14 10 | 11 | - Bump dependencies to gopass release v1.15.14 12 | 13 | ## 1.15.13 14 | 15 | - Bump dependencies to gopass release v1.15.13 16 | 17 | ## 1.15.12 18 | 19 | - Bump dependencies to gopass release v1.15.12 20 | 21 | ## 1.15.11 22 | 23 | - Bump dependencies to gopass release v1.15.11 24 | 25 | ## 1.15.10 26 | 27 | - Bump dependencies to gopass release v1.15.10 28 | 29 | ## 1.15.9 30 | 31 | - Bump dependencies to gopass release v1.15.9 32 | 33 | ## 1.15.9 34 | 35 | - Bump dependencies to gopass release v1.15.9 36 | 37 | ## 1.15.9 38 | 39 | - Bump dependencies to gopass release v1.15.9 40 | 41 | ## 1.15.8 42 | 43 | - Bump dependencies to gopass release v1.15.8 44 | 45 | ## 1.15.7 46 | 47 | - Bump dependencies to gopass release v1.15.7 48 | 49 | ## 1.15.6 50 | 51 | - Bump dependencies to gopass release v1.15.6 52 | 53 | ## 1.15.6 54 | 55 | - Bump dependencies to gopass release v1.15.6 56 | 57 | ## 1.15.5 58 | 59 | - Bump dependencies to gopass release v1.15.5 60 | 61 | ## 1.15.5 62 | 63 | - Bump dependencies to gopass release v1.15.5 64 | 65 | ## 1.15.4 66 | 67 | - Bump dependencies to gopass release v1.15.4 68 | 69 | ## 1.15.3 70 | 71 | - Bump dependencies to gopass release v1.15.3 72 | 73 | ## 1.15.2 74 | - Bump dependencies to gopass release v1.15.2 75 | 76 | ## 1.14.5 77 | 78 | Bump dependencies 79 | 80 | ## 1.12.0 81 | 82 | Sync with gopass 1.12.0. 83 | 84 | ## 0.0.1 85 | 86 | Initial release. 87 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Gopass 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | FIRST_GOPATH := $(firstword $(subst :, ,$(GOPATH))) 2 | PKGS := $(shell go list ./... | grep -v /tests | grep -v /xcpb | grep -v /gpb) 3 | PKGSWIN := $(shell go list ./... | grep -v /tests | grep -v /xcpb | grep -v /gpb | grep -v "jsonapi") 4 | GOFILES_NOVENDOR := $(shell find . -name vendor -prune -o -type f -name '*.go' -not -name '*.pb.go' -print) 5 | GOFILES_BUILD := $(shell find . -type f -name '*.go' -not -name '*_test.go') 6 | PROTOFILES := $(shell find . -name vendor -prune -o -type f -name '*.proto' -print) 7 | GOPASS_VERSION ?= $(shell cat VERSION) 8 | GOPASS_OUTPUT ?= gopass-summon-provider 9 | GOPASS_REVISION := $(shell cat COMMIT 2>/dev/null || git rev-parse --short=8 HEAD) 10 | # Support reproducible builds by embedding date according to SOURCE_DATE_EPOCH if present 11 | DATE := $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" '+%FT%T%z' 2>/dev/null || date -u '+%FT%T%z') 12 | BUILDFLAGS_NOPIE := -trimpath -ldflags="-s -w -X main.version=$(GOPASS_VERSION) -X main.commit=$(GOPASS_REVISION) -X main.date=$(DATE)" -gcflags="-trimpath=$(GOPATH)" -asmflags="-trimpath=$(GOPATH)" 13 | BUILDFLAGS ?= $(BUILDFLAGS_NOPIE) -buildmode=pie 14 | TESTFLAGS ?= 15 | PWD := $(shell pwd) 16 | PREFIX ?= $(GOPATH) 17 | BINDIR ?= $(PREFIX)/bin 18 | GO := GO111MODULE=on go 19 | GOOS ?= $(shell go version | cut -d' ' -f4 | cut -d'/' -f1) 20 | GOARCH ?= $(shell go version | cut -d' ' -f4 | cut -d'/' -f2) 21 | TAGS ?= netgo 22 | export GO111MODULE=on 23 | 24 | OK := $(shell tput setaf 6; echo ' [OK]'; tput sgr0;) 25 | 26 | all: build 27 | build: $(GOPASS_OUTPUT) 28 | gha-linux: sysinfo crosscompile build test 29 | 30 | sysinfo: 31 | @echo ">> SYSTEM INFORMATION" 32 | @echo -n " PLATFORM: $(shell uname -a)" 33 | @printf '%s\n' '$(OK)' 34 | @echo -n " PWD: : $(shell pwd)" 35 | @printf '%s\n' '$(OK)' 36 | @echo -n " GO : $(shell go version)" 37 | @printf '%s\n' '$(OK)' 38 | @echo -n " BUILDFLAGS: $(BUILDFLAGS)" 39 | @printf '%s\n' '$(OK)' 40 | @echo -n " GIT : $(shell git version)" 41 | @printf '%s\n' '$(OK)' 42 | @echo -n " GPG1 : $(shell which gpg) $(shell gpg --version | head -1)" 43 | @printf '%s\n' '$(OK)' 44 | @echo -n " GPG2 : $(shell which gpg2) $(shell gpg2 --version | head -1)" 45 | @printf '%s\n' '$(OK)' 46 | @echo -n " GPG-Agent : $(shell which gpg-agent) $(shell gpg-agent --version | head -1)" 47 | @printf '%s\n' '$(OK)' 48 | 49 | clean: 50 | @echo -n ">> CLEAN" 51 | @$(GO) clean -i ./... 52 | @rm -f ./coverage-all.html 53 | @rm -f ./coverage-all.out 54 | @rm -f ./coverage.out 55 | @find . -type f -name "coverage.out" -delete 56 | @rm -f gopass_*.deb 57 | @rm -f gopass-*.pkg.tar.xz 58 | @rm -f gopass-*.rpm 59 | @rm -f gopass-*.tar.bz2 60 | @rm -f gopass-*.tar.gz 61 | @rm -f gopass-*-* 62 | @rm -f tests/tests 63 | @rm -f *.test 64 | @rm -rf dist/* 65 | @rm -f *.completion 66 | @printf '%s\n' '$(OK)' 67 | 68 | $(GOPASS_OUTPUT): $(GOFILES_BUILD) 69 | @echo -n ">> BUILD, version = $(GOPASS_VERSION)/$(GOPASS_REVISION), output = $@" 70 | @$(GO) build -o $@ $(BUILDFLAGS) 71 | @printf '%s\n' '$(OK)' 72 | 73 | install: all 74 | @echo -n ">> INSTALL, version = $(GOPASS_VERSION)" 75 | @install -m 0755 -d $(DESTDIR)$(BINDIR) 76 | @install -m 0755 $(GOPASS_OUTPUT) $(DESTDIR)$(BINDIR)/$(GOPASS_OUTPUT) 77 | @printf '%s\n' '$(OK)' 78 | 79 | test: $(GOPASS_OUTPUT) 80 | @echo ">> TEST, \"fast-mode\": race detector off" 81 | @$(foreach pkg, $(PKGS),\ 82 | echo -n " ";\ 83 | $(GO) test -test.short -run '(Test|Example)' $(BUILDFLAGS) $(TESTFLAGS) $(pkg) || exit 1;) 84 | 85 | crosscompile: 86 | @echo -n ">> CROSSCOMPILE linux/amd64" 87 | @GOOS=linux GOARCH=amd64 $(GO) build -o $(GOPASS_OUTPUT)-linux-amd64 88 | @printf '%s\n' '$(OK)' 89 | @echo -n ">> CROSSCOMPILE darwin/amd64" 90 | @GOOS=darwin GOARCH=amd64 $(GO) build -o $(GOPASS_OUTPUT)-darwin-amd64 91 | @printf '%s\n' '$(OK)' 92 | @echo -n ">> CROSSCOMPILE windows/amd64" 93 | @GOOS=windows GOARCH=amd64 $(GO) build -o $(GOPASS_OUTPUT)-windows-amd64 94 | @printf '%s\n' '$(OK)' 95 | 96 | full: 97 | @echo -n ">> COMPILE linux/amd64" 98 | $(GO) build -o $(GOPASS_OUTPUT)-full 99 | 100 | codequality: 101 | @echo ">> CODE QUALITY" 102 | 103 | @echo -n " GOLANGCI-LINT " 104 | @which golangci-lint > /dev/null; if [ $$? -ne 0 ]; then \ 105 | $(GO) install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.1; \ 106 | fi 107 | @golangci-lint run --max-issues-per-linter 0 --max-same-issues 0 || exit 1 108 | 109 | @printf '%s\n' '$(OK)' 110 | 111 | gen: 112 | @$(GO) generate ./... 113 | 114 | fmt: 115 | @gofumpt -s -l -w $(GOFILES_NOVENDOR) 116 | @gci write $(GOFILES_NOVENDOR) 117 | @$(GO) mod tidy 118 | 119 | deps: 120 | @$(GO) build -v ./... 121 | 122 | upgrade: gen fmt 123 | @$(GO) get -u ./... 124 | @$(GO) mod tidy 125 | 126 | .PHONY: clean build completion install sysinfo crosscompile test codequality release 127 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Using gopass as summon provider 2 | 3 | ## What is summon? 4 | 5 | [Summon](https://cyberark.github.io/summon) is a command-line tool to inject secrets as environment variables. 6 | It is used to execute a process and inject secrets from a separate store. Using gopass can be useful in (local) development 7 | 8 | ## Summon Provider 9 | 10 | The gopass repository contains the [cmd/gopass-summon-provider](../cmd/gopass-summon-provider) tool, that can be used as [summon provider](https://cyberark.github.io/summon/#providers). 11 | 12 | To make use of gopass-summon-provider to retrieve the `test/db-password` secret, you can call summon with full provider path 13 | 14 | summon -p /usr/local/bin/gopass-summon-provider --yaml 'DBPASS: !var test/db-password' bash -c 'echo $DBPASS' 15 | 16 | or link gopass-summon-provider to `/usr/local/lib/summon/gopass` and just use `gopass` 17 | 18 | summon -p gopass --yaml 'DBPASS: !var test/db-password' bash -c 'echo $DBPASS' 19 | 20 | or export `SUMMON_PROVIDER=gopass` as default provider 21 | 22 | summon --yaml 'DBPASS: !var test/db-password' bash -c 'echo $DBPASS' 23 | 24 | With the appropriate `secrets.yml`, it's as easy as running 25 | 26 | summon ./my-command-to-run 27 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 1.15.16 2 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/gopasspw/gopass-summon-provider 2 | 3 | go 1.24.1 4 | 5 | require ( 6 | github.com/blang/semver/v4 v4.0.0 7 | github.com/fatih/color v1.18.0 8 | github.com/gopasspw/gopass v1.15.16 9 | github.com/stretchr/testify v1.10.0 10 | github.com/urfave/cli/v2 v2.27.6 11 | ) 12 | 13 | require ( 14 | al.essio.dev/pkg/shellescape v1.6.0 // indirect 15 | filippo.io/age v1.2.1 // indirect 16 | filippo.io/edwards25519 v1.1.0 // indirect 17 | github.com/ProtonMail/go-crypto v1.2.0 // indirect 18 | github.com/caspr-io/yamlpath v0.0.0-20200722075116-502e8d113a9b // indirect 19 | github.com/cloudflare/circl v1.6.1 // indirect 20 | github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect 21 | github.com/danieljoos/wincred v1.2.2 // indirect 22 | github.com/davecgh/go-spew v1.1.1 // indirect 23 | github.com/dustin/go-humanize v1.0.1 // indirect 24 | github.com/godbus/dbus/v5 v5.1.0 // indirect 25 | github.com/google/go-cmp v0.7.0 // indirect 26 | github.com/gopasspw/clipboard v0.0.1 // indirect 27 | github.com/gopasspw/gitconfig v0.0.1 // indirect 28 | github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect 29 | github.com/kr/text v0.2.0 // indirect 30 | github.com/mattn/go-colorable v0.1.14 // indirect 31 | github.com/mattn/go-isatty v0.0.20 // indirect 32 | github.com/pmezard/go-difflib v1.0.0 // indirect 33 | github.com/russross/blackfriday/v2 v2.1.0 // indirect 34 | github.com/twpayne/go-pinentry/v4 v4.0.0 // indirect 35 | github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect 36 | github.com/zalando/go-keyring v0.2.6 // indirect 37 | golang.org/x/crypto v0.37.0 // indirect 38 | golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect 39 | golang.org/x/sys v0.32.0 // indirect 40 | golang.org/x/term v0.31.0 // indirect 41 | gopkg.in/yaml.v3 v3.0.1 // indirect 42 | ) 43 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | al.essio.dev/pkg/shellescape v1.6.0 h1:NxFcEqzFSEVCGN2yq7Huv/9hyCEGVa/TncnOOBBeXHA= 2 | al.essio.dev/pkg/shellescape v1.6.0/go.mod h1:6sIqp7X2P6mThCQ7twERpZTuigpr6KbZWtls1U8I890= 3 | c2sp.org/CCTV/age v0.0.0-20240306222714-3ec4d716e805 h1:u2qwJeEvnypw+OCPUHmoZE3IqwfuN5kgDfo5MLzpNM0= 4 | c2sp.org/CCTV/age v0.0.0-20240306222714-3ec4d716e805/go.mod h1:FomMrUJ2Lxt5jCLmZkG3FHa72zUprnhd3v/Z18Snm4w= 5 | filippo.io/age v1.2.1 h1:X0TZjehAZylOIj4DubWYU1vWQxv9bJpo+Uu2/LGhi1o= 6 | filippo.io/age v1.2.1/go.mod h1:JL9ew2lTN+Pyft4RiNGguFfOpewKwSHm5ayKD/A4004= 7 | filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= 8 | filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= 9 | github.com/ProtonMail/go-crypto v1.2.0 h1:+PhXXn4SPGd+qk76TlEePBfOfivE0zkWFenhGhFLzWs= 10 | github.com/ProtonMail/go-crypto v1.2.0/go.mod h1:9whxjD8Rbs29b4XWbB8irEcE8KHMqaR2e7GWU1R+/PE= 11 | github.com/alecthomas/assert/v2 v2.5.0 h1:OJKYg53BQx06/bMRBSPDCO49CbCDNiUQXwdoNrt6x5w= 12 | github.com/alecthomas/assert/v2 v2.5.0/go.mod h1:fw5suVxB+wfYJ3291t0hRTqtGzFYdSwstnRQdaQx2DM= 13 | github.com/alecthomas/repr v0.3.0 h1:NeYzUPfjjlqHY4KtzgKJiWd6sVq2eNUPTi34PiFGjY8= 14 | github.com/alecthomas/repr v0.3.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= 15 | github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= 16 | github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= 17 | github.com/caspr-io/yamlpath v0.0.0-20200722075116-502e8d113a9b h1:2K3B6Xm7/lnhOugeGB3nIk50bZ9zhuJvXCEfUuL68ik= 18 | github.com/caspr-io/yamlpath v0.0.0-20200722075116-502e8d113a9b/go.mod h1:4rP9T6iHCuPAIDKdNaZfTuuqSIoQQvFctNWIAUI1rlg= 19 | github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0= 20 | github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs= 21 | github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo5vtkx0= 22 | github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= 23 | github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= 24 | github.com/danieljoos/wincred v1.2.2 h1:774zMFJrqaeYCK2W57BgAem/MLi6mtSE47MB6BOJ0i0= 25 | github.com/danieljoos/wincred v1.2.2/go.mod h1:w7w4Utbrz8lqeMbDAK0lkNJUv5sAOkFi7nd/ogr0Uh8= 26 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 27 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 28 | github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= 29 | github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= 30 | github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= 31 | github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= 32 | github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= 33 | github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= 34 | github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= 35 | github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= 36 | github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 37 | github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= 38 | github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= 39 | github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= 40 | github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= 41 | github.com/gopasspw/clipboard v0.0.1 h1:arxUYK7k6+5JBTjgEMWlcxjVXxeW5cWDUKULznIbeb8= 42 | github.com/gopasspw/clipboard v0.0.1/go.mod h1:i0cShr7JEbOXZ/iKM5RyfBLbu1FPzouO8BTCJy0uHy8= 43 | github.com/gopasspw/gitconfig v0.0.1 h1:3qsCvQZQlOBqgouXeE21U+Pio/SIsFdY/fNBoHox/qw= 44 | github.com/gopasspw/gitconfig v0.0.1/go.mod h1:QXipMxku0UNLRXdNHskPQ8zsnnT0ZL9+XrNJPCMHuGY= 45 | github.com/gopasspw/gopass v1.15.16 h1:wgiW6cKMUEnrVaqYnjhzCE8f4BRMJxBcz/7/yPWRaOM= 46 | github.com/gopasspw/gopass v1.15.16/go.mod h1:1ni2KVl+Sw5BO52k+ksmemdXIBBh8KhQdBDE1a8ewnk= 47 | github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= 48 | github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= 49 | github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= 50 | github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= 51 | github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= 52 | github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= 53 | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= 54 | github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= 55 | github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= 56 | github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= 57 | github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= 58 | github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= 59 | github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 60 | github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= 61 | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 62 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 63 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 64 | github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= 65 | github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= 66 | github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= 67 | github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 68 | github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= 69 | github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= 70 | github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= 71 | github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= 72 | github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= 73 | github.com/twpayne/go-pinentry/v4 v4.0.0 h1:8WcNa+UDVRzz7y9OEEU/nRMX+UGFPCAvl5XsqWRxTY4= 74 | github.com/twpayne/go-pinentry/v4 v4.0.0/go.mod h1:aXvy+awVXqdH+GS0ddQ7AKHZ3tXM6fJ2NK+e16p47PI= 75 | github.com/urfave/cli/v2 v2.27.6 h1:VdRdS98FNhKZ8/Az8B7MTyGQmpIr36O1EHybx/LaZ4g= 76 | github.com/urfave/cli/v2 v2.27.6/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ= 77 | github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4= 78 | github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM= 79 | github.com/zalando/go-keyring v0.2.6 h1:r7Yc3+H+Ux0+M72zacZoItR3UDxeWfKTcabvkI8ua9s= 80 | github.com/zalando/go-keyring v0.2.6/go.mod h1:2TCrxYrbUNYfNS/Kgy/LSrkSQzZ5UPVH85RwfczwvcI= 81 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 82 | golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE= 83 | golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc= 84 | golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 h1:R84qjqJb5nVJMxqWYb3np9L5ZsaDtB+a39EqjV0JSUM= 85 | golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0/go.mod h1:S9Xr4PYopiDyqSyp5NjCrhFrqg6A5zA2E/iPHPhqnS8= 86 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 87 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 88 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 89 | golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 90 | golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20= 91 | golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= 92 | golang.org/x/term v0.31.0 h1:erwDkOK1Msy6offm1mOgvspSkslFnIGsFnxOKoufg3o= 93 | golang.org/x/term v0.31.0/go.mod h1:R4BeIy7D95HzImkxGkTW1UQTtP54tio2RyHz7PwK0aw= 94 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 95 | golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= 96 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 97 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= 98 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= 99 | gopkg.in/yaml.v3 v3.0.0-20200121175148-a6ecf24a6d71/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 100 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 101 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 102 | gotest.tools/v3 v3.0.2 h1:kG1BFyqVHuQoVQiR1bWGnfz/fmHvvuiSPIV7rvl360E= 103 | gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= 104 | -------------------------------------------------------------------------------- /helpers/changelog/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bufio" 5 | "fmt" 6 | "os" 7 | "strings" 8 | ) 9 | 10 | func main() { 11 | fh, err := os.Open("CHANGELOG.md") 12 | if err != nil { 13 | panic(err) 14 | } 15 | defer fh.Close() 16 | 17 | s := bufio.NewScanner(fh) 18 | var in bool 19 | for s.Scan() { 20 | line := s.Text() 21 | if strings.HasPrefix(line, "## ") { 22 | if in { 23 | break 24 | } 25 | in = true 26 | } 27 | 28 | fmt.Println(line) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | "log" 7 | "os" 8 | "os/signal" 9 | 10 | "github.com/gopasspw/gopass/pkg/gopass/api" 11 | "github.com/urfave/cli/v2" 12 | ) 13 | 14 | const ( 15 | name = "summon-gopass" 16 | ) 17 | 18 | // Version is the released version of gopass. 19 | var version string 20 | 21 | func main() { 22 | ctx := context.Background() 23 | 24 | // trap Ctrl+C and call cancel on the context 25 | ctx, cancel := context.WithCancel(ctx) 26 | sigChan := make(chan os.Signal, 1) 27 | signal.Notify(sigChan, os.Interrupt) 28 | defer func() { 29 | signal.Stop(sigChan) 30 | cancel() 31 | }() 32 | go func() { 33 | select { 34 | case <-sigChan: 35 | cancel() 36 | case <-ctx.Done(): 37 | } 38 | }() 39 | 40 | gp, err := api.New(ctx) 41 | if err != nil { 42 | fmt.Printf("Failed to initialize gopass API: %s\n", err) 43 | os.Exit(1) 44 | } 45 | 46 | gc := &gc{ 47 | gp: gp, 48 | } 49 | 50 | app := cli.NewApp() 51 | app.Name = name 52 | app.Version = getVersion().String() 53 | app.Usage = `Use "gopass-summon-provider" as provider for "summon"` 54 | app.Description = "" + 55 | "This command allows to use gopass as a secret provider for summon." + 56 | "To use it set the 'SUMMON_PROVIDER' variable to this executable or" + 57 | "copy or link it (as `gopass`) into the summon provider directory" + 58 | "'/usr/local/lib/summon/'. See 'summon' documentation for more details." 59 | app.Action = gc.Get 60 | 61 | if err := app.RunContext(ctx, os.Args); err != nil { 62 | log.Fatal(err) 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /summon-provider.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "os" 7 | 8 | "github.com/gopasspw/gopass/pkg/ctxutil" 9 | "github.com/gopasspw/gopass/pkg/gopass" 10 | "github.com/urfave/cli/v2" 11 | ) 12 | 13 | // Stdout is exported for tests. 14 | var Stdout io.Writer = os.Stdout 15 | 16 | type gc struct { 17 | gp gopass.Store 18 | } 19 | 20 | // Get outputs the password for given path on stdout. 21 | func (s *gc) Get(c *cli.Context) error { 22 | ctx := ctxutil.WithGlobalFlags(c) 23 | ctx = ctxutil.WithNoNetwork(ctx, true) 24 | path := c.Args().Get(0) 25 | secret, err := s.gp.Get(ctx, path, "latest") 26 | if err != nil { 27 | return err 28 | } 29 | 30 | fmt.Fprintln(Stdout, secret.Password()) 31 | 32 | return nil 33 | } 34 | -------------------------------------------------------------------------------- /summon-provider_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bytes" 5 | "os" 6 | "testing" 7 | 8 | "github.com/fatih/color" 9 | "github.com/gopasspw/gopass/pkg/gopass/apimock" 10 | "github.com/gopasspw/gopass/pkg/termio" 11 | "github.com/gopasspw/gopass/tests/gptest" 12 | "github.com/stretchr/testify/assert" 13 | "github.com/stretchr/testify/require" 14 | ) 15 | 16 | func TestSummonProviderOutputsOnlySecret(t *testing.T) { //nolint:paralleltest 17 | ctx := t.Context() 18 | act := &gc{ 19 | gp: apimock.New(), 20 | } 21 | require.NoError(t, act.gp.Set(ctx, "foo", &apimock.Secret{Buf: []byte("bar\nbaz: zab")})) 22 | 23 | buf := &bytes.Buffer{} 24 | Stdout = buf 25 | color.NoColor = true 26 | defer func() { 27 | termio.Stdin = os.Stdin 28 | Stdout = os.Stdout 29 | }() 30 | 31 | require.NoError(t, act.Get(gptest.CliCtx(ctx, t, "foo"))) 32 | assert.Equal(t, "bar\n", buf.String()) 33 | } 34 | -------------------------------------------------------------------------------- /version.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "strings" 5 | 6 | "github.com/blang/semver/v4" 7 | ) 8 | 9 | func getVersion() semver.Version { 10 | sv, err := semver.Parse(strings.TrimPrefix(version, "v")) 11 | if err == nil { 12 | return sv 13 | } 14 | 15 | return semver.Version{ 16 | Major: 1, 17 | Minor: 15, 18 | Patch: 16, 19 | Pre: []semver.PRVersion{ 20 | {VersionStr: "git"}, 21 | }, 22 | Build: []string{"HEAD"}, 23 | } 24 | } 25 | --------------------------------------------------------------------------------