Repository navigation
91 lines (85 loc) · 3.99 KB
/
Copy pathsecurity.yml
File metadata and controls
91 lines (85 loc) · 3.99 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
name: Security Scan
on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]
schedule:
- cron: "0 6 * * 1"
permissions:
contents: read
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
jobs:
dependency-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: "3.13"
# Upgrade pip first: pip-audit scans the whole environment, and the
# runner's bundled pip (26.1.1) carries advisory PYSEC-2026-196 (fixed in
# 26.1.2). Upgrading removes the vulnerable version outright rather than
# suppressing it — and 26.1.2 also resolves CVE-2026-3219 / CVE-2026-6357,
# which is why those two stale --ignore-vuln entries are no longer needed.
# Both installs are hash-pinned (Scorecard: Pinned-Dependencies); pip.txt
# holds the >=26.1.2 floor the comment above requires.
- run: |
python -m pip install --require-hashes -r .github/requirements/pip.txt
python -m pip install --require-hashes -r .github/requirements/audit.txt
- run: pip install -e .
- name: Pip audit
run: pip-audit --skip-editable
codeql:
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
security-events: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: github/codeql-action/init@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
with:
languages: python
- uses: github/codeql-action/analyze@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
id: analyze
# The SARIF's own paths, in the job log. GitHub's check annotates the sink
# alone (prax logger.py:135 for every clear-text-logging flow) and the
# code-scanning API needs an auth drone does not carry, so three rounds of
# PR #774 cured guessed sources. drone @git run view <id> --log reads this.
# Locations and CodeQL's own step messages only, never source text.
- name: CodeQL result paths
if: always()
env:
SARIF_DIR: ${{ steps.analyze.outputs.sarif-output }}
run: |
python3 - <<'PY'
import json
import os
import pathlib
root = pathlib.Path(os.environ["SARIF_DIR"])
for sarif in sorted(root.glob("*.sarif")):
data = json.loads(sarif.read_text(encoding="utf-8"))
for run in data.get("runs", []):
results = run.get("results", [])
print(f"{sarif.name}: {len(results)} result(s)")
for result in results:
text = (result.get("message") or {}).get("text", "")
print("RESULT", result.get("ruleId"), result.get("level"), text[:200])
for loc in result.get("locations", []):
where = loc.get("physicalLocation", {})
uri = where.get("artifactLocation", {}).get("uri")
print(" SINK", uri, where.get("region", {}).get("startLine"))
for number, flow in enumerate(result.get("codeFlows", []), 1):
for thread in flow.get("threadFlows", []):
steps = thread.get("locations", [])
print(f" PATH {number} ({len(steps)} steps)")
for step in steps:
location = step.get("location", {})
where = location.get("physicalLocation", {})
uri = where.get("artifactLocation", {}).get("uri")
line = where.get("region", {}).get("startLine")
note = (location.get("message") or {}).get("text", "")
print(" ", uri, line, note[:90])
PY