T09 · Insecure Skill Coding Practices
- Location
scripts/new-pipeline.sh:23- Finding
Unescaped Pipeline Description Allows Generated TypeScript Code Injection
- Content
View full analysis
"$OUTPUT_FILE" ``` The substituted value is placed directly inside executable TypeScript: ```ts export default pipeline({ id: '{{ID}}', description: '{{DESCRIPTION}}', input: z.object({ ``` The agent template contains the equivalent sink: ```ts export default pipeline({ id: '{{ID}}', description: '{{DESCRIPTION}}', input: z.object({ ``` ### Technical Analysis The script accepts the description as arbitrary text and inserts it into both: 1. A dynamically constructed `sed` replacement expression. 2. A single-quoted TypeScript string literal. The value is not escaped for either syntax. Characters such as single quotes, backslashes, replacement metacharacters, and newlines can alter or terminate the intended string. An attacker can supply a description that closes the `description` string and adds additional object properties containing immediately invoked JavaScript or TypeScript expressions. For example, the general payload structure can introduce an expression similar to: ```text ', injected: (() => { /* attacker-controlled code */ })(), trailing: ' ``` This can produce syntactically valid TypeScript where the injected expression executes while the generated workflow module is imported. Pipeline execution is not necessarily required: any operation that imports the module may trigger top-level evaluation. This is an injection vulnerability rather than intentional malicious code in the shipped templates. ### Attack Path 1. An attacker cont ...[truncated 1293 chars]- Remediation
View remediation
