T09 · Insecure Skill Coding Practices
- Location
scripts/record-proof.js:42- Finding
Shell Command Injection Through Unvalidated start_port
- Content
View full analysis
- Remediation
View remediation
65535) { throw new Error('start_port must be an integer between 1 and 65535'); } ``` - Eliminate the shell from readiness checks. Prefer Node.js networking APIs such as `http.request`, `fetch`, or `net.connect`. - If `curl` must be used, invoke it with `execFileSync` or `spawnSync` and pass arguments as an array: ```js execFileSync( 'curl', ['-sf', '-o', '/dev/null', `http://localhost:${port}`], { timeout: 5000 } ); ``` - Apply the same correction independently in both `record-proof.js` and `api-proof.js`. - Add regression tests using string, negative, out-of-range, and shell-metacharacter port values. ]]>
