Skip to content

Commit 1070db7

Browse files
authored
Merge pull request #3261 from cdr/jsjoeio/add-trivy
feat(ci): add trivy job for security
2 parents f8d8ad3 + 6d5c603 commit 1070db7

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

.github/workflows/ci.yaml

+58
Original file line numberDiff line numberDiff line change
@@ -406,3 +406,61 @@ jobs:
406406
with:
407407
name: release-images
408408
path: ./release-images
409+
410+
trivy-scan-image:
411+
runs-on: ubuntu-20.04
412+
needs: docker-amd64
413+
414+
steps:
415+
- name: Checkout code
416+
uses: actions/checkout@v2
417+
418+
- name: Download release images
419+
uses: actions/download-artifact@v2
420+
with:
421+
name: release-images
422+
path: ./release-images
423+
424+
- name: Run Trivy vulnerability scanner in image mode
425+
# Commit SHA for v0.0.14
426+
uses: aquasecurity/trivy-action@b38389f8efef9798810fe0c5b5096ac198cffd54
427+
with:
428+
input: "./release-images/code-server-amd64-*.tar"
429+
scan-type: "image"
430+
ignore-unfixed: true
431+
format: "template"
432+
template: "@/contrib/sarif.tpl"
433+
output: "trivy-image-results.sarif"
434+
severity: "HIGH,CRITICAL"
435+
436+
- name: Upload Trivy scan results to GitHub Security tab
437+
uses: github/codeql-action/upload-sarif@v1
438+
with:
439+
sarif_file: "trivy-image-results.sarif"
440+
441+
# We have to use two trivy jobs
442+
# because GitHub only allows
443+
# codeql/upload-sarif action per job
444+
trivy-scan-repo:
445+
runs-on: ubuntu-20.04
446+
447+
steps:
448+
- name: Checkout code
449+
uses: actions/checkout@v2
450+
451+
- name: Run Trivy vulnerability scanner in repo mode
452+
# Commit SHA for v0.0.14
453+
uses: aquasecurity/trivy-action@b38389f8efef9798810fe0c5b5096ac198cffd54
454+
with:
455+
scan-type: "fs"
456+
scan-ref: "."
457+
ignore-unfixed: true
458+
format: "template"
459+
template: "@/contrib/sarif.tpl"
460+
output: "trivy-repo-results.sarif"
461+
severity: "HIGH,CRITICAL"
462+
463+
- name: Upload Trivy scan results to GitHub Security tab
464+
uses: github/codeql-action/upload-sarif@v1
465+
with:
466+
sarif_file: "trivy-repo-results.sarif"

0 commit comments

Comments
 (0)