isSafeScriptName returns true if the script name is safe for use as a filename component. It rejects names that contain path separators or ".." sequences that could lead to path traversal when the generated filename is passed to require() at runtime.
(name string)
| 79 | // It rejects names that contain path separators or ".." sequences that could lead to |
| 80 | // path traversal when the generated filename is passed to require() at runtime. |
| 81 | func isSafeScriptName(name string) bool { |
| 82 | return !strings.Contains(name, "/") && |
| 83 | !strings.Contains(name, "\\") && |
| 84 | !strings.Contains(name, "..") |
| 85 | } |
| 86 | |
| 87 | // buildCustomSafeOutputScriptsJSON builds a JSON mapping of custom safe output script names to their |
| 88 | // .cjs filenames, for use in the GH_AW_SAFE_OUTPUT_SCRIPTS env var of the handler manager step. |
no outgoing calls