parseTargetRepoWithValidation extracts the target-repo value from a config map and validates it. Returns the target repository slug as a string, or empty string if not present or invalid. Returns an error (indicated by the second return value being true) if the value is "*" (wildcard), which is not
(configMap map[string]any)
| 126 | // Returns an error (indicated by the second return value being true) if the value is "*" (wildcard), |
| 127 | // which is not allowed for safe output target repositories. |
| 128 | func parseTargetRepoWithValidation(configMap map[string]any) (string, bool) { |
| 129 | targetRepoSlug := extractStringFromMap(configMap, "target-repo", configHelpersLog) |
| 130 | // Validate that target-repo is not "*" - only definite strings are allowed |
| 131 | if targetRepoSlug == "*" { |
| 132 | configHelpersLog.Print("Invalid target-repo: wildcard '*' is not allowed") |
| 133 | return "", true // Return true to indicate validation error |
| 134 | } |
| 135 | return targetRepoSlug, false |
| 136 | } |
| 137 | |
| 138 | // NOTE: parseExpiresFromConfig and parseRelativeTimeSpec have been moved to time_delta.go |
| 139 | // to consolidate all time parsing logic in a single location. These functions are used |