Skip to content

Commit 06a3e6e

Browse files
committed
CI/CD - Added Snyk C/C++ Scanning Job
- added example C/C++ Code scanner using the Snyk GitHub Action. The `--unmanaged` flag indicates this is for a C/C++ codebase. In this example, it currently scans on a new pull request to the 'main' branch. The repository administrator should set both the SNYK_ORG and SNYK_TOKEN environment variables before merging this PR. The environment variables can be obtained from the LFX Security team. Signed-off-by: David Deal <[email protected]>
1 parent 86d0fb0 commit 06a3e6e

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

.github/workflows/snyk-scan-pr.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
# SPDX-License-Identifier: BSD-3-Clause
3+
# Copyright (c) Contributors to the OpenEXR Project.
4+
5+
name: Snyk Scan Code
6+
7+
on:
8+
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
9+
pull_request:
10+
branches:
11+
- main
12+
13+
jobs:
14+
snyk-scan-npm-pr:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: snyk/actions/setup@master
20+
id: snyk
21+
22+
- name: Snyk version
23+
run: echo "${{ steps.snyk.outputs.version }}"
24+
25+
- name: Snyk Auth
26+
run: snyk auth ${{ secrets.SNYK_TOKEN }}
27+
28+
- name: Snyk Scan Code
29+
# Scan the C/C++ code for vulnerabilities using the Snyk CLI with the unmanaged flag
30+
# https://docs.snyk.io/scan-using-snyk/supported-languages-and-frameworks/c-c++ for options
31+
run: snyk test --unmanaged --print-dep-paths --org=${{ secrets.SNYK_ORG }}
32+
env:
33+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
34+
continue-on-error: true # optional
35+
36+
- name: Monitor for NPM Vulnerabilities
37+
# To import the test results (issues and dependencies) in the Snyk CLI, run the snyk monitor --unmanaged command:
38+
run: snyk monitor --unmanaged --org=${{ secrets.SNYK_ORG }}
39+
env:
40+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
41+
continue-on-error: true # optional

0 commit comments

Comments
 (0)