forked from Tommasov/MG4_Simple_Launcher
-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (102 loc) · 3.82 KB
/
Copy pathsecurity.yml
File metadata and controls
112 lines (102 loc) · 3.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Security
# Security checks before any APK reaches a vehicle.
# Blocking: permission-drift + secrets. Informational (SARIF): SAST + dependencies.
on:
push:
branches: [main, master, "feat/**", "feature/**"]
pull_request:
workflow_dispatch:
permissions:
contents: read
security-events: write # upload SARIF -> Security tab
jobs:
permission-gate:
name: Permission-drift gate (blocking)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check manifest permissions
run: bash .github/security/check-permissions.sh
secrets:
name: Secret scan (blocking)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
sast:
name: SAST mobile (mobsfscan + semgrep)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with: { python-version: "3.12" }
- name: Run scanners (SARIF, non-blocking)
run: |
# Always produce a valid SARIF even if a scanner fails -> the upload never breaks.
empty_sarif() {
printf '%s' '{"version":"2.1.0","$schema":"https://json.schemastore.org/sarif-2.1.0.json","runs":[{"tool":{"driver":{"name":"'"$1"'","rules":[]}},"results":[]}]}' > "$2"
}
pip install mobsfscan semgrep
mobsfscan --sarif -o mobsfscan.sarif app/src || true
[ -s mobsfscan.sarif ] || empty_sarif mobsfscan mobsfscan.sarif
semgrep --config p/java --config p/kotlin --config p/security-audit --sarif -o semgrep.sarif app/src || true
[ -s semgrep.sarif ] || empty_sarif semgrep semgrep.sarif
- name: Upload mobsfscan SARIF
if: always()
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: mobsfscan.sarif
category: mobsfscan
- name: Upload Semgrep SARIF
if: always()
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: semgrep.sarif
category: semgrep
- name: Security report (artifact)
if: always()
run: |
{
echo "# EVLauncher security report"
echo "_$(date -u)_"
echo
echo "## mobsfscan"
python -c "import json;d=json.load(open('mobsfscan.sarif'));print('findings:',sum(len(r.get('results',[])) for r in d.get('runs',[])))" 2>/dev/null || echo "n/a"
echo "## semgrep"
python -c "import json;d=json.load(open('semgrep.sarif'));print('findings:',sum(len(r.get('results',[])) for r in d.get('runs',[])))" 2>/dev/null || echo "n/a"
} > security-report.md
cat security-report.md
- uses: actions/upload-artifact@v4
if: always()
with:
name: security-report
path: |
security-report.md
*.sarif
dependencies:
name: Dependency scan (OWASP)
runs-on: ubuntu-latest
continue-on-error: true # informational
env:
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
steps:
- uses: actions/checkout@v4
# Runs only when an NVD API key is configured — otherwise the NVD API is too
# rate-limited to be useful, and an empty --nvdApiKey breaks the tool.
- name: OWASP Dependency-Check
if: ${{ env.NVD_API_KEY != '' }}
uses: dependency-check/Dependency-Check_Action@main
with:
project: EV_Simple_Launcher
path: "."
format: "SARIF"
args: --nvdApiKey ${{ env.NVD_API_KEY }}
- name: Upload dependency SARIF
if: ${{ env.NVD_API_KEY != '' }}
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: reports/dependency-check-report.sarif
category: dependency-check