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

Support more complicated path_regexp #826

Open
sfrevel opened this issue Mar 2, 2021 · 2 comments
Open

Support more complicated path_regexp #826

sfrevel opened this issue Mar 2, 2021 · 2 comments

Comments

@sfrevel
Copy link

sfrevel commented Mar 2, 2021

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 #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$
@autrilla
Copy link
Contributor

autrilla commented Mar 2, 2021

We would be happy to take a patch for this. An accompanying test to show the improvement would be excellent too.

@bcolucci
Copy link
Contributor

bcolucci commented Mar 5, 2021

#829

bcolucci added a commit to bcolucci/sops that referenced this issue Mar 8, 2021
autrilla pushed a commit that referenced this issue Mar 10, 2021
* feat: Support more complicated path_regexp (#826)

* feat: Support more complicated path_regexp (#826)

* fix review: do not panic and return an error instead if the regexp is not valid.

* fix merge mess

Co-authored-by: AJ Bahnken <1144310+ajvb@users.noreply.github.com>
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

3 participants