(requestedPath string)
| 9 | ) |
| 10 | |
| 11 | func IsSafePath(requestedPath string) bool { |
| 12 | baseDir := filepath.Clean(fmt.Sprintf("./%s", config.Config.Folder)) |
| 13 | |
| 14 | fullPath := filepath.Join(baseDir, requestedPath) |
| 15 | |
| 16 | cleanPath := filepath.Clean(fullPath) |
| 17 | |
| 18 | return strings.HasPrefix(cleanPath, baseDir) |
| 19 | } |
no outgoing calls
no test coverage detected