isValidFileExtension reports whether s is a valid file extension of the form ^\.[A-Za-z0-9]+$ (e.g. ".json", ".md"). This strict pattern prevents YAML injection when extensions are embedded in generated workflow YAML as single-quoted scalars.
(s string)
| 79 | // (e.g. ".json", ".md"). This strict pattern prevents YAML injection when extensions are |
| 80 | // embedded in generated workflow YAML as single-quoted scalars. |
| 81 | func isValidFileExtension(s string) bool { |
| 82 | if len(s) < 2 || s[0] != '.' { |
| 83 | return false |
| 84 | } |
| 85 | for _, c := range s[1:] { |
| 86 | isLower := c >= 'a' && c <= 'z' |
| 87 | isUpper := c >= 'A' && c <= 'Z' |
| 88 | isDigit := c >= '0' && c <= '9' |
| 89 | if !isLower && !isUpper && !isDigit { |
| 90 | return false |
| 91 | } |
| 92 | } |
| 93 | return true |
| 94 | } |
| 95 | |
| 96 | // CacheMemoryConfig holds configuration for cache-memory functionality |
| 97 | type CacheMemoryConfig struct { |
no outgoing calls