fix: allow @, +, and Unicode branch names#1022
fix: allow @, +, and Unicode branch names#1022Lubrsy706 wants to merge 2 commits intoanthropics:mainfrom
Conversation
|
Friendly ping: this PR has been ready for review since March 6, 2026. If there is anything blocking it or if you would prefer changes before merge, let me know and I can update it. Would appreciate a review when someone has time. |
|
Updated this PR to include |
|
Following up on this PR. The branch-name handling change should be ready for review; please let me know if you'd like any updates or additional test coverage from my side. |
Update the whitelist regex in validateBranchName to support: - `@` character (anthropics#998): valid in git branch names, only `@{` is reserved (already checked separately) - Unicode letters via `\p{L}` (anthropics#1020): enables non-ASCII branch names like Japanese, Chinese, Cyrillic characters Fixes anthropics#998 Fixes anthropics#1020 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
e6978c5 to
2fe35e5
Compare
|
Rebased this branch onto the latest |
|
Following up on this PR. The branch-name handling fix should be ready for review; if you would like any adjustments or broader coverage for special-character branch names, I can update it. Would appreciate a review when someone has time. |
Summary
Fixes #998 and #1020
The whitelist regex in
validateBranchName(src/github/operations/branch.ts) previously rejected valid git branch names containing@,+, or non-ASCII Unicode characters.Changes
src/github/operations/branch.tsto allow@,+, and Unicode letters/numbers in branch names@{,.lock,.., consecutive/, and invalid ref characterstest/validate-branch-name.test.tswith coverage for+alongside the existing@and Unicode casesSecurity
The
@{reflog syntax is still rejected explicitly. Control characters, shell metacharacters, and Git-special characters like~,^,:,?,*,[,], and\remain blocked. The validator still forbids names that could trigger option injection or path traversal.Test plan
bun test test/validate-branch-name.test.tsbun run typecheck