Skip to content

Commit a1e428d

Browse files
authored
Merge pull request #1 from intel/main
Changes
2 parents 30b85ba + c0c9889 commit a1e428d

Some content is hidden

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

45 files changed

+850
-310
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151

5252
# Initializes the CodeQL tools for scanning.
5353
- name: Initialize CodeQL
54-
uses: github/codeql-action/init@0116bc2df50751f9724a2e35ef1f24d22f90e4e1 # v2.22.3
54+
uses: github/codeql-action/init@49abf0ba24d0b7953cb586944e918a0b92074c80 # v2.22.4
5555
with:
5656
languages: ${{ matrix.language }}
5757
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -76,4 +76,4 @@ jobs:
7676
# make release
7777

7878
- name: Perform CodeQL Analysis
79-
uses: github/codeql-action/analyze@0116bc2df50751f9724a2e35ef1f24d22f90e4e1 # v2.22.3
79+
uses: github/codeql-action/analyze@49abf0ba24d0b7953cb586944e918a0b92074c80 # v2.22.4

.github/workflows/cve_scan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
2323
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
2424
with:
25-
python-version: '3.x'
25+
python-version: '3.11'
2626
cache: 'pip'
2727
cache-dependency-path: '**/requirements.txt'
2828
- name: Get date

.github/workflows/formatting.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
2727
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
2828
with:
29-
python-version: '3.x'
29+
python-version: '3.11'
3030
cache: 'pip'
3131
- name: Install cve-bin-tool
3232
run: |

