Skip to content

Commit f3a6318

Browse files
committed
changes
1 parent 1110e35 commit f3a6318

1 file changed

Lines changed: 23 additions & 22 deletions

File tree

.github/workflows/semgrep-claude-validator.yml

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@ on:
88
workflow_dispatch:
99

1010
jobs:
11-
semgrep-scan:
12-
name: Run Semgrep & Validate with Claude
11+
semgrep:
12+
name: Run Semgrep & Validate
1313
runs-on: ubuntu-latest
1414
permissions:
1515
contents: write
1616
id-token: write
17-
pull-requests: write
1817

1918
steps:
2019
- name: Checkout repository
@@ -39,36 +38,38 @@ jobs:
3938
semgrep --config auto --json > semgrep-report.json
4039
semgrep --config auto --text > semgrep-report.txt
4140
42-
- name: Validate Semgrep findings with Claude
41+
- name: Validate findings with Claude AI
4342
if: always()
4443
uses: anthropics/claude-code-action@v1
4544
with:
4645
anthropic_api_key: ${{ secrets.ANTROPIC_API_KEY }}
46+
claude_args: '--allowed-tools Read,Grep,Glob,Bash'
4747
prompt: |
48-
I need you to validate the Semgrep security findings in semgrep-report.json.
48+
Validate the Semgrep security findings in semgrep-report.json.
4949
50-
For EACH finding in the JSON file:
51-
1. Read the actual source code file at the path mentioned in the finding
52-
2. Examine the specific line numbers where the issue was detected
53-
3. Understand the full context of the code (read surrounding code, understand data flow)
54-
4. Determine if this is a TRUE POSITIVE (real security vulnerability) or FALSE POSITIVE (safe code incorrectly flagged)
50+
For EACH finding:
51+
1. Read the source code file at the reported path
52+
2. Examine the specific line numbers
53+
3. Analyze the code context and data flow
54+
4. Determine: TRUE POSITIVE (real vulnerability) or FALSE POSITIVE (safe code)
5555
56-
For each finding, add these fields:
57-
- "is_false_positive": true or false
58-
- "validation_reason": "Detailed explanation of why this is classified as true/false positive"
56+
Add these fields to each result:
57+
- "is_false_positive": true/false
58+
- "validation_reason": "Detailed explanation"
5959
60-
Consider in your analysis:
61-
- Is user input involved? Is it properly validated/sanitized?
62-
- Can this vulnerability actually be exploited in practice?
63-
- Are there framework-specific protections in place (e.g., Django ORM, parameterized queries)?
64-
- Is the flagged code path actually reachable and executable?
65-
- What is the full data flow context?
60+
Consider:
61+
- Is user input properly validated/sanitized?
62+
- Can the vulnerability be exploited?
63+
- Are framework protections in place?
64+
- Is the code path reachable?
6665
67-
After validating ALL findings, save the enhanced JSON with validation fields to: semgrep-report-validated.json
66+
After validating ALL findings, use the Bash tool to save the validated JSON:
6867
69-
Be thorough and examine the actual code before making your determination. Do not guess.
68+
cat > semgrep-report-validated.json << 'EOF'
69+
{complete validated JSON with all original fields plus validation fields}
70+
EOF
7071
71-
- name: Upload all reports
72+
- name: Upload reports
7273
if: always()
7374
uses: actions/upload-artifact@v4
7475
with:

0 commit comments

Comments
 (0)