Skip to content

Commit 8b9ab99

Browse files
authored
Update security-gateway.yml
1 parent ef51eb6 commit 8b9ab99

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

.github/workflows/security-gateway.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,15 @@ jobs:
4141
scan-type: fs # Сканирование файловой системы
4242
severity: CRITICAL,HIGH # Проверка только критических и высоких угроз
4343
exit-code: '1' # Возвращает ошибку, если найдены уязвимости
44+
format: json # Форматирует результаты в JSON
45+
output: trivy-report.json # Сохраняет результаты в файл
4446

4547
- name: Check Trivy results and stop release if vulnerabilities found
4648
if: steps.trivy-scan.outcome == 'failure'
4749
run: |
4850
echo "Critical or high vulnerabilities found! Stopping the release."
4951
exit 1 # Останавливаем пайплайн, если найдены критические уязвимости
5052
51-
- name: Generate Trivy report
52-
if: always() # Выполняется всегда, даже если предыдущие шаги завершились с ошибкой
53-
run: |
54-
trivy result --format json --output trivy-report.json .
55-
if [ -f "trivy-report.json" ]; then
56-
echo "Trivy report generated successfully."
57-
else
58-
echo "Trivy report not found!"
59-
fi
60-
6153
- name: Upload Trivy report as artifact
6254
if: always() # Выполняется всегда
6355
uses: actions/upload-artifact@v4
@@ -74,7 +66,7 @@ jobs:
7466
7567
Critical or high vulnerabilities have been detected by Trivy:
7668
77-
$(cat trivy-report.json | jq -r '.Results[] | .Vulnerabilities[] | "\(.PkgName): \(.VulnerabilityID) - \(.Severity)"' || echo "No detailed vulnerabilities found.")
69+
$(cat trivy-report.json | jq -r '.Results[]?.Vulnerabilities[]? | "\(.PkgName): \(.VulnerabilityID) - \(.Severity)"' || echo "No detailed vulnerabilities found.")
7870
7971
Please address these issues before merging this PR.
8072
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)