Skip to content

fix(ng-dev/commit-message): harden git log commit parsing against delimiter and metadata smuggling - #4029

Open
josephperrott wants to merge 2 commits into
angular:mainfrom
josephperrott:fix/changelog-commit-parser
Open

josephperrott wants to merge 2 commits into
angular:mainfrom
josephperrott:fix/changelog-commit-parser

Conversation

@josephperrott

Copy link
Copy Markdown
Member

Summary

  • ng-dev/release: Replace the printable delimiter (-------------ɵɵ------------) in fetchCommitsForRevisionRange with a NUL byte (%x00 / \0) so commit bodies containing printable text cannot forge commit boundaries during release notes generation.
  • ng-dev/commit-message & ng-dev/release: Extract the trailing -hash-, -shortHash-, and -author- fields from git log output before passing the commit body to conventional-commits-parser (with fieldPattern disabled), preventing commit body content or git scissor lines (# ------------------------ >8 ------------------------) from spoofing or truncating commit metadata. Additionally sanitize hash and shortHash in RenderContext.commitToLink and RenderContext.commitToBadge to strip Markdown link control characters.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request improves the robustness and security of commit message parsing and release notes generation. It introduces regex-based extraction of git log metadata to prevent body metadata smuggling, replaces the commit split delimiter with a null byte to avoid accidental splitting, and sanitizes commit hashes to prevent Markdown injection. Feedback on the changes highlights a bug in parseInternal where an empty commit message with metadata would incorrectly fall back to parsing the raw metadata; passing messageText directly to the parser is suggested to resolve this.

Comment thread ng-dev/commit-message/parse.ts Outdated
@josephperrott
josephperrott force-pushed the fix/changelog-commit-parser branch from 31b5404 to 551994c Compare October 9, 2026 20:30
@alan-agius4 alan-agius4 added the action: merge The PR is ready for merge by the caretaker label Oct 12, 2026
@josephperrott
josephperrott force-pushed the fix/changelog-commit-parser branch from 551994c to 194b9bd Compare October 12, 2026 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants