mirror of
https://github.com/containers/podman.git
synced 2025-10-11 08:15:25 +08:00

For ConfigMap and Secret kube play volumes podman populates the data from the yaml. However the volume content is not controlled by us and we can be tricked following a symlink to a file on the host instead. Fixes: CVE-2025-9566 Fixes: https://issues.redhat.com/browse/RHEL-113141, https://issues.redhat.com/browse/RHEL-113152, https://issues.redhat.com/browse/OCPBUGS-61268, https://issues.redhat.com/browse/OCPBUGS-61270 Signed-off-by: Paul Holzinger <pholzing@redhat.com> Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
19 lines
403 B
Go
19 lines
403 B
Go
//go:build !remote
|
|
|
|
package abi
|
|
|
|
import (
|
|
"os"
|
|
|
|
securejoin "github.com/cyphar/filepath-securejoin"
|
|
)
|
|
|
|
// openSymlinkPath opens the path under root using securejoin.OpenatInRoot().
|
|
func openSymlinkPath(root *os.File, unsafePath string, flags int) (*os.File, error) {
|
|
file, err := securejoin.OpenatInRoot(root, unsafePath)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return securejoin.Reopen(file, flags)
|
|
}
|