-
Notifications
You must be signed in to change notification settings - Fork 126
89 lines (76 loc) · 2.47 KB
/
Copy pathtrivy.yml
File metadata and controls
89 lines (76 loc) · 2.47 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
name: Trivy Security Scan
on:
schedule:
# Run at 00:00 on day 1 of every 3rd month (January, April, July, October)
- cron: "0 0 1 */3 *"
workflow_dispatch: # Allow manual trigger
push:
branches:
- master
pull_request:
branches:
- master
permissions:
contents: read
security-events: write # For uploading results to GitHub Security tab
jobs:
trivy-scan:
name: Trivy Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@v0.36.0
with:
scan-type: "fs"
scan-ref: "."
format: "sarif"
output: "trivy-results.sarif"
severity: "CRITICAL,HIGH"
- name: Upload Trivy results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v4
if: always()
with:
sarif_file: "trivy-results.sarif"
- name: Run Trivy vulnerability scanner (table output)
uses: aquasecurity/trivy-action@v0.36.0
with:
scan-type: "fs"
scan-ref: "."
format: "table"
severity: "CRITICAL,HIGH"
exit-code: "1"
trivy-docker:
name: Trivy Docker Image Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Build Docker image
run: docker build -t telegram-action:latest .
- name: Run Trivy vulnerability scanner on Docker image
uses: aquasecurity/trivy-action@v0.36.0
with:
scan-type: "image"
image-ref: "telegram-action:latest"
format: "sarif"
output: "trivy-docker-results.sarif"
severity: "CRITICAL,HIGH"
- name: Upload Trivy Docker results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v4
if: always()
with:
sarif_file: "trivy-docker-results.sarif"
# Gated at CRITICAL only: base images may carry upstream HIGHs that can
# only be cleared by an upstream rebuild. They remain visible in the
# Security tab via the SARIF upload above.
- name: Run Trivy vulnerability scanner on Docker image (table output)
uses: aquasecurity/trivy-action@v0.36.0
if: always()
with:
scan-type: "image"
image-ref: "telegram-action:latest"
format: "table"
severity: "CRITICAL"
exit-code: "1"