Skip to content

Commit bded54c

Browse files
committed
DevSecOps test
1 parent ed929da commit bded54c

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

.github/workflows/devsecops-pipeline.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ on:
77
branches: [ main ]
88
workflow_dispatch:
99

10+
# Required permissions for code scanning API
11+
permissions:
12+
security-events: write
13+
actions: read
14+
contents: read
15+
1016
jobs:
1117
secrets-scanning:
1218
name: Secrets Scanning
@@ -32,6 +38,8 @@ jobs:
3238
steps:
3339
- name: Checkout code
3440
uses: actions/checkout@v4
41+
with:
42+
token: ${{ github.token }}
3543

3644
- name: Semgrep scan
3745
uses: semgrep/semgrep-action@v1
@@ -68,11 +76,23 @@ jobs:
6876
echo "Created empty SARIF file as semgrep scan failed"
6977
fi
7078
79+
- name: Check SARIF file
80+
run: |
81+
echo "Checking if SARIF file exists and is valid"
82+
if [ -f "semgrep-results.sarif" ]; then
83+
ls -la semgrep-results.sarif
84+
echo "SARIF file exists. Displaying first 20 lines:"
85+
head -n 20 semgrep-results.sarif
86+
else
87+
echo "SARIF file does not exist!"
88+
fi
89+
7190
- name: Upload SARIF file
7291
uses: github/codeql-action/upload-sarif@v3
7392
if: always()
7493
with:
7594
sarif_file: semgrep-results.sarif
95+
category: semgrep
7696

7797
sca-scanning:
7898
name: Software Composition Analysis
@@ -81,6 +101,8 @@ jobs:
81101
steps:
82102
- name: Checkout code
83103
uses: actions/checkout@v4
104+
with:
105+
token: ${{ github.token }}
84106

85107
- name: OWASP Dependency-Check Scan - Backend
86108
uses: dependency-check/Dependency-Check_Action@main
@@ -104,11 +126,26 @@ jobs:
104126
--suppression ./dependency-check-suppressions.xml
105127
--scan-config ./dependency-check-config.json
106128
129+
- name: Check SARIF files
130+
run: |
131+
echo "Checking if SARIF files exist in reports directory"
132+
if [ -d "./reports" ]; then
133+
ls -la ./reports/
134+
echo "Found files in reports directory"
135+
find ./reports -name "*.sarif" | while read file; do
136+
echo "Found SARIF file: $file"
137+
done
138+
else
139+
echo "Reports directory does not exist!"
140+
mkdir -p ./reports
141+
fi
142+
107143
- name: Upload SARIF files
108144
uses: github/codeql-action/upload-sarif@v3
109145
if: always()
110146
with:
111147
sarif_file: './reports/'
148+
category: dependency-check
112149

113150
sbom-generation:
114151
name: Software Bill of Materials

0 commit comments

Comments
 (0)