Skip to content

Commit 5eea52a

Browse files
committed
DevOps Shield - DevSecOps Automation - Create devopsshield-cis-trivy.yml
1 parent 130dd20 commit 5eea52a

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# DevOps Shield - The ultimate DevSecOps platform designed to secure your DevOps.
2+
# https://devopsshield.com
3+
##############################################################
4+
# This is a DevOps Shield - Application Security - Code Security Template.
5+
6+
# This workflow template uses actions that are not certified by DevOps Shield.
7+
# They are provided by a third-party and are governed by separate terms of service, privacy policy, and support documentation.
8+
9+
# Use this workflow template for integrating code security into your pipelines and workflows.
10+
11+
# DevOps Shield Workflow Template Details:
12+
# ------------------------------------------------------------
13+
# Code: GH_CIS_TRIVY
14+
# Name: Trivy Container Image Scanning
15+
# DevSecOpsControls: CIS
16+
# Provider: Aqua Security
17+
# Categories: Code Scanning, Dockerfile
18+
# Description:
19+
# Scan Docker container images for vulnerabilities in OS packages and language dependencies with Trivy from Aqua Security.
20+
# Trivy is a comprehensive and versatile security scanner.
21+
# Trivy has scanners that look for security issues, and targets where it can find those issues.
22+
# Read the official documentation to find out more.
23+
# For more information:
24+
# https://trivy.dev/latest/
25+
# https://github.com/aquasecurity/trivy
26+
# ------------------------------------------------------------
27+
# Source repository: https://github.com/aquasecurity/trivy-action
28+
##############################################################
29+
30+
name: Trivy Container Image Scanning
31+
32+
on:
33+
push:
34+
branches: [ main ]
35+
pull_request:
36+
branches: [ main ]
37+
schedule:
38+
- cron: 0 0 * * 0
39+
40+
jobs:
41+
trivy:
42+
name: Trivy vulnerability scanner
43+
44+
runs-on: ubuntu-latest
45+
46+
permissions:
47+
contents: read # for actions/checkout to fetch code
48+
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
49+
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
50+
51+
steps:
52+
- name: Checkout code
53+
uses: actions/checkout@v4
54+
55+
- name: Build an image from Dockerfile
56+
run: |
57+
docker build -t docker.io/my-organization/my-app:${{ github.sha }} .
58+
59+
- name: Run Trivy vulnerability scanner
60+
uses: aquasecurity/trivy-action@7b7aa264d83dc58691451798b4d117d53d21edfe
61+
with:
62+
image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
63+
format: 'sarif'
64+
output: 'trivy-results.sarif'
65+
66+
- name: Upload Trivy scan results to GitHub Security tab
67+
uses: github/codeql-action/upload-sarif@v3
68+
with:
69+
sarif_file: 'trivy-results.sarif'

0 commit comments

Comments
 (0)