T09 · Insecure Skill Coding Practices
- Location
releasenotes.py:34- Finding
Unescaped Git Metadata Allows Markdown and HTML Content Injection
- Content
View full analysis
Vulnerability Details
File Location:
releasenotes.py, lines 34–38 and 69–73
Vulnerability Type: Markdown content injection through untrusted Git metadata
Risk Level: MediumVulnerable Code:
python for line in out.stdout.strip().split("\n"): if not line: continue parts = line.split("|", 3) if len(parts) >= 4: commits.append({"hash": parts[0][:8], "msg": parts[1], "author": parts[2], "date": parts[3][:10]})python if label in groups: lines.append(f"## {label}\n") for c in groups[label]: lines.append(f"- {c['msg']} (`{c['hash']}` by {c['author']})") lines.append("")Technical Analysis
The application treats commit subjects and author names returned by
git logas trusted text. These repository-controlled values are interpolated directly into generated Markdown without escaping Markdown metacharacters or sanitizing raw HTML.An attacker who can contribute a commit can craft its subject or author identity to contain Markdown links, remote images, raw HTML, misleading headings, or other renderer-specific constructs. The payload is retained when release notes are generated. Its ultimate behavior depends on the Markdown renderer and its security configuration.
The subprocess invocation itself uses a list of arguments without
shell=True, so this issue does not provide a shell-command injection path.Attack Path
- An attacker creates or contributes a commit with a crafted subject or author name, such as a deceptive Markdown link, remote tracking image, or raw HTML payload.
- A maintainer accepts the commit into a repository.
- The maintainer runs
releasenotes.pyagainst that repository. - The script reads the attacker-controlled metadata and inserts it verbatim into the generated Markdown.
- The generated release notes are published or viewed through a Markdown renderer.
- The injected content alters the ...[truncated 796 chars]
- Remediation
View remediation
Remediation Suggestions
Treat commit subjects and author names as untrusted content.
- Escape Markdown control characters in both fields before interpolation, including backslashes, backticks, brackets, parentheses, asterisks, underscores, heading markers, and angle brackets.
- Encode or remove raw HTML. If HTML support is required, process generated content with a maintained sanitizer configured with a strict allowlist.
- Consider generating plain-text entries and passing them through a renderer-specific escaping function rather than implementing incomplete ad hoc replacements.
- Configure publication platforms to disable raw HTML and active content in Markdown.
- Add tests containing malicious author names and commit subjects, including links, images, headings, HTML tags, and multiline or delimiter-like content, and verify that they render only as literal text.
- Document that generated release notes contain repository-controlled metadata and must be sanitized before publication in environments that support unsafe Markdown extensions.
