Skip to content

Commit 7696fa6

Browse files
author
Vitaliy Saveliev
committed
Add security scanners to Github Actions
1 parent 089f1b2 commit 7696fa6

File tree

2 files changed

+69
-5
lines changed

2 files changed

+69
-5
lines changed

.github/workflows/secure.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Secure
2+
3+
on: push
4+
5+
jobs:
6+
# Sample GitHub Actions:
7+
# https://semgrep.dev/docs/semgrep-ci/sample-ci-configs#sample-github-actions-configuration-file
8+
semgrep:
9+
runs-on: ubuntu-latest
10+
container:
11+
image: semgrep/semgrep
12+
permissions:
13+
contents: read
14+
security-events: write
15+
steps:
16+
- uses: actions/checkout@v4
17+
- run: semgrep scan --sarif --output=semgrep.sarif --error
18+
env:
19+
SEMGREP_RULES: >-
20+
p/bandit
21+
p/command-injection
22+
p/comment
23+
p/cwe-top-25
24+
p/default
25+
p/gitlab
26+
p/gitlab-bandit
27+
p/gitleaks
28+
p/insecure-transport
29+
p/owasp-top-ten
30+
p/python
31+
p/r2c-best-practices
32+
p/r2c-bug-scan
33+
p/r2c-security-audit
34+
p/secrets
35+
p/security-audit
36+
p/xss
37+
- uses: github/codeql-action/upload-sarif@v3
38+
with:
39+
sarif_file: semgrep.sarif
40+
if: always()
41+
42+
# Samples GitHub Actions:
43+
# https://github.com/aquasecurity/trivy-action
44+
trivy:
45+
runs-on: ubuntu-latest
46+
permissions:
47+
contents: read
48+
security-events: write
49+
steps:
50+
- uses: actions/checkout@v4
51+
- uses: aquasecurity/trivy-action@master
52+
with:
53+
scan-type: 'fs'
54+
format: 'sarif'
55+
output: 'trivy.sarif'
56+
exit-code: '1'
57+
severity: 'CRITICAL,HIGH'
58+
- uses: github/codeql-action/upload-sarif@v3
59+
with:
60+
sarif_file: trivy.sarif
61+
if: always()

.github/workflows/checks.yml renamed to .github/workflows/verify.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1-
name: Checks
1+
name: Verify
2+
23
on: push
4+
35
jobs:
46
flake8:
57
runs-on: ubuntu-latest
68
steps:
7-
- uses: actions/checkout@v3
8-
- uses: actions/setup-python@v4
9+
- uses: actions/checkout@v4
10+
- uses: actions/setup-python@v5
911
with:
1012
python-version: '3.8'
1113
- run: pip install -r requirements.txt -r test-requirements.txt
1214
- run: flake8 .
15+
1316
pytest:
1417
runs-on: ubuntu-latest
1518
steps:
16-
- uses: actions/checkout@v3
17-
- uses: actions/setup-python@v4
19+
- uses: actions/checkout@v4
20+
- uses: actions/setup-python@v5
1821
with:
1922
python-version: '3.8'
2023
- run: pip install -r requirements.txt -r test-requirements.txt

0 commit comments

Comments
 (0)