Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add specific status code for sops errors #1245

Open
wants to merge 136 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
430d327
add specific sops error handling with status code
kaedwen Jul 7, 2023
4125f2d
Delete obsolete `validation/` artifact
hiddeco Jul 11, 2023
2267fdd
gcpkms: allow use of Google default credentials
hiddeco Jul 11, 2023
565cf52
Revert intro of `WithError` for most key sources
hiddeco Jul 18, 2022
2957fe9
Rename Go module to `github.com/getsops/sops/v3`
hiddeco Jul 11, 2023
1d8e164
Remove "download page" generator
hiddeco Jul 11, 2023
bbb2139
kms: update dependencies
hiddeco Aug 11, 2023
f10b437
gcpkms: update GCP related dependencies
hiddeco Aug 11, 2023
f1d8a45
azkv: update dependencies
hiddeco Aug 11, 2023
1ba02bd
docs: update Azure default credential chain info
hiddeco Aug 12, 2023
0311827
release: outline release logic using GoReleaser
hiddeco Jul 11, 2023
45121cf
release: configure build of Docker images
hiddeco Jul 30, 2023
3faed48
release: sign checksum file and images with cosign
hiddeco Jul 30, 2023
553e1ee
release: enable GitHub native note generation
hiddeco Jul 31, 2023
156c6ce
release: add release configuration
hiddeco Jul 31, 2023
aac7fae
release: publish container images to GHCR and Quay
hiddeco Jul 31, 2023
1033516
release: download modules and check dirty state
hiddeco Jul 31, 2023
7de7a6e
build: outline new release workflow
hiddeco Jul 31, 2023
4403a77
release: remove stale Make target utilities
hiddeco Aug 2, 2023
8289263
release: small nits
hiddeco Aug 3, 2023
f59dd8e
release: refactor backwards compatible artifacts
hiddeco Aug 3, 2023
212c95d
release: extend timeout
hiddeco Aug 3, 2023
a98c47e
release: further improve build flags
hiddeco Aug 4, 2023
f5ce84e
release: pin GoReleaser version
hiddeco Aug 4, 2023
d52cc76
release: artifact, SBOM and container provenance
hiddeco Aug 4, 2023
1eed2ed
release: backwards compatible tag fmt, changelog
hiddeco Aug 8, 2023
09f96e8
release: further solve backwards compatible names
hiddeco Aug 8, 2023
16ac13b
build: remove obsolete Dockerfiles
hiddeco Aug 8, 2023
47669ef
release: tweak signature and certificate filenames
hiddeco Aug 9, 2023
20d50c3
release: disable Go cache for workflow
hiddeco Aug 9, 2023
9aeb417
release: improve release notes
hiddeco Aug 9, 2023
ba1e883
release: remove DockerHub release util script
hiddeco Aug 10, 2023
07f74b6
build: add `release-snapshot` Make target
hiddeco Aug 10, 2023
2dc75d9
docs: briefly outline release procedure
hiddeco Aug 10, 2023
82f4163
release: update GoReleaser to 1.20.0
hiddeco Aug 10, 2023
24ccda0
release: further improvements based on feedback
hiddeco Aug 11, 2023
0f669f4
docs: rename `mozilla/sops` -> `getsops/sops`
hiddeco Jul 6, 2023
5631d1e
docs: update contributing guidelines
hiddeco Jul 6, 2023
19cf49e
docs: update authors section in README
hiddeco Jul 6, 2023
29619db
docs: update security section
hiddeco Jul 6, 2023
dd200ce
docs: add CNCF footer
hiddeco Aug 11, 2023
9a58697
docs: add note to motivation section
hiddeco Aug 11, 2023
be49ee0
Only report version check when it can be
stoned Sep 11, 2022
a4fef71
Add missing --encrypt flag from Vault example
hrobertson May 17, 2022
4f8267a
fix: `set` feature when adding a new root hierarchy
vbehar Jul 2, 2021
1099803
Sort sops parameters in dotenv file
Jdban Nov 15, 2019
ea5502b
Add a test for dotenv output ordering
edofic Aug 4, 2022
4f71b76
Add documentation on how to use age in.sops.yaml
hramberger Apr 1, 2023
d6579e8
Clean up more Mozilla references
Gobd Aug 16, 2023
a46df07
build: actually run `go vet` for whole project
hiddeco Aug 11, 2023
0b495cb
*: solve `go vet` errors
hiddeco Aug 11, 2023
496705c
build: replace `golint` with `staticcheck`
hiddeco Aug 14, 2023
a356b37
*: address various simple `staticcheck` warnings
hiddeco Aug 14, 2023
751c1f7
build: remove `test.sh` wrapper
hiddeco Aug 14, 2023
5a8d6d2
build: ignore `functional-tests/sops`
hiddeco Aug 14, 2023
6cf3ab5
build: ensure Syft is installed
hiddeco Aug 16, 2023
da9b9aa
build: add `clean` and delete `tag`
hiddeco Aug 16, 2023
31eb43c
Update dependencies
hiddeco Aug 22, 2023
1c8f44c
release: properly enquote version ldflag
hiddeco Aug 16, 2023
56df701
version: rewrite command to use GitHub endpoints
hiddeco Aug 16, 2023
00b2e77
gcpkms: further deal with Google SDK deprecations
hiddeco Aug 16, 2023
2df6223
*: deal with various gRPC deprecations
hiddeco Aug 16, 2023
46d3f5f
kms: use `BaseEndpoint` for testing
hiddeco Aug 16, 2023
0634019
*: `strings.Title` deprecation
hiddeco Aug 16, 2023
212e0ab
cmd/edit: close temp file before invoking editor
hiddeco Aug 23, 2023
efacb09
cmd/edit: switch from MD5 to SHA-256 for checksum
hiddeco Aug 23, 2023
e429336
build: ensure clean working tree
hiddeco Aug 24, 2023
d389b32
build: address out-of-sync `go.mod`
hiddeco Aug 24, 2023
6bb00f9
build: remove obsolete step & improve readability
hiddeco Aug 24, 2023
e9946be
Fix formatting
felixfontein Aug 25, 2023
bd965c0
Prepare v3.8.0-rc.1
hiddeco Aug 24, 2023
b9a8076
chore: update dependencies
hiddeco Sep 11, 2023
72b41a6
build: pin actions to full length commit SHA
hiddeco Sep 11, 2023
d977df3
build: add CodeQL workflow
hiddeco Sep 11, 2023
083239c
Enable Dependabot for Docker, GH Actions and Go
hiddeco Sep 11, 2023
59bf2f1
build(deps): Bump the go group with 2 updates
dependabot[bot] Sep 12, 2023
6f054da
build(deps): Bump the ci group with 6 updates
dependabot[bot] Sep 12, 2023
c26580d
release: generate versioned `.intoto.jsonl`
hiddeco Sep 11, 2023
d9dcd44
build: fix indentation Dependabot file
hiddeco Sep 12, 2023
da64d83
pgp: remove `DisableAgent` option
hiddeco Sep 12, 2023
51a4b4c
keyservices: address logging regression
hiddeco Sep 12, 2023
c26b4c9
chore: update dependencies
hiddeco Sep 14, 2023
2a3bfe3
Prepare v3.8.0
hiddeco Sep 14, 2023
00100ab
build(deps): Bump the ci group with 3 updates
dependabot[bot] Sep 18, 2023
7e454de
pgp: improve handling of GnuPG home dir
hiddeco Sep 19, 2023
bc89a1d
pgp: remove `--no-default-keyring` argument
hiddeco Sep 19, 2023
757ac25
Delete sops encrypted file we don't have keys for.
felixfontein Sep 16, 2023
c7001db
Improve handling of errors when binary store handles bad data
felixfontein Sep 16, 2023
591498d
On macOS, prefer XDG_CONFIG_HOME over os.UserConfigDir()
felixfontein Sep 16, 2023
49298c3
Reject completely empty documents.
felixfontein Sep 16, 2023
6fd47e2
Fix descriptions of unencrypted-regex and encrypted-regex flags.
mitar Sep 22, 2023
82e482f
build(deps): Bump the go group with 4 updates
dependabot[bot] Sep 27, 2023
c8d644e
build(deps): Bump the ci group with 1 update
dependabot[bot] Sep 27, 2023
539d541
Fix versions in comments
felixfontein Sep 27, 2023
2cce4a6
Handle return values of dec.Token() to improve error messages.
felixfontein Sep 28, 2023
ce2ec69
Make error the last return value
felixfontein Sep 29, 2023
de6e1d5
pgp: do not require abs path for SopsGpgExecEnv
holiman Sep 29, 2023
be40257
decrypt: fix dropped error
alrs Sep 26, 2023
4b65127
Ignore irrelevant return value (it is always nil).
felixfontein Sep 29, 2023
3fc121d
Handle unhandled errors.
felixfontein Sep 29, 2023
c9cc5f8
Defer only after checking err.
felixfontein Sep 29, 2023
f298b80
Check err for nil in tests.
felixfontein Sep 29, 2023
a9848ba
Report key rotation errors.
felixfontein Oct 8, 2023
6cd3d67
Make sure to wrap raw errors with toExitError().
felixfontein Oct 8, 2023
ffcacf0
build(deps): Bump the go group with 7 updates
dependabot[bot] Oct 9, 2023
26d922d
docs: document AWS environment variables
nsantiago2719 Sep 6, 2023
1d96c0c
pgp: better error reporting for missing GPG binary
Sep 15, 2023
408c9d6
pgp: further improve import error format
hiddeco Oct 9, 2023
8e21a88
Improve RST files (with rstcheck feedback).
felixfontein Sep 16, 2023
28eb25e
Improve MD files (with mdl feedback).
felixfontein Sep 16, 2023
70dc521
Normalize indentation for code blocks and YAML files.
felixfontein Sep 16, 2023
292cde5
Normalize SOPS usages.
felixfontein Oct 10, 2023
ee4cdbd
Change some SOPSs back to sops.
felixfontein Oct 10, 2023
3071274
Add workflow for rstcheck and mdl.
felixfontein Sep 16, 2023
6c75c3b
Add checkdocs, checkrst, and checkmd make targets.
felixfontein Sep 16, 2023
d55ba79
Add section in CONTRIBUTING.md on docs changes.
felixfontein Sep 16, 2023
59d85b8
Update dependencies
hiddeco Oct 10, 2023
4135d8b
Release v3.8.1
hiddeco Oct 10, 2023
d9a12ce
config: respect `aws_profile` from group config
Kouzukii Sep 1, 2022
c9352b3
docs: add aws_profile to creation_rules examples
Kouzukii Oct 13, 2023
3262d55
kms: add minimal test for `NewMasterKeyWithProfile`
hiddeco Oct 13, 2023
2dc648f
build(deps): Bump the go group with 6 updates
dependabot[bot] Oct 16, 2023
faec355
kms: improve AWS profile test
hiddeco Oct 17, 2023
385d6f5
build(deps): Bump the go group with 3 updates
dependabot[bot] Oct 23, 2023
dc2a752
build(deps): Bump the go group with 1 update
dependabot[bot] Oct 23, 2023
0a2a58b
build(deps): Bump github.com/docker/docker
dependabot[bot] Oct 30, 2023
13e567e
build(deps): Bump the go group with 3 updates
dependabot[bot] Oct 30, 2023
02c6597
Improve README.rst
Ph0tonic Nov 3, 2023
68ae61b
Fix typos.
felixfontein Nov 2, 2023
5934484
build(deps): Bump the go group with 7 updates
dependabot[bot] Nov 6, 2023
d040aae
Support computing MAC only over values which end up encrypted
mitar Dec 18, 2021
00a0272
build(deps): Bump the ci group with 1 update
dependabot[bot] Nov 13, 2023
43d0674
build(deps): Bump the go group with 7 updates
dependabot[bot] Nov 13, 2023
8b04fd7
Correctly tag code as yaml-stream
felixfontein Nov 13, 2023
3f7b7ff
use defined codes
kaedwen Nov 15, 2023
121a331
Merge branch 'main' into main
kaedwen Nov 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmd/sops/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,8 @@ func toExitError(err error) error {
return cliErr
} else if execErr, ok := err.(*osExec.ExitError); ok && execErr != nil {
return cli.NewExitError(err, execErr.ExitCode())
} else if sopsErr, ok := err.(*sops.SopsError); ok && sopsErr != nil {
return cli.NewExitError(err, sopsErr.ExitCode())
} else if err != nil {
return cli.NewExitError(err, codes.ErrorGeneric)
}
Expand Down
17 changes: 12 additions & 5 deletions sops.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,24 @@ import (
// DefaultUnencryptedSuffix is the default suffix a TreeItem key has to end with for sops to leave its Value unencrypted
const DefaultUnencryptedSuffix = "_unencrypted"

type sopsError string
type SopsError struct {
exitCode int
message string
}

func (e SopsError) ExitCode() int {
return e.exitCode
}

func (e sopsError) Error() string {
return string(e)
func (e SopsError) Error() string {
return e.message
}

// MacMismatch occurs when the computed MAC does not match the expected ones
const MacMismatch = sopsError("MAC mismatch")
var MacMismatch = &SopsError{10, "MAC mismatch"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note that there is already another exit code defined in cmd/sops/codes/codes.go. Please use the constants from there.


// MetadataNotFound occurs when the input file is malformed and doesn't have sops metadata in it
const MetadataNotFound = sopsError("sops metadata not found")
var MetadataNotFound = &SopsError{11, "sops metadata not found"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no code yet for that, a new constant should be added to cmd/sops/codes/codes.go and used here.


var log *logrus.Logger

Expand Down