{"record":{"id":"241d7caf61f0a6ec","repo":"Tencent/WeKnora","slug":"sandbox-session-input-path-q-is-outside-s","errorCode":null,"errorMessage":"sandbox: session input path %q is outside %s","messagePattern":"sandbox: session input path %q is outside (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sandbox/session_manager.go","lineNumber":1010,"sourceCode":"\nfunc (m *SessionBoundManager) requireRemoteBackend() error {\n\tif m == nil {\n\t\treturn ErrSandboxDisabled\n\t}\n\tm.mu.RLock()\n\tdefer m.mu.RUnlock()\n\tif m.closed {\n\t\treturn ErrSandboxDisabled\n\t}\n\treturn nil\n}\n\nfunc cleanSessionInputPath(filePath string) (string, error) {\n\tclean := path.Clean(strings.TrimSpace(filePath))\n\tif clean == SessionInputRoot || strings.HasPrefix(clean, SessionInputRoot+\"/\") {\n\t\treturn clean, nil\n\t}\n\treturn \"\", fmt.Errorf(\n\t\t\"sandbox: session input path %q is outside %s\",\n\t\tfilePath, SessionInputRoot,\n\t)\n}\n\n// cleanSessionWorkspaceWritePath keeps model-authored writes inside the\n// session workspace and out of the attachment tree. Validation is lexical\n// (path.Clean plus prefix checks), matching cleanSessionWorkDir.\nfunc cleanSessionWorkspaceWritePath(filePath string) (string, error) {\n\tclean := path.Clean(strings.TrimSpace(filePath))\n\tif !path.IsAbs(clean) || clean == \".\" || clean == \"/\" {\n\t\treturn \"\", fmt.Errorf(\"sandbox: workspace write path %q must be an absolute file path\", filePath)\n\t}\n\tif clean == SessionWorkspaceRoot || clean == SessionOutputRoot || clean == SessionInputRoot {\n\t\treturn \"\", fmt.Errorf(\"sandbox: workspace write path %q is a directory, not a file\", filePath)\n\t}\n\tif !strings.HasPrefix(clean, SessionWorkspaceRoot+\"/\") {\n\t\treturn \"\", fmt.Errorf(\"sandbox: workspace write path %q is outside %s\", filePath, SessionWorkspaceRoot)","sourceCodeStart":992,"sourceCodeEnd":1028,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/sandbox/session_manager.go#L992-L1028","documentation":"Validation guard in cleanSessionInputPath: the caller-supplied path, after path.Clean, does not equal SessionInputRoot and does not live under it. Used by WriteSessionInputFile and RemoveSessionInputPath to confine attachment input operations to the session input tree and block path escape.","triggerScenarios":"Thrown at internal/sandbox/session_manager.go:1010 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Prefix the path with the session input root before calling","Reject the caller-supplied path; do not attempt to 'fix' it by stripping components"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}