{"record":{"id":"f70fa8fe3c4db8e3","repo":"googleapis/mcp-toolbox","slug":"path-is-empty","errorCode":null,"errorMessage":"path is empty","messagePattern":"path is empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/cloudstorage/cloudstoragecommon/paths.go","lineNumber":35,"sourceCode":"import (\n\t\"errors\"\n\t\"fmt\"\n\t\"io/fs\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n)\n\n// ValidateLocalPath enforces the local-filesystem path contract used by\n// download_object and upload_object: non-empty, absolute after filepath.Clean,\n// and free of \"..\" components. It returns the cleaned path. OS permissions\n// remain the real isolation boundary; this check just prevents obvious\n// traversal mistakes and forces callers to be explicit about where they want\n// bytes to land. Confining a path to a configured directory is a separate\n// concern; see ResolveWithinDir and ResolveSymlinks.\nfunc ValidateLocalPath(p string) (string, error) {\n\tif p == \"\" {\n\t\treturn \"\", fmt.Errorf(\"path is empty\")\n\t}\n\t// Reject any \"..\" segment in the raw input. We check the raw input\n\t// (not just the cleaned output) so that escapes like\n\t// \"/legit/../../etc/passwd\" — which filepath.Clean collapses to an\n\t// innocuous-looking absolute path — are still rejected. Legitimate\n\t// names that happen to *contain* two dots (e.g. \"foo..bar\") are fine;\n\t// only a standalone \"..\" segment is disallowed.\n\tfor _, seg := range strings.FieldsFunc(p, func(r rune) bool {\n\t\treturn r == '/' || r == '\\\\'\n\t}) {\n\t\tif seg == \"..\" {\n\t\t\treturn \"\", fmt.Errorf(\"path %q contains '..'\", p)\n\t\t}\n\t}\n\tclean := filepath.Clean(p)\n\tif !filepath.IsAbs(clean) {\n\t\treturn \"\", fmt.Errorf(\"path %q must be absolute\", p)\n\t}","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/cloudstorage/cloudstoragecommon/paths.go#L17-L53","documentation":"ValidateLocalPath's empty-string guard fired: the path passed to a Cloud Storage download/upload tool is \"\", which cannot be a valid local filesystem target.","triggerScenarios":"Thrown at internal/tools/cloudstorage/cloudstoragecommon/paths.go:35 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a non-empty local file path parameter","Check that the agent/tool call actually supplied the path argument","Validate input earlier in the tool flow"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}