You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c29d91c
Browse filesBrowse the repository at this point in the historyBrowse files
pkg/v1/mutate: preserve relative symlinks that stay within rootfs in Extract (#2279)
* pkg/v1/mutate: preserve relative symlinks that stay within rootfs in Extract
The `extract()` function in `pkg/v1/mutate/mutate.go` had all symlink filtering removed in the #2250 revert. Without any filtering, images can contain symlinks with absolute targets (e.g. `/etc/passwd`) or relative targets that escape the rootfs (e.g. `../../../tmp/evil`), both of which are unsafe when layers are extracted to disk.
Signed-off-by: anish k <[email protected]>
resolved:=filepath.Clean(filepath.Join(filepath.Dir(header.Name), header.Linkname)) //nolint:gosec // G305: path is only used for validation, not file I/O
318
+
ifstrings.HasPrefix(resolved, "..") {
319
+
continue
320
+
}
321
+
}
322
+
}
323
+
308
324
// force PAX format to remove Name/Linkname length limit of 100 characters
309
325
// required by USTAR and to not depend on internal tar package guess which
0 commit comments