Skip to content

Commit

Permalink
fix(initrd): Add additional check of file type
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Jung <[email protected]>
  • Loading branch information
nderjung committed Nov 19, 2024
1 parent f36a514 commit 0f92d3a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions initrd/dockerfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,13 @@ func NewFromDockerfile(ctx context.Context, path string, opts ...InitrdOption) (
return nil, fmt.Errorf("file is not a Dockerfile")
}

fi, err := os.Stat(path)
if err != nil {
return nil, fmt.Errorf("could not check Dockerfile: %w", err)
} else if fi.IsDir() {
return nil, fmt.Errorf("supplied path %s is a directory not a Dockerfile", path)
}

initrd := dockerfile{
opts: InitrdOptions{
workdir: filepath.Dir(path),
Expand Down

0 comments on commit 0f92d3a

Please sign in to comment.