Git diff doesn't work if .sops.yaml exists in root with directory path matchers
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 23.1k
- Forks
- 1.1k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 9
Description
What is the problem
I've created a .sops.yaml file in the root of my git repo and added creation rules for two directories:
creation_rules:
- path_regex: sops/dev/.*
kms: 'arn:aws:kms:eu-west-1:1231231230:key/mrk-k1'
- path_regex: sops/production/.*
kms: 'arn:aws:kms:eu-west-1:1231231230:key/mrk-k2'
I've set up everything for git diff to work following the documentation.
When I run e.g. git diff sops/production/secrets.yaml, I get:
error loading config: no matching creation rules found
fatal: unable to read files to diff
This happens as sopsdiffer will be called with the following two paths:
/var/folders/1p/kj4p1zcn7qg32x53jfztnfb00000gq/T//MPTcrc_secrets.yamlsops/production/secrets.yaml
And there is no matching rule for the first one.
Possible workaround
I can pass an empty config file to sops in sopsdiffer and git diff will work.
[diff "sopsdiffer"]
textconv = sops --config empty-file.yaml -d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the sopsdiffer invocation and how its temporary and repository paths are passed to SOPS; the issue identifies the root .sops.yaml creation rules and the git diff configuration as the relevant entry points. Verify the fix with directory path matchers so git diff no longer reports that no matching creation rules were found.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, git, go
- Domain
- devops, security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100