Skip to content

Commit 1f6bcc5

Browse files
committed
Refresh Ruff enforcement against current main
2 parents d2fe20b + 866a462 commit 1f6bcc5

90 files changed

Lines changed: 7216 additions & 1878 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.dockerignore‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# The image needs only the package source, its build metadata and the entrypoint
2+
# script. dist/ holds the wheel Dockerfile.preview installs.
3+
*
4+
!socketsecurity
5+
!pyproject.toml
6+
!uv.lock
7+
!README.md
8+
!LICENSE
9+
!scripts/docker-entrypoint.sh
10+
!dist
11+
**/__pycache__
12+
**/*.pyc

‎.git-blame-ignore-revs‎

Lines changed: 0 additions & 4 deletions
This file was deleted.

‎.github/actions/setup-docker/action.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ inputs:
1919
runs:
2020
using: "composite"
2121
steps:
22-
- uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
22+
- uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0
2323
if: inputs.enable-qemu == 'true'
24-
- uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
25-
- uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
24+
- uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
25+
- uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
2626
with:
2727
username: ${{ inputs.dockerhub-username }}
2828
password: ${{ inputs.dockerhub-token }}

‎.github/actions/setup-hatch/action.yml‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,9 @@ description: >-
66
runs:
77
using: "composite"
88
steps:
9-
# Kept in step with pyproject.toml: `hatch` matches the dev extra and
10-
# `hatchling` matches [build-system].requires. hatchling is pinned here only
11-
# for consistency -- `hatch build` resolves the backend in an isolated
12-
# environment from build-system.requires, so that pin is what actually
13-
# produces the wheel (the artifact records `Generator: hatchling 1.32.0`).
14-
# Three different values for the same tool across three files was only ever
15-
# going to mislead someone debugging a build.
9+
# Match the dev extra and build-system backend pins in pyproject.toml.
1610
- shell: bash
1711
run: |
1812
python -m pip install --upgrade pip
1913
pip install "virtualenv<20.36"
20-
pip install hatchling==1.32.0 hatch==1.18.0
14+
pip install hatchling==1.33.0 hatch==1.18.2

‎.github/actions/setup-sfw/action.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ runs:
2727
using: "composite"
2828
steps:
2929
- if: ${{ inputs.python == 'true' || inputs.uv == 'true' }}
30-
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
30+
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
3131
with:
3232
python-version: "3.12"
3333

3434
- if: ${{ inputs.node == 'true' }}
35-
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
35+
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
3636
with:
3737
node-version: "20"
3838

‎.github/dependabot.yml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ updates:
6666
schedule:
6767
interval: "weekly"
6868
open-pull-requests-limit: 2
69+
# Node majors move by hand: the reachability engine sets a minimum Node
70+
# version, and Dependabot doesn't know Node's release schedule, so it
71+
# would propose odd-numbered majors, which never get LTS. Check a new
72+
# major with e2e-image.yml. The floating node:<major>-alpine tag picks up
73+
# minor and patch releases on every build without a Dependabot PR.
74+
ignore:
75+
- dependency-name: "node"
76+
update-types: ["version-update:semver-major"]
6977
labels:
7078
- "dependencies"
7179
- "docker"
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
name: Dependency Audit
2+
3+
env:
4+
PYTHON_VERSION: "3.12"
5+
6+
# pip-audit compares the lockfile against advisory databases that publish
7+
# continuously, so the result tracks the clock, not the commit. Hence the cron.
8+
on:
9+
schedule:
10+
- cron: "17 6 * * *"
11+
# Unfiltered: a required check behind a paths filter never reports on a
12+
# pull request that misses the filter, which blocks the merge.
13+
pull_request:
14+
push:
15+
branches: [main]
16+
paths:
17+
- "pyproject.toml"
18+
- "uv.lock"
19+
- ".github/workflows/dependency-audit.yml"
20+
workflow_dispatch:
21+
22+
permissions:
23+
contents: read
24+
25+
concurrency:
26+
group: dependency-audit-${{ github.event.pull_request.number || github.ref }}
27+
cancel-in-progress: true
28+
29+
jobs:
30+
dependency-audit:
31+
runs-on: ubuntu-latest
32+
timeout-minutes: 10
33+
permissions:
34+
contents: read
35+
issues: write
36+
steps:
37+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
38+
with:
39+
fetch-depth: 1
40+
persist-credentials: false
41+
42+
- name: 🐍 setup python
43+
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
44+
with:
45+
python-version: ${{ env.PYTHON_VERSION }}
46+
47+
- name: 🛠️ install uv
48+
run: |
49+
python -m pip install --upgrade pip
50+
pip install uv
51+
52+
- name: 🛡️ pip-audit (known CVEs in the locked deps)
53+
id: audit
54+
run: |
55+
uv export --no-hashes --no-emit-project --format requirements-txt > /tmp/req-audit.txt
56+
57+
set +e
58+
uvx pip-audit --strict --progress-spinner off --disable-pip --no-deps \
59+
-r /tmp/req-audit.txt 2>&1 | tee /tmp/audit.log
60+
status=${PIPESTATUS[0]}
61+
set -e
62+
63+
# Written before the exit so the next step can quote it.
64+
{
65+
echo 'report<<AUDIT_REPORT_EOF'
66+
cat /tmp/audit.log
67+
echo 'AUDIT_REPORT_EOF'
68+
} >> "$GITHUB_OUTPUT"
69+
70+
exit "$status"
71+
72+
# A scheduled run has no pull request to turn red, so record it instead.
73+
- name: 📮 open or update the tracking issue
74+
if: always() && steps.audit.outcome == 'failure' && github.event_name == 'schedule'
75+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
76+
env:
77+
AUDIT_REPORT: ${{ steps.audit.outputs.report }}
78+
with:
79+
script: |
80+
const marker = '<!-- dependency-audit-tracking-issue -->';
81+
const title = 'Dependency audit: known vulnerabilities in the locked dependencies';
82+
const runUrl =
83+
`${context.serverUrl}/${context.repo.owner}/${context.repo.repo}` +
84+
`/actions/runs/${context.runId}`;
85+
const body = [
86+
marker,
87+
'`pip-audit` found known vulnerabilities in the locked dependency set.',
88+
'',
89+
'Bump the affected pins in `pyproject.toml`, run `uv lock`, and open a PR.',
90+
'',
91+
'```',
92+
process.env.AUDIT_REPORT.trim(),
93+
'```',
94+
'',
95+
`Run: ${runUrl}`,
96+
`Last checked: ${new Date().toISOString()}`,
97+
].join('\n');
98+
99+
const existing = await github.paginate(github.rest.issues.listForRepo, {
100+
owner: context.repo.owner,
101+
repo: context.repo.repo,
102+
state: 'open',
103+
per_page: 100,
104+
});
105+
const tracking = existing.find(
106+
(issue) => !issue.pull_request && issue.body && issue.body.includes(marker),
107+
);
108+
109+
if (tracking) {
110+
await github.rest.issues.update({
111+
owner: context.repo.owner,
112+
repo: context.repo.repo,
113+
issue_number: tracking.number,
114+
body,
115+
});
116+
core.notice(`Updated tracking issue #${tracking.number}`);
117+
} else {
118+
const created = await github.rest.issues.create({
119+
owner: context.repo.owner,
120+
repo: context.repo.repo,
121+
title,
122+
body,
123+
labels: ['dependencies'],
124+
});
125+
core.notice(`Opened tracking issue #${created.data.number}`);
126+
}
127+
128+
- name: ✅ close the tracking issue once the audit is clean
129+
if: always() && steps.audit.outcome == 'success' && github.event_name == 'schedule'
130+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
131+
with:
132+
script: |
133+
const marker = '<!-- dependency-audit-tracking-issue -->';
134+
const existing = await github.paginate(github.rest.issues.listForRepo, {
135+
owner: context.repo.owner,
136+
repo: context.repo.repo,
137+
state: 'open',
138+
per_page: 100,
139+
});
140+
const tracking = existing.find(
141+
(issue) => !issue.pull_request && issue.body && issue.body.includes(marker),
142+
);
143+
if (!tracking) {
144+
return;
145+
}
146+
await github.rest.issues.createComment({
147+
owner: context.repo.owner,
148+
repo: context.repo.repo,
149+
issue_number: tracking.number,
150+
body: 'The scheduled audit is clean again. Closing.',
151+
});
152+
await github.rest.issues.update({
153+
owner: context.repo.owner,
154+
repo: context.repo.repo,
155+
issue_number: tracking.number,
156+
state: 'closed',
157+
});

0 commit comments

Comments
 (0)