.github/workflows/fuzzing.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Fuzzing
2+
3+
on:
4+
schedule:
5+
- cron: '0 7 * * 1' # Runs at 07:00 on monday every week
6+
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
fuzzing:
14+
name: Fuzzing
15+
runs-on: ubuntu-22.04
16+
if: github.event.repository.fork == false
17+
steps:
18+
- name: Check out code
19+
uses: actions/checkout@v2
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: 3.9
25+
26+
- name: Install Bazel
27+
run: |
28+
sudo apt-get update
29+
sudo apt-get install -y wget
30+
wget -c https://github.com/bazelbuild/bazelisk/releases/download/v1.18.0/bazelisk-linux-amd64
31+
chmod +x bazelisk-linux-amd64
32+
sudo mv bazelisk-linux-amd64 /usr/local/bin/bazel
33+
bazel --version
34+
35+
- name: Install Fuzzing Dependencies
36+
run: |
37+
pip install --upgrade atheris
38+
pip install --upgrade atheris-libprotobuf-mutator
39+
pip install --upgrade protobuf
40+
- name: Install Cve-bin-tool
41+
run: |
42+
python -m pip install --upgrade pip
43+
python -m pip install --upgrade setuptools
44+
python -m pip install --upgrade -r dev-requirements.txt
45+
python -m pip install --upgrade .
46+
47+
- name: Run Fuzzing
48+
id: fuzzing
49+
env:
50+
PYTHONPATH: ${{ github.workspace }}
51+
run: |
52+
cd fuzz
53+
export PYTHONPATH="$PYTHONPATH:/generated"
54+
fuzzing_scripts=($(ls *.py))
55+
echo "Found Fuzzing scripts: ${fuzzing_scripts[@]}"
56+
current_week=($(date -u +%U))
57+
echo "Current week number: $current_week"
58+
at_index=$((($(date -u +%U) % ${#fuzzing_scripts[@]})))
59+
selected_script="${fuzzing_scripts[$at_index]}"
60+
echo "Selected script: $selected_script"
61+
timeout --preserve-status --signal=SIGINT 60m python $selected_script

.github/workflows/linting.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
2828
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
2929
with:
30-
python-version: '3.x'
30+
python-version: '3.11'
3131
cache: 'pip'
3232
- name: Install pre-commit
3333
run: |

.github/workflows/scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
persist-credentials: false
3333

3434
- name: "Run analysis"
35-
uses: ossf/scorecard-action@483ef80eb98fb506c348f7d62e28055e49fe2398 # v2.3.0
35+
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
3636
with:
3737
results_file: results.sarif
3838
results_format: sarif

.github/workflows/testing.yml

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
4343
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
4444
with:
45-
python-version: '3.x'
45+
python-version: '3.11'
4646
cache: 'pip'
4747
cache-dependency-path: 'doc/requirements.txt'
4848
- name: Install doc dependencies
@@ -58,19 +58,11 @@ jobs:
5858
5959
tests:
6060
name: Linux tests
61-
if: |
62-
! github.event.pull_request.user.login == 'github-actions[bot]' ||
63-
! (
64-
startsWith(github.head_ref, 'chore-sbom-py') ||
65-
contains(
66-
fromJSON('["chore-update-table","chore-precommit-config","chore-spdx-header"]'),
67-
github.head_ref
68-
)
69-
)
7061
runs-on: ubuntu-22.04
7162
strategy:
7263
matrix:
7364
python: ['3.8', '3.9', '3.11']
65+
# python 3.12 throws aiohttp package install errors
7466
timeout-minutes: 60
7567
steps:
7668
- name: Harden Runner
@@ -83,6 +75,19 @@ jobs:
8375
with:
8476
python-version: ${{ matrix.python }}
8577
cache: 'pip'
78+
79+
- name: "Skip tests if this is an automated sbom job"
80+
env:
81+
COMMIT_VAR: ${{ startsWith(github.head_ref, 'chore-sbom-py') && github.event.pull_request.user.login == 'github-actions[bot]' }}
82+
run: |
83+
if ${COMMIT_VAR} == true; then
84+
echo "sbom=true" >> $GITHUB_ENV
85+
echo "sbom set to true"
86+
else
87+
echo "sbom=false" >> $GITHUB_ENV
88+
echo "sbom set to false"
89+
fi
90+
8691
- name: Get date
8792
id: get-date
8893
run: |
@@ -105,10 +110,13 @@ jobs:
105110
path: cache
106111
key: Linux-cve-bin-tool-${{ steps.get-date.outputs.yesterday }}
107112
- name: Install cabextract
113+
if: env.sbom == false
108114
run: sudo apt-get update && sudo apt-get install cabextract
109115
- name: Install OS dependencies for testing PDF
116+
if: env.sbom == false
110117
run: sudo apt-get install build-essential libpoppler-cpp-dev pkg-config python3-dev
111118
- name: Install pdftotext, reportlab and cve-bin-tool
119+
if: env.sbom == false
112120
run: |
113121
python -m pip install --upgrade pip
114122
python -m pip install --upgrade setuptools
@@ -118,11 +126,13 @@ jobs:
118126
python -m pip install --upgrade -r dev-requirements.txt
119127
python -m pip install --upgrade .
120128
- name: Try single CLI run of tool
129+
if: env.sbom == false
121130
run: |
122131
[[ -e cache ]] && mkdir -p .cache && mv cache ~/.cache/cve-bin-tool
123132
NO_EXIT_CVE_NUM=1 python -m cve_bin_tool.cli test/assets/test-kerberos-5-1.15.1.out
124133
cp -r ~/.cache/cve-bin-tool cache
125134
- name: Run async tests
135+
if: env.sbom == false
126136
run: >
127137
pytest -n 4 -v
128138
--ignore=test/test_cli.py
@@ -131,6 +141,7 @@ jobs:
131141
--ignore=test/test_html.py
132142
--ignore=test/test_json.py
133143
- name: Run synchronous tests
144+
if: env.sbom == false
134145
run: >
135146
pytest -v
136147
test/test_cli.py
@@ -162,6 +173,19 @@ jobs:
162173
with:
163174
python-version: '3.10'
164175
cache: 'pip'
176+
177+
- name: "Skip tests if this is an automated sbom job"
178+
env:
179+
COMMIT_VAR: ${{ startsWith(github.head_ref, 'chore-sbom-py') && github.event.pull_request.user.login == 'github-actions[bot]' }}
180+
run: |
181+
if ${COMMIT_VAR} == true; then
182+
echo "sbom=true" >> $GITHUB_ENV
183+
echo "sbom set to true"
184+
else
185+
echo "sbom=false" >> $GITHUB_ENV
186+
echo "sbom set to false"
187+
fi
188+
165189
- name: Get date
166190
id: get-date
167191
run: |
@@ -200,10 +224,13 @@ jobs:
200224
if_true: '1'
201225
if_false: '0'
202226
- name: Install cabextract
227+
if: env.sbom == false
203228
run: sudo apt-get update && sudo apt-get install cabextract
204229
- name: Install OS dependencies for testing PDF
230+
if: env.sbom == false
205231
run: sudo apt-get install build-essential libpoppler-cpp-dev pkg-config python3-dev
206232
- name: Install pdftotext, reportlab and cve-bin-tool
233+
if: env.sbom == false
207234
run: |
208235
python -m pip install --upgrade pip
209236
python -m pip install --upgrade setuptools
@@ -213,11 +240,13 @@ jobs:
213240
python -m pip install --upgrade -r dev-requirements.txt
214241
python -m pip install --editable .
215242
- name: Try single CLI run of tool
243+
if: env.sbom == false
216244
run: |
217245
[[ -e cache ]] && mkdir -p .cache && mv cache ~/.cache/cve-bin-tool
218246
NO_EXIT_CVE_NUM=1 python -m cve_bin_tool.cli test/assets/test-kerberos-5-1.15.1.out
219247
cp -r ~/.cache/cve-bin-tool cache
220248
- name: Run async tests
249+
if: env.sbom == false
221250
env:
222251
LONG_TESTS: ${{ steps.git-diff.outputs.value }}
223252
run: >
@@ -228,13 +257,15 @@ jobs:
228257
--ignore=test/test_html.py
229258
--ignore=test/test_json.py
230259
- name: Run synchronous tests
260+
if: env.sbom == false
231261
env:
232262
LONG_TESTS: ${{ steps.git-diff.outputs.value }}
233263
run: >
234264
pytest -v --cov --cov-append --cov-report=xml
235265
test/test_cli.py
236266
test/test_cvedb.py
237267
- name: Upload code coverage to codecov
268+
if: env.sbom == false
238269
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
239270
with:
240271
files: ./coverage.xml

.github/workflows/update-js-dependencies.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030

3131
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
3232
with:
33-
python-version: '3.x'
33+
python-version: '3.11'
3434

3535
- name: Update JS dependencies
3636
run: python .github/workflows/update_js_dependencies.py

.github/workflows/update-pre-commit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030

3131
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
3232
with:
33-
python-version: '3.x'
33+
python-version: '3.11'
3434

3535
- name: Install pre-commit
3636
run: |

.pre-commit-config.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@ repos:
33
rev: 5.12.0
44
hooks:
55
- id: isort
6+
exclude: ^fuzz/generated/
67

78
- repo: https://github.com/psf/black-pre-commit-mirror
89
rev: 23.9.1
910
hooks:
1011
- id: black
12+
exclude: ^fuzz/generated/
1113

1214
- repo: https://github.com/asottile/pyupgrade
1315
rev: v3.10.1
1416
hooks:
1517
- id: pyupgrade
18+
exclude: ^fuzz/generated/
1619
args: ["--py38-plus"]
1720

1821
- repo: https://github.com/pycqa/flake8
@@ -25,6 +28,7 @@ repos:
2528
rev: 1.7.5
2629
hooks:
2730
- id: bandit
31+
exclude: ^fuzz/generated/
2832
args: ["-c", "bandit.conf"]
2933

3034
- repo: https://github.com/jorisroovers/gitlint
@@ -66,3 +70,11 @@ repos:
6670
test/test_version.py|
6771
test/utils.py|
6872
)$
73+
74+
- repo: https://github.com/econchick/interrogate
75+
rev: 1.5.0
76+
hooks:
77+
- id: interrogate
78+
verbose: True
79+
exclude: ^(locales|presentation)
80+
args: ["-vv", "-i", "-I", "-M", "-C", "-n", "-p", "-f", "60.0"]

0 commit comments

Comments
 (0)