Skip to content

Commit 966302e

Browse files
authored
Merge pull request moby#5085 from AkihiroSuda/fix-related-to-5064
Disallow `ADD --checksum=<SUM> <GITSRC> <DST>`
2 parents 05213db + 6b44563 commit 966302e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

frontend/dockerfile/dockerfile2llb/convert.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2117,7 +2117,14 @@ func commonImageNames() []string {
21172117
}
21182118

21192119
func isHTTPSource(src string) bool {
2120-
return strings.HasPrefix(src, "http://") || strings.HasPrefix(src, "https://")
2120+
if !strings.HasPrefix(src, "http://") && !strings.HasPrefix(src, "https://") {
2121+
return false
2122+
}
2123+
// https://github.com/ORG/REPO.git is a git source, not an http source
2124+
if gitRef, gitErr := gitutil.ParseGitRef(src); gitRef != nil && gitErr == nil {
2125+
return false
2126+
}
2127+
return true
21212128
}
21222129

21232130
func isEnabledForStage(stage string, value string) bool {

0 commit comments

Comments
 (0)