Skip to content

Commit 816432c

Browse files
committed
first cut at action scanning workflow.
1 parent 71c72d5 commit 816432c

1 file changed

Lines changed: 74 additions & 0 deletions

File tree

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Scan GitHub Action workflows files for security issues
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '.github/workflows/**.ya?ml'
7+
workflow_dispatch: {}
8+
push:
9+
paths:
10+
- '.github/workflows/**.ya?ml'
11+
schedule:
12+
- cron: '39 3 * * 3'
13+
14+
permissions:
15+
contents: read
16+
security-events: write
17+
18+
jobs:
19+
codeql:
20+
name: codeql
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout Code
25+
uses: actions/checkout@v4
26+
27+
- name Initialize CodeQL
28+
uses: github/codeql-action/init@v3
29+
with:
30+
languages: actions
31+
build-mode: none
32+
33+
- name: Perform CodeQL Analysis
34+
uses: github/codeql-action/analyze@v3
35+
with:
36+
category: "/language:actions"
37+
38+
39+
semgrep:
40+
name: semgrep-oss/scan
41+
runs-on: ubuntu-latest
42+
43+
container:
44+
image: semgrep/semgrep
45+
46+
# Skip any PR created by dependabot to avoid permission issues:
47+
if: (github.actor != 'dependabot[bot]')
48+
49+
steps:
50+
- name: Checkout Code
51+
uses: actions/checkout@v4
52+
53+
- name: Checkout Workflow Config
54+
uses: actions/checkout@v4
55+
env:
56+
GH_REPO_OWNER: ${{ github.repository_owner }}
57+
with:
58+
repository: '${{ env.GH_REPO_OWNER }}/.github'
59+
path: action_scanning
60+
61+
- name: Run Actions semgrep scan
62+
run: semgrep scan --sarif --config action_scanning/semgrep-rules/actions >> semgrep-results-actions.sarif
63+
64+
- name: Save Actions SARIF results as artifact
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: semgrep-scan-results-actions
68+
path: semgrep-results-actions.sarif
69+
70+
- name: Upload Actions SARIF result to the GitHub Security Dashboard
71+
uses: github/codeql-action/upload-sarif@v3
72+
with:
73+
sarif_file: semgrep-results-actions.sarif
74+
if: always()

0 commit comments

Comments
 (0)