Skip to content

Commit c430d28

Browse files
committed
ci: fix zizmor security findings
- coverity: remove GITHUB_ENV write; resolve MTL pkg-config path inline using export to eliminate environment file injection risk - cppcheck: fix report dir to use GITHUB_WORKSPACE/reports/ so cppcheck results are included in the uploaded artifact - ci/daily_build/pull_request: move permissions block from workflow level to job level for tighter token scoping
1 parent d8c9bf9 commit c430d28

5 files changed

Lines changed: 21 additions & 32 deletions

File tree

.github/actions/analysis/coverity/action.yml

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,22 @@ description: 'Run Coverity static analysis (assumes Coverity pre-installed on ru
99
runs:
1010
using: composite
1111
steps:
12-
- name: Set up MTL environment
12+
- name: Coverity Scan
1313
shell: bash
1414
run: |
15-
if pkg-config --exists mtl 2>/dev/null; then
16-
echo "MTL already discoverable via pkg-config"
17-
exit 0
18-
fi
19-
MTL_PC=$(find /usr /home /opt -name "mtl.pc" 2>/dev/null | head -1)
20-
if [ -z "$MTL_PC" ]; then
21-
echo "ERROR: MTL pkg-config file not found under /usr, /home, or /opt."
22-
echo "Please ensure Media Transport Library is built and installed on the runner."
23-
exit 1
15+
# Resolve MTL pkg-config path without writing to GITHUB_ENV
16+
if ! pkg-config --exists mtl 2>/dev/null; then
17+
MTL_PC=$(find /usr /home /opt -name "mtl.pc" 2>/dev/null | head -1)
18+
if [ -z "$MTL_PC" ]; then
19+
echo "ERROR: MTL pkg-config file not found under /usr, /home, or /opt."
20+
echo "Please ensure Media Transport Library is built and installed on the runner."
21+
exit 1
22+
fi
23+
MTL_PC_DIR=$(dirname "$MTL_PC")
24+
echo "Found MTL pkgconfig at: $MTL_PC_DIR"
25+
export PKG_CONFIG_PATH="${MTL_PC_DIR}:${PKG_CONFIG_PATH:-}"
2426
fi
25-
MTL_PC_DIR=$(dirname "$MTL_PC")
26-
echo "Found MTL pkgconfig at: $MTL_PC_DIR"
27-
{
28-
echo "PKG_CONFIG_PATH<<EOF"
29-
echo "${MTL_PC_DIR}:${PKG_CONFIG_PATH}"
30-
echo "EOF"
31-
} >> "$GITHUB_ENV"
3227
33-
- name: Coverity Scan
34-
shell: bash
35-
run: |
3628
cd "$GITHUB_WORKSPACE"
3729
REPORT_DIR="$GITHUB_WORKSPACE/reports"
3830
mkdir -p "$REPORT_DIR"

.github/actions/analysis/cppcheck/action.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ runs:
1212
- name: cppcheck
1313
shell: bash
1414
run: |
15-
REPORT_DIR="$HOME/static-analysis/${{ github.repository }}/${{ github.run_id }}"
15+
REPORT_DIR="$GITHUB_WORKSPACE/reports"
1616
mkdir -p "$REPORT_DIR"
17+
echo "===== cppcheck Static Analysis ====="
1718
cppcheck \
1819
--enable=warning,style,performance,portability \
1920
--std=c11 --force --inline-suppr \
2021
--suppress=missingIncludeSystem \
2122
-Iinclude src 2>&1 | tee "$REPORT_DIR/cppcheck-report.txt" || true
22-
echo "cppcheck scan complete. Report saved to $REPORT_DIR/cppcheck-report.txt"
23+
echo "cppcheck scan complete. Report: $REPORT_DIR/cppcheck-report.txt"

.github/workflows/ci.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@ on:
1414
- main
1515
workflow_dispatch:
1616

17-
permissions:
18-
contents: read
19-
2017
jobs:
2118
ci:
2219
name: Continuous Integration
2320
runs-on: self-hosted
21+
permissions:
22+
contents: read
2423
steps:
2524
- name: Clean up previous run
2625
run: |

.github/workflows/daily_build.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@ on:
1515
- main
1616
workflow_dispatch:
1717

18-
permissions:
19-
contents: read
20-
2118
jobs:
2219
build:
2320
name: Daily Build
24-
2521
runs-on: self-hosted
22+
permissions:
23+
contents: read
2624

2725
steps:
2826
- name: Clean up previous run

.github/workflows/pull_request.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@ on:
1717

1818
workflow_dispatch:
1919

20-
permissions:
21-
contents: read
22-
2320
jobs:
2421
pull-request:
2522
name: Pull Request
2623
runs-on: self-hosted
24+
permissions:
25+
contents: read
2726

2827
steps:
2928
- name: Clean up previous run

0 commit comments

Comments
 (0)