()
| 193 | } |
| 194 | |
| 195 | func buildWorkflowCallNetworkAllowedUpdateScript() (string, error) { |
| 196 | ecosystemDomains := getLoadedEcosystemDomains() |
| 197 | ecosystemMap := make(map[string][]string, safeAllocationCapacity(len(ecosystemDomains), len(compoundEcosystems))) |
| 198 | for ecosystem := range ecosystemDomains { |
| 199 | ecosystemMap[ecosystem] = getEcosystemDomains(ecosystem) |
| 200 | } |
| 201 | for ecosystem := range compoundEcosystems { |
| 202 | ecosystemMap[ecosystem] = getEcosystemDomains(ecosystem) |
| 203 | } |
| 204 | |
| 205 | ecosystemJSON, err := json.Marshal(ecosystemMap) |
| 206 | if err != nil { |
| 207 | return "", fmt.Errorf("marshal network allowed ecosystem map: %w", err) |
| 208 | } |
| 209 | |
| 210 | // Pass the ecosystem map JSON via an env var and invoke the JavaScript |
| 211 | // implementation deployed by actions/setup to ${RUNNER_TEMP}/gh-aw/actions/. |
| 212 | // Using node avoids any Python dependency and eliminates quote-injection risk: |
| 213 | // shellEscapeArg safely single-quotes and escapes the JSON payload. |
| 214 | return fmt.Sprintf(`GH_AW_ECOSYSTEM_MAP_JSON=%s node "${RUNNER_TEMP}/gh-aw/actions/update_network_allowed.cjs"`, |
| 215 | shellEscapeArg(string(ecosystemJSON))), nil |
| 216 | } |
| 217 | |
| 218 | // BuildAWFCommand builds a complete AWF command with all arguments. |
| 219 | // This consolidates the AWF command building logic that was duplicated across |
no test coverage detected