File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Trivy Filesystem Scan
2
+
3
+ on :
4
+ push :
5
+ branches : [ main ] # Запускать при каждом пуше в main
6
+ workflow_dispatch : # Позволяет запускать workflow вручную
7
+
8
+ jobs :
9
+ scan :
10
+ runs-on : ubuntu-latest
11
+
12
+ steps :
13
+ - name : Checkout code
14
+ uses : actions/checkout@v4
15
+
16
+ - name : Run Trivy filesystem scan
17
+ id : trivy
18
+ uses : aquasecurity/trivy-action@master
19
+ with :
20
+ scan-type : ' fs' # Указываем, что сканируем файловую систему
21
+ exit-code : ' 1' # Завершаем workflow с ошибкой, если уязвимости обнаружены
22
+ severity : ' CRITICAL' # Сканируем только на критические уязвимости
23
+
24
+ - name : Output Trivy scan results
25
+ if : always()
26
+ run : |
27
+ echo "Trivy scan results:"
28
+ echo "${{ steps.trivy.outputs.report }}"
29
+
30
+ - name : Fail workflow if vulnerabilities are found
31
+ if : steps.trivy.outputs.exitcode != '0'
32
+ run : |
33
+ echo "::error title=Critical Vulnerabilities Found::Trivy detected critical vulnerabilities in the filesystem."
34
+ exit 1
You can’t perform that action at this time.
0 commit comments