getsops / getsops/sops

Support more complicated path_regexp

Open
#826 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
23.1k
Forks
1.1k
Avg merge
1d 11h
Merged PRs (30d)
9

Description

Is it possible to support more complicated regexp in path_regex? Like mentioned in the documentation here https://golang.org/pkg/regexp/#MatchString

"More complicated queries need to use Compile and the full Regexp interface"

so the match has to be implemented more like this

validRegExp = regexp.MustCompile(path_regexp)
match = validRegExp.MatchString(filePath))

I think this is the reason for issues like this one https://github.com/mozilla/sops/issues/480

We also had problems to specify a path which is including the filename and not just a filename. Especially if there are '/' in the path it's not working at all and we get the message 'no matching creation rules found'

Example not working (no matter if '/' are escaped or not!):

path_regexp: stages/dev/secrets.env$

Examples working:

path_regexp: .*dev.*
path_regexp: secrets\.env$

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Trace how the path_regexp creation rule is evaluated against file paths, using the reported stages/dev/secrets.env$ and secrets.env$ examples as reproductions. Check the existing matching behavior against Go's regexp documentation; done means valid expressions match paths containing directories and no matching creation-rules error occurs for the reported case.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.