-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
97 lines (97 loc) · 3.35 KB
/
Copy pathaction.yml
File metadata and controls
97 lines (97 loc) · 3.35 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
name: Agentic Workflow Guard
author: guorunjie
description: Scan AI automation workflows for prompt injection, risky tools, CI side effects, MCP exposure, and overpowered permissions.
branding:
icon: shield
color: blue
inputs:
path:
description: Repository path to scan.
required: false
default: .
format:
description: "Output format: markdown, json, or sarif."
required: false
default: sarif
output:
description: Optional report output file. Defaults to awg.sarif for SARIF scans.
required: false
default: awg.sarif
profile:
description: "Policy profile: advisory, balanced, or strict."
required: false
default: balanced
baseline:
description: Optional .awg-baseline.json file for suppressing existing findings.
required: false
default: ""
fix-format:
description: "Optional fix report format: markdown or json."
required: false
default: json
fix-output:
description: Optional fix report output file for PR bots and follow-up jobs. Leave empty to skip fix report generation.
required: false
default: ""
outputs:
report-path:
description: Path to the generated report file.
value: ${{ steps.guard.outputs.report-path }}
fix-report-path:
description: Path to the generated fix report file, when fix-output is set.
value: ${{ steps.guard.outputs.fix-report-path }}
runs:
using: composite
steps:
- name: Run Agentic Workflow Guard
id: guard
shell: bash
env:
AWG_PATH: ${{ inputs.path }}
AWG_FORMAT: ${{ inputs.format }}
AWG_OUTPUT: ${{ inputs.output }}
AWG_PROFILE: ${{ inputs.profile }}
AWG_BASELINE: ${{ inputs.baseline }}
AWG_FIX_FORMAT: ${{ inputs.fix-format }}
AWG_FIX_OUTPUT: ${{ inputs.fix-output }}
run: |
set +e
args=(scan "$AWG_PATH" --format "$AWG_FORMAT" --profile "$AWG_PROFILE")
if [ -n "$AWG_BASELINE" ]; then
args+=(--baseline "$AWG_BASELINE")
fi
if [ -n "$AWG_OUTPUT" ]; then
args+=(--output "$AWG_OUTPUT")
fi
node "$GITHUB_ACTION_PATH/bin/agentic-workflow-guard.js" "${args[@]}"
status=$?
if [ -n "$AWG_OUTPUT" ]; then
echo "report-path=$AWG_OUTPUT" >> "$GITHUB_OUTPUT"
fi
if [ -n "$AWG_FIX_OUTPUT" ]; then
fix_args=(fix "$AWG_PATH" --format "$AWG_FIX_FORMAT" --output "$AWG_FIX_OUTPUT")
node "$GITHUB_ACTION_PATH/bin/agentic-workflow-guard.js" "${fix_args[@]}"
fix_status=$?
if [ "$fix_status" -ne 0 ] && [ "$status" -eq 0 ]; then
status="$fix_status"
fi
if [ "$fix_status" -eq 0 ]; then
echo "fix-report-path=$AWG_FIX_OUTPUT" >> "$GITHUB_OUTPUT"
fi
fi
{
echo "## Agentic Workflow Guard"
echo
summary_args=(scan "$AWG_PATH" --format markdown --profile "$AWG_PROFILE")
if [ -n "$AWG_BASELINE" ]; then
summary_args+=(--baseline "$AWG_BASELINE")
fi
node "$GITHUB_ACTION_PATH/bin/agentic-workflow-guard.js" "${summary_args[@]}"
if [ -n "$AWG_FIX_OUTPUT" ]; then
echo
echo "### Fix report"
echo
echo "Generated \`$AWG_FIX_FORMAT\` fix report at \`$AWG_FIX_OUTPUT\`."
fi
} >> "$GITHUB_STEP_SUMMARY" || true
exit "$status"