Skip to content

Commit 2cb3a8c

Browse files
committed
DevOps Shield - DevSecOps Automation - Create devopsshield-cis-anchore-grype.yml
1 parent 695da42 commit 2cb3a8c

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Last applied at: Fri, 24 Jan 2025 13:36:34 GMT
2+
# DevOps Shield - The ultimate DevSecOps platform designed to secure your DevOps.
3+
# https://devopsshield.com
4+
##############################################################
5+
# This is a DevOps Shield - Application Security - Code Security Template.
6+
7+
# This workflow template uses actions that are not certified by DevOps Shield.
8+
# They are provided by a third-party and are governed by separate terms of service, privacy policy, and support documentation.
9+
10+
# Use this workflow template for integrating code security into your pipelines and workflows.
11+
12+
# DevOps Shield Workflow Template Details:
13+
# ------------------------------------------------------------
14+
# Code: GH_CIS_ANCHORE_GRYPE
15+
# Name: Anchore Grype Vulnerability Scan (Container Image Scanning)
16+
# DevSecOpsControls: CIS
17+
# Provider: Anchore
18+
# Categories: Code Scanning, Dockerfile
19+
# Description:
20+
# Anchore Grype is a vulnerability scanner for container images and filesystems.
21+
# Scan the contents of a container image or filesystem to find known vulnerabilities.
22+
# Anchore container analysis and scan provided as a GitHub Action.
23+
# This workflow checks out code, builds an image, performs a container image vulnerability scan with Anchore's Grype tool,
24+
# and integrates the results with GitHub Advanced Security code scanning feature.
25+
# Read the official documentation to find out more.
26+
# For more information:
27+
# https://github.com/anchore/grype
28+
# ------------------------------------------------------------
29+
# Source repository: https://github.com/anchore/scan-action
30+
##############################################################
31+
32+
name: Anchore Grype Vulnerability Scan (Container Image Scanning)
33+
34+
on:
35+
push:
36+
branches: [ main ]
37+
pull_request:
38+
branches: [ main ]
39+
schedule:
40+
- cron: 0 0 * * 0
41+
42+
jobs:
43+
anchore-grype-scan:
44+
name: Anchore Grype Vulnerability Scan
45+
46+
runs-on: ubuntu-latest
47+
48+
permissions:
49+
contents: read # for actions/checkout to fetch code
50+
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
51+
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
52+
53+
steps:
54+
- name: Checkout code
55+
uses: actions/checkout@v4
56+
57+
- name: Build an image from Dockerfile
58+
uses: docker/build-push-action@v4
59+
with:
60+
tags: localbuild/testimage:latest
61+
push: false
62+
load: true
63+
64+
- name: Run the Anchore Grype scan action
65+
uses: anchore/scan-action@v6
66+
id: scan
67+
with:
68+
image: "localbuild/testimage:latest"
69+
fail-build: true
70+
severity-cutoff: critical
71+
- name: Upload Anchore vulnerability report to GitHub Security tab
72+
uses: github/codeql-action/upload-sarif@v3
73+
with:
74+
sarif_file: ${{ steps.scan.outputs.sarif }}

0 commit comments

Comments
 (0)