Skip to content

Commit 2046e22

Browse files
committed
fixes
1 parent ee06574 commit 2046e22

5 files changed

Lines changed: 42 additions & 3 deletions

File tree

.claude/skills/triaging-issues/SKILL.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ Rules:
101101
### Comment template mapping
102102

103103
The category flow in the reference files describes the wording of comments
104-
to post. Map the **intent** of that comment to one of the templates below:
104+
to post. Map the **intent** of that comment to one of the seven templates
105+
below (four "stay open" templates and three `close-*` templates):
106+
105107
| Reference flow says to post… | Use template |
106108
|------------------------------|--------------|
107109
| "Acknowledge this bug, we'll investigate" | `ack-bug` |

.github/workflows/review-pr-action.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,19 @@ jobs:
4343
with:
4444
fetch-depth: 1
4545

46+
- name: Lock down scripts/ as read-only
47+
# The agent has the generic `Write` tool (needed to emit the JSON
48+
# decision file). Without this step a compromised prompt/model
49+
# could overwrite an allowlisted script (e.g. get_pr_diff.sh) and
50+
# then execute it via the `Bash(bash scripts/get_pr_diff.sh:*)`
51+
# entry to run arbitrary commands and exfiltrate
52+
# CLAUDE_CODE_API_TOKEN. Stripping write bits on the directory
53+
# and its contents removes that path.
54+
run: |
55+
set -euo pipefail
56+
chmod -R a-w scripts
57+
chmod a-w scripts
58+
4659
- name: Review analysis
4760
uses: anthropics/claude-code-action@v1
4861
env:

.github/workflows/triage-issue-action.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,19 @@ jobs:
4242
with:
4343
fetch-depth: 1
4444

45+
- name: Lock down scripts/ as read-only
46+
# The agent has the generic `Write` tool (needed to emit the JSON
47+
# decision file). Without this step a compromised prompt/model
48+
# could overwrite an allowlisted script (e.g. get_issue.sh) and
49+
# then execute it via the `Bash(bash scripts/get_issue.sh:*)`
50+
# entry to run arbitrary commands and exfiltrate
51+
# CLAUDE_CODE_API_TOKEN. Stripping write bits on the directory
52+
# and its contents removes that path.
53+
run: |
54+
set -euo pipefail
55+
chmod -R a-w scripts
56+
chmod a-w scripts
57+
4558
- name: Triage analysis
4659
uses: anthropics/claude-code-action@v1
4760
env:

scripts/add_comment.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ TEMPLATE=""
3737
PARAMS_FILE=""
3838

3939
require_value() {
40-
if [[ $# -lt 2 || -z "$2" ]]; then
40+
# Treat a missing arg, an empty string, or a next token that looks
41+
# like another flag (`--foo`) as a missing value so the failure points
42+
# at the right argument.
43+
if [[ $# -lt 2 || -z "${2:-}" || "$2" == --* ]]; then
4144
echo "Error: $1 requires a value" >&2
4245
exit 1
4346
fi
@@ -90,6 +93,11 @@ if [[ -n "$PARAMS_FILE" && ! -f "$PARAMS_FILE" ]]; then
9093
exit 1
9194
fi
9295

96+
if ! command -v python3 >/dev/null 2>&1; then
97+
echo "Error: python3 is required to render comment templates but was not found in PATH" >&2
98+
exit 1
99+
fi
100+
93101
# Render the template in Python for robust handling of multi-line values
94102
# and literal-string substitution (no shell-quoting / regex pitfalls).
95103
OUT_FILE=$(mktemp)

scripts/close_issue.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ set -euo pipefail
2020
WORKFLOW=""
2121

2222
require_value() {
23-
if [[ $# -lt 2 || -z "$2" ]]; then
23+
# Treat a missing arg, an empty string, or a next token that looks
24+
# like another flag (`--foo`) as a missing value so the failure points
25+
# at the right argument.
26+
if [[ $# -lt 2 || -z "${2:-}" || "$2" == --* ]]; then
2427
echo "Error: $1 requires a value" >&2
2528
exit 1
2629
fi

0 commit comments

Comments
 (0)