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

Inconsistent behaviour when the sops configuration file isn't in (a parent of) the current working directory #1222

Open
adamroyjones opened this issue Jun 9, 2023 · 1 comment

Comments

@adamroyjones
Copy link

adamroyjones commented Jun 9, 2023

The below is with sops 3.7.3 on Debian 12 on x86 (installed using the deb provided on the releases page).

Take a folder structure as follows

.
└── foo
    ├── hello.yaml
    └── .sops.yaml

where .sops.yaml contains (trivial) GCP KMS creation rules, e.g.

creation_rules:
  - path_regex: .+
    gcp_kms: [REDACTED]
    encrypted_regex: .+

and hello.yaml contains

hello: world

Note the following.

  1. Encryption fails.
$ sops -e foo/hello.yaml
config file not found and no keys provided through command line options
  1. Creating an encrypted file interactively fails.
$ sops foo/goodbye.yaml
config file not found and no keys provided through command line options
  1. Encrypting the file from within foo works.
$ cd foo
$ sops -e hello.yaml > hello.enc.yaml
  1. Creating a new encrypted file from within foo works.
$ cd foo
$ sops goodbye.yaml
  1. Decrypting the encrypted file... works!
$ sops -d foo/hello.enc.yaml

That is, the behaviour of 5 is inconsistent with 1 and 2. For decryption, sops appears to walk from the file towards the root in search of configuration; for encryption, it doesn't.

Is this the intended design or is the inconsistency a minor mistake?

@adamroyjones
Copy link
Author

adamroyjones commented Jun 9, 2023

I've also noticed a secondary issue of consistency. (This one I think is more unambiguously a bug.)

  1. Decrypting a file that doesn't exist leads to a reasonable error message.
$ sops -d foo/farewell.enc.yaml
Error: cannot operate on non-existent file
  1. Attempting to modify a file that doesn't exist leads to a spurious error message.
$ sops --in-place foo/farewell.enc.yaml
config file not found and no keys provided through command line options

(The error message for 7 caught me out earlier today...)

@adamroyjones adamroyjones changed the title Inconsistent behaviour when the sops configuration file isn't in (a parent of) current working directory Inconsistent behaviour when the sops configuration file isn't in (a parent of) the current working directory Jun 9, 2023
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

No branches or pull requests

1 participant