Skip to content

Commit 94f99bf

Browse files
authored
fix: bump cryptography to 46.0.5 and expand CI security coverage
- Bump cryptography 44.0.1 → 46.0.5 (CVE-2026-26007) - Bump Markdown 3.4.4 → 3.8.1 (CVE-2025-69534) - Add Python 3.13 to quality and security CI matrices - Add bandit static analysis to security workflow and tox - Run security checks on pull_request events (not just push) - Fix SonarQube condition: only run on push or non-fork pull_request - Remove untrusted fork code execution from sonar_fork_pr job - Prevent duplicate CI runs via pull_request_target - Fix stale bot messages and align bandit args with pre-commit
1 parent 62a41f8 commit 94f99bf

File tree

5 files changed

+38
-41
lines changed

5 files changed

+38
-41
lines changed

.github/workflows/quality.yml

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
pull_request:
88
types: [opened, synchronize, reopened, ready_for_review]
99
pull_request_target:
10-
types: [opened, synchronize, reopened, ready_for_review] # added for fork PRs
10+
types: [opened, synchronize, reopened, ready_for_review]
1111
workflow_dispatch:
1212

1313
permissions:
@@ -16,6 +16,7 @@ permissions:
1616
jobs:
1717
build:
1818
runs-on: ubuntu-latest
19+
if: github.event_name != 'pull_request_target'
1920
permissions:
2021
contents: read
2122
pull-requests: read
@@ -29,20 +30,22 @@ jobs:
2930
toxenv: py311,style,coverage-ci
3031
- python-version: 3.12
3132
toxenv: py312,style,coverage-ci
33+
- python-version: 3.13
34+
toxenv: py313,style,coverage-ci
3235

3336
steps:
3437
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
3538
with:
3639
submodules: recursive
37-
fetch-depth: 0 # shallow clones should be disabled for analysis
40+
fetch-depth: 0
3841

3942
- name: Setup python
4043
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c
4144
with:
4245
python-version: ${{ matrix.python-version }}
4346

4447
- name: Setup Node.js
45-
uses: actions/setup-node@v3
48+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
4649
with:
4750
node-version: '20'
4851

@@ -58,42 +61,35 @@ jobs:
5861
TOXENV: ${{ matrix.toxenv }}
5962
run: tox
6063

61-
# --- Sonar scan for pushes and same-repo PRs only ---
6264
- name: SonarQube Scan
63-
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false }}
65+
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false) }}
6466
uses: SonarSource/sonarqube-scan-action@v6.0.0
6567
env:
66-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # needed for PR info
67-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
68-
# Uncomment if your sonar-project.properties is in a subfolder:
69-
# with:
70-
# args: |
71-
# -Dsonar.projectBaseDir=caldera
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
7270

73-
# --- Sonar scan for forked PRs (runs safely with pull_request_target) ---
7471
sonar_fork_pr:
7572
runs-on: ubuntu-latest
7673
if: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.fork }}
7774
permissions:
7875
contents: read
79-
pull-requests: write # remove if you don't want PR comments
76+
pull-requests: write
8077
steps:
8178
- name: Checkout base repo
82-
uses: actions/checkout@v4
79+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
8380
with:
8481
ref: ${{ github.event.pull_request.base.sha }}
8582
fetch-depth: 0
86-
83+
8784
- name: Checkout PR HEAD (fork)
88-
uses: actions/checkout@v4
85+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
8986
with:
9087
repository: ${{ github.event.pull_request.head.repo.full_name }}
9188
ref: ${{ github.event.pull_request.head.sha }}
9289
path: pr
9390
fetch-depth: 0
9491
submodules: recursive
95-
96-
# Detect where the sonar-project.properties actually is (pr/ or pr/caldera)
92+
9793
- name: Detect Sonar base dir
9894
id: detect
9995
run: |
@@ -103,21 +99,14 @@ jobs:
10399
elif [ -f pr/sonar-project.properties ]; then
104100
echo "base=pr" >> "$GITHUB_OUTPUT"
105101
else
106-
echo "No sonar-project.properties found under pr/ or pr/caldera"
107-
echo "base=pr" >> "$GITHUB_OUTPUT" # fallback to repo root
102+
echo "base=pr" >> "$GITHUB_OUTPUT"
108103
fi
109-
echo "Using base dir: $(grep '^base=' "$GITHUB_OUTPUT" | cut -d= -f2)"
110-
echo "Has SONAR_TOKEN? $([ -n "${SONAR_TOKEN:-}" ] && echo yes || echo no)"
111-
env:
112-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
113-
114-
# If your project key/org are NOT in the properties file, uncomment and set below
104+
115105
- name: SonarQube Scan (fork PR)
116106
uses: SonarSource/sonarqube-scan-action@v6.0.0
117107
env:
118108
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
119109
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
120-
# SONAR_HOST_URL: https://sonarcloud.io # set if you’re self-hosted or non-default
121110
with:
122111
projectBaseDir: ${{ steps.detect.outputs.base }}
123112
args: |

