mirror of
https://github.com/containers/podman.git
synced 2025-07-02 00:30:00 +08:00
libartifact: NewArtifactStore() reject relative paths
The oci layout code can handle a relative path find but all paths returned by the code then will alos be relative, this can be bad and result in bugs if something ever changes the cwd. The graphroot path we pass should already be always absolute, so just add a sanity check here given libartifact is planned to be moved as sperate lib and we cannot assume anything about the path we will be given there. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -47,6 +47,10 @@ func NewArtifactStore(storePath string, sc *types.SystemContext) (*ArtifactStore
|
||||
if storePath == "" {
|
||||
return nil, errors.New("store path cannot be empty")
|
||||
}
|
||||
if !filepath.IsAbs(storePath) {
|
||||
return nil, fmt.Errorf("store path %q must be absolute", storePath)
|
||||
}
|
||||
|
||||
logrus.Debugf("Using artifact store path: %s", storePath)
|
||||
|
||||
artifactStore := &ArtifactStore{
|
||||
|
Reference in New Issue
Block a user