Fix secret image filter regex (#2674)

This commit is contained in:
Jannik Heuer
2023-10-31 13:15:13 +01:00
committed by GitHub
parent 2f0bb7153e
commit 0fbf8cfc85
2 changed files with 43 additions and 9 deletions

View File

@@ -112,10 +112,14 @@ func (s *Secret) Match(event WebhookEvent) bool {
}
var validDockerImageString = regexp.MustCompile(
`^([\w\d\-_\.\/]*` + // optional url prefix
`[\w\d\-_]+` + // image name
`)+` +
`(:[\w\d\-_]+)?$`, // optional image tag
`^(` +
`[\w\d\-_\.]+` + // hostname
`(:\d+)?` + // optional port
`/)?` + // optional hostname + port
`([\w\d\-_\.][\w\d\-_\.\/]*/)?` + // optional url prefix
`([\w\d\-_]+)` + // image name
`(:[\w\d\-_]+)?` + // optional image tag
`$`,
)
// Validate validates the required fields and formats.