Skip to content

Commit 6b44563

Browse files
committed
Disallow ADD --checksum=<SUM> <GITSRC> <DST>
Discussed in a comment in PR 5064 Signed-off-by: Akihiro Suda <[email protected]>
1 parent 05213db commit 6b44563

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)