{"record":{"id":"2a8ab3f708667575","repo":"juicedata/juicefs","slug":"object-key-q-escapes-storage-root-q","errorCode":null,"errorMessage":"object key %q escapes storage root %q","messagePattern":"object key %q escapes storage root %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/object/file.go","lineNumber":92,"sourceCode":"\treturn \"file://\" + d.root\n}\n\nfunc (d *filestore) path(key string) (string, error) {\n\tvar p string\n\tif strings.HasSuffix(d.root, dirSuffix) {\n\t\tp = filepath.Join(d.root, key)\n\t} else {\n\t\tp = filepath.Clean(d.root + key)\n\t}\n\n\tboundary := d.root\n\tif !strings.HasSuffix(boundary, dirSuffix) {\n\t\tboundary = filepath.Dir(boundary)\n\t}\n\n\trel, err := filepath.Rel(boundary, p)\n\tif err != nil || rel == \"..\" || strings.HasPrefix(rel, \"..\"+string(filepath.Separator)) {\n\t\treturn \"\", fmt.Errorf(\"object key %q escapes storage root %q\", key, d.root)\n\t}\n\n\treturn p, nil\n}\n\nfunc (d *filestore) Head(ctx context.Context, key string) (Object, error) {\n\tp, err := d.path(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfi, err := os.Lstat(p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tisSymlink := fi.Mode()&os.ModeSymlink != 0\n\tif isSymlink {\n\t\tfi, err = os.Stat(p)\n\t\tif err != nil {","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/object/file.go#L74-L110","documentation":"Returned by filestore.path when resolving an object key inside the storage root would escape the root directory — the cleaned path's relation to the boundary starts with '..'. It is a path-traversal guard for file:// backed storage, so keys containing ../ sequences or absolute paths are rejected.","triggerScenarios":"Thrown at pkg/object/file.go:92 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use object keys that stay inside the configured storage root","Sanitize keys that embed '..' or leading slashes before passing them to the file backend"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}