Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore the . and .. directory entries of directories when creating a SCALIBR Image. Without this, it is possible to infinitely recurse when using traversing the virtual file system. #353

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions artifact/image/layerscanning/image/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,12 @@ func fillChainLayerWithFilesFromTar(img *Image, tarReader *tar.Reader, originLay
basename := filepath.Base(cleanedFilePath)
dirname := filepath.Dir(cleanedFilePath)

// If the base name is "." or "..", then skip it. For example, if the cleaned file path is
// "/foo/bar/.", then we should skip it since it references "/foo/bar".
if basename == "." || basename == ".." {
continue
}

tombstone := strings.HasPrefix(basename, whiteout.WhiteoutPrefix)
// TODO: b/379094217 - Handle Opaque Whiteouts
if tombstone {
Expand Down
Loading