Skip to content

Commit b8e5ecb

Browse files
committed
Deny if build context already have file at DockerfileStaging
1 parent 62d1a6a commit b8e5ecb

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

pkg/fileutils/tarxfer.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,9 @@ func unpackTar(ctx context.Context, tarFile, dest string) error {
278278
if err != nil {
279279
return err
280280
}
281+
if hdr.Name == DockerfileStaging {
282+
return fmt.Errorf("cannot use reserved path: %s", hdr.Name)
283+
}
281284
target := filepath.Join(dest, hdr.Name)
282285
if !strings.HasPrefix(target, filepath.Clean(dest)+string(os.PathSeparator)) {
283286
return fmt.Errorf("invalid tar path: %s", hdr.Name)

0 commit comments

Comments
 (0)