-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
133 lines (109 loc) · 3.94 KB
/
Copy pathaction.yml
File metadata and controls
133 lines (109 loc) · 3.94 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Bawbel Scanner
description: "Scan agentic AI components — MCP servers, skills, system prompts — for AVE vulnerabilities before they reach production."
author: Bawbel
branding:
icon: shield
color: green
inputs:
path:
description: "Path to scan (file or directory)"
required: false
default: "."
recursive:
description: "Scan directories recursively"
required: false
default: "true"
fail-on-severity:
description: "Exit with code 2 if findings at this severity or above. One of: critical, high, medium, low, none"
required: false
default: "high"
format:
description: "Output format. One of: text, json, sarif"
required: false
default: "sarif"
no-ignore:
description: "Override all bawbel-ignore suppressions (audit mode)"
required: false
default: "false"
version:
description: "Bawbel Scanner version to install (default: latest)"
required: false
default: "latest"
extras:
description: "pip extras to install. One of: yara, semgrep, llm, magika, all"
required: false
default: "all"
outputs:
sarif-file:
description: "Path to the generated SARIF file (when format is sarif)"
value: ${{ steps.scan.outputs.sarif-file }}
findings-count:
description: "Number of active findings"
value: ${{ steps.scan.outputs.findings-count }}
risk-score:
description: "Risk score 0.0 to 10.0"
value: ${{ steps.scan.outputs.risk-score }}
result:
description: "clean or findings"
value: ${{ steps.scan.outputs.result }}
runs:
using: composite
steps:
- name: Install Bawbel Scanner
shell: bash
run: |
if [ "${{ inputs.version }}" = "latest" ]; then
pip install "bawbel-scanner[${{ inputs.extras }}]" --quiet
else
pip install "bawbel-scanner[${{ inputs.extras }}]==${{ inputs.version }}" --quiet
fi
- name: Run Bawbel scan
id: scan
shell: bash
run: |
ARGS="--format ${{ inputs.format }}"
if [ "${{ inputs.recursive }}" = "true" ]; then
ARGS="$ARGS --recursive"
fi
if [ "${{ inputs.no-ignore }}" = "true" ]; then
ARGS="$ARGS --no-ignore"
fi
if [ "${{ inputs.format }}" = "sarif" ]; then
SARIF_FILE="bawbel-results.sarif"
bawbel scan "${{ inputs.path }}" $ARGS > "$SARIF_FILE" 2>/dev/null || true
echo "sarif-file=$SARIF_FILE" >> $GITHUB_OUTPUT
fi
JSON_OUT=$(bawbel scan "${{ inputs.path }}" $ARGS --format json 2>/dev/null || echo "[]")
FINDINGS=$(echo "$JSON_OUT" | python3 -c "
import json,sys
data = json.load(sys.stdin)
total = sum(len(r.get('findings',[])) for r in data)
score = max((r.get('risk_score',0) for r in data), default=0)
result = 'findings' if total > 0 else 'clean'
print('count=' + str(total))
print('score=' + str(round(score, 1)))
print('result=' + result)
" 2>/dev/null || printf "count=0\nscore=0.0\nresult=clean")
echo "findings-count=$(echo "$FINDINGS" | grep count= | cut -d= -f2)" >> $GITHUB_OUTPUT
echo "risk-score=$(echo "$FINDINGS" | grep score= | cut -d= -f2)" >> $GITHUB_OUTPUT
echo "result=$(echo "$FINDINGS" | grep result= | cut -d= -f2)" >> $GITHUB_OUTPUT
- name: Check severity threshold
shell: bash
run: |
if [ "${{ inputs.fail-on-severity }}" = "none" ]; then
exit 0
fi
COUNT="${{ steps.scan.outputs.findings-count }}"
if [ -z "$COUNT" ] || [ "$COUNT" = "0" ]; then
exit 0
fi
EXTRA_ARGS=""
if [ "${{ inputs.recursive }}" = "true" ]; then
EXTRA_ARGS="$EXTRA_ARGS --recursive"
fi
if [ "${{ inputs.no-ignore }}" = "true" ]; then
EXTRA_ARGS="$EXTRA_ARGS --no-ignore"
fi
bawbel scan "${{ inputs.path }}" $EXTRA_ARGS \
--fail-on-severity "${{ inputs.fail-on-severity }}" \
--format text