Skip to content

Commit 77ddd5f

Browse files
mistral-vibestritti
andcommitted
ci(security): add OSV-Scanner vulnerability scanning
Co-authored-by: stritti <stritti@users.noreply.github.com>
1 parent 36e2f44 commit 77ddd5f

1 file changed

Lines changed: 95 additions & 0 deletions

File tree

‎.github/workflows/osv-scanner.yml‎

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: OSV-Scanner
2+
3+
# Vulnerability scan of the resolved PlatformIO dependencies against the OSV database.
4+
# platformio.ini has no lockfile, so the dependencies are resolved with
5+
# `pio pkg install` into .pio/libdeps/<env> and scanned from there. Git-based
6+
# dependencies keep their .git directory and are matched by commit.
7+
8+
on:
9+
push:
10+
branches: [main]
11+
paths:
12+
- "platformio.ini"
13+
- "lib/**"
14+
- ".github/workflows/osv-scanner.yml"
15+
pull_request:
16+
branches: [main]
17+
paths:
18+
- "platformio.ini"
19+
- "lib/**"
20+
- ".github/workflows/osv-scanner.yml"
21+
schedule:
22+
# Weekly scan every Monday at 08:00 UTC (same day as the PlatformIO dependency check)
23+
- cron: "0 8 * * 1"
24+
workflow_dispatch:
25+
26+
permissions:
27+
contents: read
28+
29+
# Cancel in-progress runs for the same workflow+ref when new commits are pushed
30+
concurrency:
31+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
32+
cancel-in-progress: true
33+
34+
jobs:
35+
extract-deps:
36+
name: Resolve PlatformIO dependencies (${{ matrix.environment }})
37+
runs-on: ubuntu-latest
38+
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
include:
43+
- environment: esp32dev
44+
pio-core-dir: ~/.platformio
45+
- environment: norvi_ae01_r
46+
pio-core-dir: ~/.platformio
47+
- environment: olimex_esp32_c6_evb
48+
pio-core-dir: ~/.platformio-olimex-c6
49+
50+
steps:
51+
- name: Checkout
52+
uses: actions/checkout@v7
53+
54+
- name: Set up PlatformIO
55+
uses: ./.github/actions/setup-platformio
56+
with:
57+
pio-core-dir: ${{ matrix.pio-core-dir }}
58+
cache-key: ${{ runner.os }}-pio-${{ matrix.environment }}-${{ hashFiles('**/platformio.ini') }}
59+
restore-key: ${{ runner.os }}-pio-${{ matrix.environment }}-
60+
61+
- name: Install project dependencies
62+
run: pio pkg install --environment ${{ matrix.environment }}
63+
64+
- name: Upload resolved libraries
65+
uses: actions/upload-artifact@v7
66+
with:
67+
name: pio-libdeps-${{ matrix.environment }}
68+
path: .pio/libdeps/${{ matrix.environment }}
69+
retention-days: 2
70+
if-no-files-found: error
71+
72+
osv-scan:
73+
name: OSV-Scanner (${{ matrix.environment }})
74+
needs: extract-deps
75+
76+
strategy:
77+
fail-fast: false
78+
matrix:
79+
environment: [esp32dev, norvi_ae01_r, olimex_esp32_c6_evb]
80+
81+
permissions:
82+
actions: read
83+
contents: read
84+
# Required to upload SARIF results to the Security > Code Scanning tab
85+
security-events: write
86+
87+
uses: "google/osv-scanner-action/.github/workflows/osv-scanner-reusable.yml@v2.7.1"
88+
with:
89+
download-artifact: pio-libdeps-${{ matrix.environment }}
90+
matrix-property: ${{ matrix.environment }}-
91+
scan-args: |-
92+
--include-git-root
93+
--allow-no-lockfiles
94+
--recursive
95+
./pio-libdeps-${{ matrix.environment }}

0 commit comments

Comments
 (0)