Skip to content

Commit 8698d4a

Browse files
authored
Create trivy-scan-fs.yml
1 parent 4275c5b commit 8698d4a

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

workflows/trivy-scan-fs.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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

0 commit comments

Comments
 (0)