Skip to content

Commit 5f27132

Browse files
committed
Enforce that GitCommit must be a *full* commit hash
I thought this was already the behavior, but I guess it was relaxed because previous iterations of this validation had to apply to the older format where we'd been less meticulous about enforcing this. Since those are all gone now, we can safely update the validation to enforce that commit hashes *must* be fully qualified.
1 parent 63bf7cf commit 5f27132

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

manifest/rfc2822.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
)
1717

1818
var (
19-
GitCommitRegex = regexp.MustCompile(`^[0-9a-f]{1,64}$`)
19+
GitCommitRegex = regexp.MustCompile(`^([0-9a-f]{40}|[0-9a-f]{64})$`)
2020
GitFetchRegex = regexp.MustCompile(`^refs/(heads|tags)/[^*?:]+$`)
2121

2222
// https://github.com/docker/distribution/blob/v2.7.1/reference/regexp.go#L37

0 commit comments

Comments
 (0)