validateSafeOutputsURLs validates the urls policy in safe-outputs.
(config *SafeOutputsConfig)
| 16 | |
| 17 | // validateSafeOutputsURLs validates the urls policy in safe-outputs. |
| 18 | func validateSafeOutputsURLs(config *SafeOutputsConfig) error { |
| 19 | if config == nil || config.URLs == "" { |
| 20 | return nil |
| 21 | } |
| 22 | |
| 23 | switch config.URLs { |
| 24 | case SafeOutputsURLsPolicyAllowedOnly, SafeOutputsURLsPolicyAllowedOrCodeRegion: |
| 25 | return nil |
| 26 | default: |
| 27 | return fmt.Errorf( |
| 28 | "safe-outputs.urls: invalid value %q (expected one of: %q, %q)", |
| 29 | config.URLs, |
| 30 | SafeOutputsURLsPolicyAllowedOnly, |
| 31 | SafeOutputsURLsPolicyAllowedOrCodeRegion, |
| 32 | ) |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | // validateSafeOutputsAllowedDomains validates the allowed-domains configuration in safe-outputs. |
| 37 | // Supports ecosystem identifiers (e.g., "python", "node", "default-safe-outputs") like network.allowed. |