INNER CODE UNIT · Go

min

orneryd/NornicDB · cmd/eval/main.go:460

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

// validateURL validates that the URL is well-formed, uses an allowed scheme,
// and targets only allowed hosts. This prevents SSRF attacks by resolving
// hostnames and checking actual IP addresses (blocking bypass techniques like
// octal IPs, IPv4-mapped IPv6, etc.).
func validateURL(rawURL string) error {
	parsed, err := url.Parse(rawURL)
	if err != nil {
		return fmt.Errorf("malformed URL: %w", err)
	}
	// Only allow http and https schemes
	if parsed.Scheme != "http" && parsed.Scheme != "https" {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…