.github/workflows/security.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Security Checks
22

3-
on: [push]
3+
on:
4+
push:
5+
pull_request:
6+
types: [opened, synchronize, reopened, ready_for_review]
47

58
permissions:
69
contents: read
@@ -12,26 +15,24 @@ jobs:
1215
fail-fast: false
1316
matrix:
1417
include:
15-
# - python-version: 3.9
16-
# toxenv: safety
17-
- python-version: 3.10.9
18-
toxenv: safety
19-
- python-version: 3.11
18+
- python-version: 3.13
2019
toxenv: safety
20+
- python-version: 3.13
21+
toxenv: bandit
2122

2223
steps:
23-
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
24+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
2425
with:
2526
submodules: recursive
2627
- name: Setup python
27-
uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566
28+
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c
2829
with:
2930
python-version: ${{ matrix.python-version }}
3031
- name: Install dependencies
3132
run: |
3233
pip install --upgrade virtualenv
3334
pip install tox
34-
- name: Run tests
35+
- name: Run security checks
3536
env:
3637
TOXENV: ${{ matrix.toxenv }}
3738
run: tox

.github/workflows/stale.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
repo-token: ${{ secrets.GITHUB_TOKEN }}
2323
stale-issue-label: 'no-issue-activity'
2424
stale-pr-label: 'no-pr-activity'
25-
stale-pr-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days'
26-
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days'
25+
stale-pr-message: 'This pull request is stale because it has had no activity for 60 days. Remove the stale label or comment or this will be closed in 60 days'
26+
stale-issue-message: 'This issue is stale because it has had no activity for 60 days. Remove the stale label or comment or this will be closed in 60 days'
2727
exempt-issue-labels: 'feature,keep'
2828
days-before-stale: 60
2929
days-before-close: 60

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ aiohttp-security==0.4.0
55
aiohttp-apispec==3.0.0b2
66
jinja2==3.1.6
77
pyyaml==6.0.1
8-
cryptography==44.0.1
8+
cryptography==46.0.5
99
websockets==15.0
1010
Sphinx==7.1.2
1111
sphinx_rtd_theme==1.3.0
@@ -19,7 +19,7 @@ reportlab==4.0.4 # debrief
1919
rich==13.7.0
2020
lxml==6.0.2 # debrief
2121
svglib==1.5.1 # debrief
22-
Markdown==3.4.4 # training
22+
Markdown==3.8.1 # training
2323
dnspython==2.6.1
2424
asyncssh==2.20.0
2525
aioftp~=0.20.0

tox.ini

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[tox]
77
skipsdist = True
88
envlist =
9-
py{310,311,312}
9+
py{310,311,312,313}
1010
style
1111
coverage
1212
safety
@@ -64,3 +64,10 @@ whitelist_externals=find
6464
commands =
6565
safety check -r requirements.txt --ignore 39642 --ignore 39659
6666
safety check -r requirements-dev.txt
67+
68+
[testenv:bandit]
69+
deps =
70+
bandit
71+
skip_install = true
72+
commands =
73+
bandit -r app -ll --exclude=tests/ --skip=B303

0 commit comments

Comments
 (0)