-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinjection-scan.yml
More file actions
44 lines (37 loc) · 1.42 KB
/
Copy pathinjection-scan.yml
File metadata and controls
44 lines (37 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Copy to .github/workflows/injection-scan.yml in your repo.
#
# Gates PRs on the prompt-injection robustness of your agent and surfaces
# findings in the GitHub Security tab. Fails the check (blocking merge) if the
# agent regresses below the gate configured in .dspy-security-bench.yaml.
name: injection-scan
on:
pull_request:
workflow_dispatch:
permissions:
contents: read
security-events: write # required to upload SARIF to the Security tab
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.12"
- run: pip install dspy-security-bench
- name: Run injection scan
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
# add whichever provider keys your agent needs, e.g.:
# ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
# MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
run: |
dspy-security-bench scan \
--config .dspy-security-bench.yaml \
--sarif dsb.sarif
# Upload findings to the Security tab even if the gate failed.
- name: Upload SARIF
if: always()
uses: github/codeql-action/upload-sarif@5595ccaf912efad79be6eef63a5619ff05969be3 # v4
with:
sarif_file: dsb.sarif