T09 · Insecure Skill Coding Practices
- Location
scripts/scaffold.sh:31- Finding
Unescaped Project Name Allows Generated JSON Injection and Corruption
- Content
View full analysis
"$PROJECT_NAME/metadata.json" <- Remediation
View remediation
"$PROJECT_DIR/metadata.json" ``` 2. Quote all shell expansions, including: ```bash printf '%s' "$PROJECT_NAME" ``` 3. Separate the display name from the filesystem directory name. Restrict the directory name to an allowlist such as letters, digits, underscores, and hyphens. 4. Resolve the destination to a canonical path and verify that it remains under an explicitly approved workspace. 5. Refuse to overwrite an existing project unless the caller supplies an explicit, documented overwrite option. 6. Validate the generated file with `jq empty metadata.json` before reporting successful initialization. ]]>
