(path string, trustedRoot string)
| 13 | } |
| 14 | |
| 15 | func 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. |
| 26 | func VerifyPath(path, basePath string) error { |
no outgoing calls
no test coverage detected