(sourceURL string)
| 156 | } |
| 157 | |
| 158 | func validateManifestSourceURL(sourceURL string) error { |
| 159 | sourceURL = strings.TrimSpace(sourceURL) |
| 160 | if sourceURL == "" { |
| 161 | return fmt.Errorf("missing required field source-url") |
| 162 | } |
| 163 | parsed, errParse := url.Parse(sourceURL) |
| 164 | if errParse != nil || parsed.Scheme == "" || parsed.Host == "" { |
| 165 | return fmt.Errorf("invalid source-url") |
| 166 | } |
| 167 | if parsed.Scheme != "https" && parsed.Scheme != "http" { |
| 168 | return fmt.Errorf("source-url must use http or https") |
| 169 | } |
| 170 | if hasSensitiveQueryParameter(parsed) { |
| 171 | return fmt.Errorf("source-url contains sensitive query parameter") |
| 172 | } |
| 173 | return nil |
| 174 | } |
no test coverage detected