T09 · Insecure Skill Coding Practices
- Location
scripts/gather_commits.sh:59- Finding
Arbitrary Code Execution Through Git Reference Injection
- Content
View full analysis
- Remediation
View remediation
5 else "" }) result = { "from_ref": os.environ["FROM_REF"], "to_ref": os.environ["TO_REF"], "commit_count": int(os.environ["COMMIT_COUNT"]), "author_count": int(os.environ["AUTHOR_COUNT"]), "commits": commits } print(json.dumps(result, indent=2)) ' ``` Additional hardening measures: 1. Resolve each input to a canonical object ID with `git rev-parse --verify` and use the resolved IDs for revision traversal where practical. 2. Insert `--` where supported to distinguish revisions from options. 3. Consider enforcing an explicit allowlist for accepted reference syntax if human-readable names must be preserved. 4. Add regression tests using valid Git references containing single quotes, plus signs, parentheses, semicolons, and separator-like text. 5. Verify that unusual commit content cannot corrupt field parsing; preferably use NUL-delimited Git output rather than textual separator strings. ]]>
