mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-08-22 03:18:54 +08:00
fix: teach claude_args --allowedTools in the signed prompt (#1704)
allowed_tools was removed in v1.0. The tag-mode prompt still named it as the way to enable Bash under commit signing. Co-authored-by: RESILIENCE Agentic Solutions <286555414+WeAreResilience@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
RESILIENCE Agentic Solutions
Cursor
parent
2ca5fb4027
commit
492d2d78ee
@@ -856,7 +856,7 @@ What You CANNOT Do:
|
||||
- Submit formal GitHub PR reviews
|
||||
- Approve pull requests (for security reasons)
|
||||
- Post multiple comments (you only update your initial comment)
|
||||
- Execute commands outside the repository context${useCommitSigning ? "\n- Run arbitrary Bash commands (unless explicitly allowed via allowed_tools configuration)" : ""}
|
||||
- Execute commands outside the repository context${useCommitSigning ? "\n- Run arbitrary Bash commands (unless explicitly allowed via claude_args with --allowedTools)" : ""}
|
||||
- Perform branch operations (cannot merge branches, rebase, or perform other git operations beyond creating and pushing commits)
|
||||
- Modify files in the .github/workflows directory (GitHub App permissions do not allow workflow modifications)
|
||||
|
||||
|
||||
@@ -824,6 +824,35 @@ describe("generatePrompt", () => {
|
||||
|
||||
// Should not have git command instructions
|
||||
expect(prompt).not.toContain("Use git commands via the Bash tool");
|
||||
|
||||
// Bash is off unless the user passes --allowedTools through claude_args.
|
||||
// allowed_tools was removed in v1.0 and must not appear as live guidance.
|
||||
expect(prompt).toContain(
|
||||
"Run arbitrary Bash commands (unless explicitly allowed via claude_args with --allowedTools)",
|
||||
);
|
||||
expect(prompt).not.toContain("allowed_tools configuration");
|
||||
});
|
||||
|
||||
test("does not mention allowed_tools when commit signing is off", async () => {
|
||||
const envVars: PreparedContext = {
|
||||
repository: "owner/repo",
|
||||
claudeCommentId: "12345",
|
||||
triggerPhrase: "@claude",
|
||||
eventData: {
|
||||
eventName: "issue_comment",
|
||||
commentId: "67890",
|
||||
isPR: true,
|
||||
prNumber: "123",
|
||||
commentBody: "@claude fix the bug",
|
||||
},
|
||||
};
|
||||
|
||||
const prompt = await generatePrompt(envVars, mockGitHubData, false, "tag");
|
||||
|
||||
expect(prompt).not.toContain("allowed_tools");
|
||||
expect(prompt).not.toContain(
|
||||
"Run arbitrary Bash commands (unless explicitly allowed",
|
||||
);
|
||||
});
|
||||
|
||||
describe("simplified prompt (USE_SIMPLE_PROMPT)", () => {
|
||||
|
||||
Reference in New Issue
Block a user