Closed loosebazooka closed 1 month ago
My curiosity is peaked. I'm struggling to see what weight this abstraction is carrying over using .equals or .pattern directly (or just wrapping them with a static method).
My curiosity is peaked. I'm struggling to see what weight this abstraction is carrying over using .equals or .pattern directly (or just wrapping them with a static method).
I wanted to be able to specify if any comparisons that were happening in the library were regexes or plain strings. For example
My policy could be accept any signatures from identity: https://github.com/org/project/.github/workflows/release.yaml@refs/tags/v1.4.0
, but essentially that only applies to the release 1.4.0
Instead my policy could accept signatures from identity: https://github\\.com/org/project/\\.github/workflows/release\\.yaml@refs/tags/v\\d+\\.\\d+\\.\\d+
which now doesn't need constant modification.
There's not a great way to know deep in the library if a regex comparison or plain string comparison needs to happen, so just using equals or pattern directly isn't possible.
So it was an option between providing a convention for regexes or just make them separate types (mimic'ing a oneOf). I went with the interface abstraction so that it matches what the other libraries are doing -- make them explicit and separate.
Maybe a name like PatternOrString
more meaningful here?
okay round 2, cleaned this up a lot. @patflynn @vlsi
sorry @vlsi need a rereview unfortunately
Once again, I am an idiot. My code format changes weren't committed. Sorry
part of #729
Makes it easier to either direct match strings or regex when comparing certificate OIDs (or really any string -- but this is what we use it for)