Skip to content

Commit d7249c2

Browse files
authored
update to poetry v2 (#133)
* Update to poetry v2 Signed-off-by: Prabhu Subramanian <[email protected]> * Generate sbom Signed-off-by: Prabhu Subramanian <[email protected]> * Generate sbom Signed-off-by: Prabhu Subramanian <[email protected]> * Downgrade symbolic Signed-off-by: Prabhu Subramanian <[email protected]> --------- Signed-off-by: Prabhu Subramanian <[email protected]>
1 parent 8fdca16 commit d7249c2

File tree

12 files changed

+505
-435
lines changed

12 files changed

+505
-435
lines changed

.github/workflows/alpine.yml.bak

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
run: |
1919
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python3 -
2020
~/.local/bin/poetry config virtualenvs.create false
21-
~/.local/bin/poetry install
21+
~/.local/bin/poetry sync
2222
wget https://github.com/upx/upx/releases/download/v4.0.2/upx-4.0.2-amd64_linux.tar.xz
2323
tar -xvf upx-4.0.2-amd64_linux.tar.xz
2424
cp upx-4.0.2-amd64_linux/upx /usr/local/bin/

.github/workflows/bintests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Install poetry
2626
run: |
2727
python3 -m pip install poetry
28-
poetry install
28+
poetry install --all-groups --all-extras
2929
- name: Test binaries
3030
run: |
3131
mkdir -p bintests gobintests rusttests

.github/workflows/linux.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
python3 -m pip install setuptools pyinstaller poetry
2929
cd blint
3030
poetry config virtualenvs.create false
31-
poetry install --no-cache
31+
poetry install --all-groups --all-extras --no-cache
3232
- name: Binary gnu build
3333
run: |
3434
cd blint
@@ -40,6 +40,7 @@ jobs:
4040
--add-data="blint/data/annotations:blint/data/annotations" \
4141
--collect-submodules blint \
4242
--collect-submodules symbolic \
43+
--collect-submodules oras \
4344
--noupx
4445
./dist/blint -i dist/blint -o /tmp/reports
4546
sha256sum ./dist/blint > ./dist/blint.sha256

.github/workflows/mac.yml.bak

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
run: |
4242
python3 -m pip install twine setuptools wheel
4343
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python3 -
44-
poetry install
44+
poetry install --all-groups --all-extras
4545
- name: Binary darwin build
4646
run: |
4747
poetry run pyinstaller blint/cli.py --noconfirm --log-level=WARN --nowindow --onefile --name blint --collect-all blint --osx-bundle-identifier ${PRODUCT_IDENTIFIER} --target-architecture x86_64 --codesign-identity ${CODESIGN_ID} --osx-entitlements-file Entitlements.plist --icon ./blint.icns

.github/workflows/publish.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,17 @@ jobs:
8787
- name: Release PyPI
8888
if: startsWith(github.ref, 'refs/tags/')
8989
uses: pypa/gh-action-pypi-publish@release/v1
90+
91+
- name: Generate SBOM with cdxgen
92+
run: |
93+
npm install -g @cyclonedx/cdxgen
94+
cdxgen -t python -o bom.json $(pwd) --profile research -p
95+
96+
- name: Upload bom to release
97+
if: startsWith(github.ref, 'refs/tags/')
98+
uses: softprops/action-gh-release@v2
99+
with:
100+
files: |
101+
bom.json
102+
env:
103+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/pytests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- name: Install poetry
3636
run: |
3737
python3 -m pip install poetry
38-
poetry install
38+
poetry install --all-groups --all-extras
3939
- name: Test with pytest
4040
run: |
4141
poetry run pytest --cov=blint tests

.github/workflows/win.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ jobs:
2828
python -m pip install setuptools pyinstaller tzdata poetry
2929
cd blint
3030
poetry config virtualenvs.create false
31-
poetry install --no-cache --without dev
31+
poetry install --all-groups --all-extras --no-cache
3232
- name: Binary windows build
3333
run: |
3434
cd blint
35-
pyinstaller blint/cli.py --noconfirm --log-level=WARN --nowindow --onefile --name blint --add-data="blint/data;blint/data" --add-data="blint/data/annotations;blint/data/annotations" --collect-submodules blint --disable-windowed-traceback -i blint.ico --version-file=file_version_info.txt --noupx
35+
pyinstaller blint/cli.py --noconfirm --log-level=WARN --nowindow --onefile --name blint --add-data="blint/data;blint/data" --add-data="blint/data/annotations;blint/data/annotations" --collect-submodules blint --collect-submodules oras --disable-windowed-traceback -i blint.ico --version-file=file_version_info.txt --noupx
3636
(Get-FileHash .\dist\blint.exe).hash | Out-File -FilePath .\dist\blint.exe.sha256
3737
set PYTHONIOENCODING=UTF-8
3838
.\dist\blint.exe -i .\dist\blint.exe -o reports --no-banner

blint/cli.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,11 @@ def build_parser():
180180
choices=["ghcr.io/appthreat/blintdb-vcpkg:v1",
181181
"ghcr.io/appthreat/blintdb-vcpkg-arm64:v1",
182182
"ghcr.io/appthreat/blintdb-vcpkg-darwin-arm64:v1",
183+
"ghcr.io/appthreat/blintdb-vcpkg-musl:v1",
183184
"ghcr.io/appthreat/blintdb-meson:v1",
184185
"ghcr.io/appthreat/blintdb-meson-arm64:v1",
185-
"ghcr.io/appthreat/blintdb-meson-darwin-arm64:v1"
186+
"ghcr.io/appthreat/blintdb-meson-darwin-arm64:v1",
187+
"ghcr.io/appthreat/blintdb-meson-musl:v1",
186188
],
187189
default=BLINTDB_IMAGE_URL,
188190
help=f"Blintdb image url. Defaults to {BLINTDB_IMAGE_URL}. The environment variable `BLINTDB_IMAGE_URL` is an alternative way to set this value.",

blint/lib/utils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
Technique,
3636
)
3737
from blint.logger import console, LOG
38-
# This is different from generic ConnectionError
39-
from requests.exceptions import ConnectionError as RequestConnectionError
4038

4139
import oras.client
4240
from oras.logger import setup_logger
@@ -245,7 +243,7 @@ def blintdb_setup(args):
245243
)
246244
os.environ["USE_BLINTDB"] = "true"
247245
LOG.debug(f"Blintdb stored at {BLINTDB_HOME}")
248-
except RequestConnectionError as e:
246+
except Exception as e:
249247
LOG.error(f"Blintdb Download failed: {e}")
250248

251249

build-mac.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
22

3-
# poetry install
3+
# poetry install --all-groups --all-extras
44

55
poetry run pyinstaller blint/cli.py --noconfirm --log-level=WARN --nowindow --onefile --name blint --collect-all blint --osx-bundle-identifier io.owasp-dep-scan.blint --target-architecture x86_64 --codesign-identity ${CODESIGN_ID} --osx-entitlements-file .builds/Entitlements.plist

0 commit comments

Comments
 (0)