mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-08-22 11:28:55 +08:00
fix: allow + in branch names (generated by Claude Code EnterWorktree) (#1248)
Claude Code's EnterWorktree tool converts "/" to "+" when generating
branch names from worktree names (e.g. EnterWorktree("feat/foo") creates
branch "worktree-feat+foo"). The strict whitelist in validateBranchName
rejected these names, causing claude-code-action to fail on any PR opened
from an EnterWorktree-generated branch.
Since all git calls use execFileSync (not shell interpolation), "+" carries
no command injection risk — the same rationale used for allowing "#".
Git itself permits "+" in branch names per git-check-ref-format.
Fixes: https://github.com/anthropics/claude-code-action/issues/1244
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
b4d6741327
commit
6ee201f023
@@ -45,6 +45,16 @@ describe("validateBranchName", () => {
|
||||
).not.toThrow();
|
||||
expect(() => validateBranchName("fix/issue-#42")).not.toThrow();
|
||||
});
|
||||
|
||||
it("should accept branch names containing + (generated by Claude Code EnterWorktree)", () => {
|
||||
// EnterWorktree converts "/" in worktree names to "+" when generating branch names.
|
||||
// e.g. EnterWorktree("feat/skill-consolidation") → branch "worktree-feat+skill-consolidation"
|
||||
expect(() =>
|
||||
validateBranchName("worktree-feat+skill-consolidation"),
|
||||
).not.toThrow();
|
||||
expect(() => validateBranchName("fix+issue-123")).not.toThrow();
|
||||
expect(() => validateBranchName("feature+new-thing")).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe("command injection attempts", () => {
|
||||
|
||||
Reference in New Issue
Block a user