Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

cli/security: dlp add-custom --re is matched as a glob, not a regular expression

Open
#136 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go
Domain
security

Research direction

Start at cli/security/dlp.go:20 and trace how dlp add-custom --re stores and evaluates its pattern. Check the matching path and its tests, then verify that valid regular expressions match intended inputs and invalid patterns produce a clear add-time error. Done means the flag uses regex matching consistently.

Written by the indexing model from the issue text.

Description

bug help wanted

Problem

In packages/cli/security/dlp.go:20, the --re flag for dlp add-custom is documented/intended as a regular expression for custom DLP pattern matching, but the value is actually matched using glob semantics (e.g. via filepath.Match or a similar glob matcher) rather than being compiled and evaluated as a regular expression.

Impact

Users supplying a regex pattern via --re (e.g. ^sk-[a-zA-Z0-9]{32}$) get glob-style matching instead, where characters like ^, $, {, }, and + do not behave as regex metacharacters. This silently produces a custom DLP pattern that matches different (and likely far fewer, or entirely wrong) inputs than the user intended, weakening the custom detection rule without any error being surfaced.

Repro

  1. Add a custom DLP pattern via dlp add-custom --re '^sk-[a-zA-Z0-9]{32}$'.
  2. Trigger DLP scanning on a string that matches the intended regex (e.g. a 32-character token starting with sk-) and observe it is not detected because the value is being matched as a glob pattern, not compiled as a regex.

Suggested fix

Compile the --re value with regexp.Compile and use Regexp.MatchString for evaluation, surfacing a clear error at add-time if the pattern fails to compile as a valid regular expression, instead of passing it to glob-matching logic.

Dominant language
Go
Stars
157
Forks
19
Avg merge
4h 28m
Merged PRs (30d)
88

Getting set up

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.

More from solongate/agent-security

All issues in solongate/agent-security

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.