1234567891011121314151617181920212223 |
- package tool
- import (
- "path/filepath"
- "strings"
- )
- func IsSameSiteURLPath(url string) bool {
- return len(url) >= 2 && url[0] == '/' && url[1] != '/' && url[1] != '\\'
- }
- func IsMaliciousPath(path string) bool {
- return filepath.IsAbs(path) || strings.Contains(path, "..")
- }
|