Skip to content

Commit 435d869

Browse files
committed
feat(actions): first commit to add scanning for terraform and image
1 parent 6daeb66 commit 435d869

2 files changed

Lines changed: 47 additions & 0 deletions

File tree

.github/workflows/m365_image_build.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,20 @@ jobs:
122122
cosign sign --yes "$_@$digest"
123123
}
124124
exit 0
125+
m365-scan:
126+
name: M365 Image Scan
127+
if: github.ref == 'refs/heads/scanning'
128+
runs-on: ubuntu-20.04
129+
steps:
130+
- name: Run Trivy vulnerability scanner
131+
uses: aquasecurity/trivy-action@0.28.0
132+
with:
133+
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
134+
format: 'sarif'
135+
output: 'trivy-results.sarif'
136+
137+
- name: Upload Trivy scan results to GitHub Security tab
138+
uses: github/codeql-action/upload-sarif@v3
139+
with:
140+
sarif_file: 'trivy-results.sarif'
141+
category: M365Image

.github/workflows/trivy_scan.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Trivy Scans
2+
on:
3+
push:
4+
branches: [ "*" ]
5+
pull_request:
6+
branches: [ "main" ]
7+
jobs:
8+
code-scan:
9+
name: Scan Code
10+
runs-on: ubuntu-20.04
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Run Trivy vulnerability scanner in IaC mode
16+
uses: aquasecurity/trivy-action@0.28.0
17+
with:
18+
scan-type: 'config'
19+
hide-progress: true
20+
format: 'sarif'
21+
output: 'trivy-results.sarif'
22+
exit-code: '1'
23+
severity: 'CRITICAL,HIGH,MEDIUM'
24+
25+
- name: Upload Trivy scan results to GitHub Security tab
26+
if: github.ref == 'refs/heads/scanning'
27+
uses: github/codeql-action/upload-sarif@v3
28+
with:
29+
sarif_file: 'trivy-results.sarif'
30+
category: Terraform

0 commit comments

Comments
 (0)