Clarify artifact root symlink behavior

This commit is contained in:
2026-07-05 00:22:54 +00:00
parent 6742def4d3
commit 872c166ed7
6 changed files with 49 additions and 17 deletions

View File

@@ -158,14 +158,15 @@ func (r *restrictedFileReader) Read(ctx context.Context, ref domain.ArtifactRef)
return nil, ErrMissingFilePath
}
path, err := r.resolve(ref.URI)
path, err := r.resolveLexicalPath(ref.URI)
if err != nil {
return nil, err
}
return readFileArtifactWithLimit(path, r.maxBytes)
}
func (r *restrictedFileReader) resolve(rawPath string) (string, error) {
// resolveLexicalPath checks cleaned path containment without resolving symlinks.
func (r *restrictedFileReader) resolveLexicalPath(rawPath string) (string, error) {
cleanPath := filepath.Clean(strings.TrimSpace(rawPath))
var candidate string
if filepath.IsAbs(cleanPath) {