Skip to content

Proposal: Support RegEx as an Alternative to Doublestar - #298

Open
Vad1mo wants to merge 3 commits into
goharbor:mainfrom
container-registry:proposal/regex-alternative-to-doublestar
Open

Proposal: Support RegEx as an Alternative to Doublestar#298
Vad1mo wants to merge 3 commits into
goharbor:mainfrom
container-registry:proposal/regex-alternative-to-doublestar

Conversation

@Vad1mo

@Vad1mo Vad1mo commented Aug 27, 2026

Copy link
Copy Markdown
Member

Proposal to add regular expressionsas a second, user-selectable pattern next to the existing doublestar glob matching in Harbor's pattern-based filters: tag retention, tag immutability, replication, and P2P preheat.

RegEx is an addition, not a replacement: every pattern field gets an explicit engine selector defaulting to Doublestar, so users pick per filter whichever engine fits and no existing rule changes behavior.

I am creating a new proposal, since there was quite some feedback and ideas around that over time and this proposal tries ot incorperate them all under one roof.

Why

Highlights

  • One shared regexp selector kind in src/lib/selector/selectors/, used by all four surfaces; phased rollout (retention + immutability first — no DB migration needed).
  • RE2 (already in harbor) linear-time matching, no ReDoS from user-supplied patterns; capabilities and exclusions documented in the proposal.
  • Validation at rule-save time (400 + inline UI validation), never at job runtime.
  • UI mockups (screenshots of the current portal with the engine selector added in place) included.

Refs: goharbor/harbor#12877, goharbor/harbor#8614

Adds regular expressions (Go RE2) as a second, user-selectable pattern
engine next to doublestar in Harbor's pattern-based filters (retention,
immutability, replication, P2P preheat). Doublestar stays the default;
each pattern field gets an explicit engine selector, so existing rules
are unaffected.

Builds on the direction agreed in goharbor#221, the reference implementation
goharbor/harbor#18723, and the kind discriminator introduced by goharbor#280.
Addresses goharbor/harbor#12877 and goharbor/harbor#8614.

Signed-off-by: Vadim Bauer <vb@container-registry.com>
Vad1mo added 2 commits August 27, 2026 18:39
Harmonizes with the kind discriminator community PR goharbor#280 introduces
for the proxy-cache repository filter, so Harbor ships one vocabulary
(doublestar | regex) instead of two. Resolves the open issue.

Signed-off-by: Vadim Bauer <vb@container-registry.com>
Measured on an unpatched build: an immutability rule with an unknown
selector kind saves with 200, populateImmutableStatus swallows the
matcher error, every tag reports Immutable=false and a push overwrites
a supposedly immutable tag with no error surfacing anywhere. Retention
by contrast fails closed and loudly.

Split the downgrade caveat accordingly and promote save-time
validation for immutability from hygiene to a safety requirement,
including fixing the error swallowing as part of phase 1.

Signed-off-by: Vadim Bauer <vb@container-registry.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants