fix: allow '#' in branch names for Azure DevOps integration#1032
Open
MaxwellCalkin wants to merge 1 commit intoanthropics:mainfrom
Open
fix: allow '#' in branch names for Azure DevOps integration#1032MaxwellCalkin wants to merge 1 commit intoanthropics:mainfrom
MaxwellCalkin wants to merge 1 commit intoanthropics:mainfrom
Conversation
The branch name validation regex rejected the '#' character, which is commonly used in Azure DevOps branch naming conventions (e.g., "feature/AB#1992-sentry-enhancements"). The '#' character is valid in git branch names and poses no command injection risk. Updated the whitelist pattern to include '#' and added corresponding test cases. Fixes anthropics#1024 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#character, which breaks Azure DevOps integration where branch names commonly include work item references (e.g.,feature/AB#1992-sentry-enhancements)[a-zA-Z0-9/_.-]to[a-zA-Z0-9/_#.-]#charactersDetails
The
#character is valid in git branch names and poses no command injection risk (it's a comment character in shell butexecFileSyncis used, which bypasses shell interpretation). Azure DevOps automatically creates branch names containing#when linking branches to work items.Changed files:
src/github/operations/branch.ts— Added#to the valid character whitelist pattern and updated comments/error messagetest/validate-branch-name.test.ts— Added test case for hash-containing branch namesFixes #1024
Test plan
bun test test/validate-branch-name.test.ts)feature/AB#1992-sentry-enhancements,fix/PROJ#123-bug,user/task#42🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com