getsops / getsops/sops

sops fails to match path_regex on Windows because it encounters '\', not '/'

Open
#892 2 comments 4 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

Given a directory called my-local on Windows, the following will FAIL to match

creation_rules:
  - path_regex: .*/my-local/.*
    ...

But the following will:

creation_rules:
  # Sigh; must match the native idea of what filepath separator is used...
  - path_regex: .*[/\\]my-local[/\\].*
    ...

Windows 10 20H2
sops 3.7.1 (latest)

WSL-2 is not being used; sops is being run from a PowerShell session

Sops should ideally canonicalise the path separator, perhaps following established behaviour in the likes of .gitignore and .dockerignore files.

Documenting what the regex would begin to match on would be good too and any implicit anchoring that may be in effect.

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

Reproduce the creation_rules path_regex example from a PowerShell session on Windows, then trace the path-matching entry point and existing path-separator handling. Done means the documented regex behavior is clear and matching works consistently for Windows paths, with coverage for the reported examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.