MCPcopy
hub / github.com/mudler/LocalAI / InTrustedRoot

Function InTrustedRoot

pkg/utils/path.go:15–23  ·  view source on GitHub ↗
(path string, trustedRoot string)

Source from the content-addressed store, hash-verified

13}
14
15func InTrustedRoot(path string, trustedRoot string) error {
16 for path != "/" {
17 path = filepath.Dir(path)
18 if path == trustedRoot {
19 return nil
20 }
21 }
22 return fmt.Errorf("path is outside of trusted root")
23}
24
25// VerifyPath verifies that path is based in basePath.
26func VerifyPath(path, basePath string) error {

Callers 4

AgentFileEndpointFunction · 0.92
VerifyPathFunction · 0.85
path_test.goFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected