From 9cc877fe078706b52a1d1fca5c80fb58a7c50cb3 Mon Sep 17 00:00:00 2001 From: Facundo Tuesca Date: Mon, 8 Jun 2026 19:33:18 +0200 Subject: [PATCH 1/5] Migrate to Trusted Publishing --- .github/workflows/pythonpublish.yml | 64 +++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 18 deletions(-) diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml index 82ad4ab..43bdb33 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pythonpublish.yml @@ -1,31 +1,59 @@ -# This workflows will upload a Python Package using Twine when a release is created -# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries - -name: Upload Python Package - on: release: - types: [published] + types: + - published -jobs: - deploy: +name: release + +permissions: {} - runs-on: ubuntu-latest +jobs: + build: + name: Build distributions + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: - python-version: '3.x' + python-version: "3.x" + - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Build and publish - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + pip install setuptools wheel + + - name: Build distributions run: | python setup.py sdist bdist_wheel - twine upload dist/* + + - name: Upload distributions + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: distributions + path: dist/ + + publish: + name: Publish Python distributions to PyPI + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/fluxture + needs: [build] + permissions: + # Used to sign the release's artifacts with sigstore-python. + # Used to publish to PyPI with Trusted Publishing. + id-token: write + steps: + - name: Download distributions + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: distributions + path: dist/ + + - name: Publish distributions + uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 From f3cacb65ff460b372cbe651b59518f83445f0f35 Mon Sep 17 00:00:00 2001 From: Facundo Tuesca Date: Mon, 8 Jun 2026 19:54:15 +0200 Subject: [PATCH 2/5] Bump minimum Python version to 3.10 --- .github/workflows/pip-audit.yml | 3 ++- .github/workflows/pythonpublish.yml | 3 ++- .github/workflows/tests.yml | 3 ++- fluxture/geolocation.py | 7 +------ fluxture/serialization.py | 7 +------ setup.py | 3 +-- 6 files changed, 9 insertions(+), 17 deletions(-) diff --git a/.github/workflows/pip-audit.yml b/.github/workflows/pip-audit.yml index 76660e8..6525a96 100644 --- a/.github/workflows/pip-audit.yml +++ b/.github/workflows/pip-audit.yml @@ -19,7 +19,8 @@ jobs: - name: Install Python uses: actions/setup-python@v4 with: - python-version: "3.x" + # TODO: change to "3.x" once dependencies are updated + python-version: "3.10" - name: Install project run: | diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml index 43bdb33..81eaedc 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pythonpublish.yml @@ -20,7 +20,8 @@ jobs: - name: Set up Python uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: - python-version: "3.x" + # TODO: change to "3.x" once dependencies are updated + python-version: "3.10" - name: Install dependencies run: | diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7dbae4c..6adecb8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,7 +15,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10"] + # TODO: add newer versions once dependencies are updated + python-version: ["3.10"] steps: - uses: actions/checkout@v3 diff --git a/fluxture/geolocation.py b/fluxture/geolocation.py index f2ae127..d8d9acc 100644 --- a/fluxture/geolocation.py +++ b/fluxture/geolocation.py @@ -4,12 +4,7 @@ from ipaddress import IPv6Address as PythonIPv6 from pathlib import Path from tempfile import NamedTemporaryFile -from typing import Iterator, Optional, Tuple, Union - -try: - from typing import Protocol -except ImportError: - from typing_extensions import Protocol +from typing import Iterator, Optional, Protocol, Tuple, Union import geoip2.database import great_circle_calculator.great_circle_calculator as gcc diff --git a/fluxture/serialization.py b/fluxture/serialization.py index 259a183..93baada 100644 --- a/fluxture/serialization.py +++ b/fluxture/serialization.py @@ -9,12 +9,7 @@ from inspect import isabstract from typing import Dict, Generic, Iterator from typing import OrderedDict as OrderedDictType -from typing import Tuple, Type, TypeVar, Union - -try: - from typing import Protocol, runtime_checkable -except ImportError: - from typing_extensions import Protocol, runtime_checkable +from typing import runtime_checkable, Protocol, Tuple, Type, TypeVar, Union P = TypeVar("P") diff --git a/setup.py b/setup.py index aef6ece..8d18659 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ author="Trail of Bits", version="0.0.1", packages=find_packages(exclude=["test"]), - python_requires=">=3.7", + python_requires=">=3.10", install_requires=[ "fastkml~=0.11", "geoip2~=4.1.0", @@ -22,7 +22,6 @@ "shodan~=1.24.0", "six>=1.5", "tqdm>=4.48.0", - "typing_extensions~=4.2.0 ; python_version < '3.8'", ], extras_require={"dev": ["flake8", "pytest", "twine"]}, entry_points={"console_scripts": ["fluxture = fluxture.__main__:main"]}, From dca20aec4f126da93a9f76e46f11ba9335349e53 Mon Sep 17 00:00:00 2001 From: Facundo Tuesca Date: Mon, 8 Jun 2026 19:55:13 +0200 Subject: [PATCH 3/5] Update and pin GitHub actions --- .github/workflows/pip-audit.yml | 6 +++--- .github/workflows/pythonpublish.yml | 2 +- .github/workflows/tests.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pip-audit.yml b/.github/workflows/pip-audit.yml index 6525a96..5ba7aa2 100644 --- a/.github/workflows/pip-audit.yml +++ b/.github/workflows/pip-audit.yml @@ -14,10 +14,10 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 - name: Install Python - uses: actions/setup-python@v4 + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: # TODO: change to "3.x" once dependencies are updated python-version: "3.10" @@ -32,7 +32,7 @@ jobs: - name: Run pip-audit - uses: pypa/gh-action-pip-audit@v1.0.8 + uses: pypa/gh-action-pip-audit@1220774d901786e6f652ae159f7b6bc8fea6d266 # v1.1.0 with: virtual-environment: /tmp/pip-audit-env diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml index 81eaedc..73c95f6 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pythonpublish.yml @@ -13,7 +13,7 @@ jobs: name: Build distributions runs-on: ubuntu-latest steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: persist-credentials: false diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6adecb8..5666772 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,9 +19,9 @@ jobs: python-version: ["3.10"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: python-version: ${{ matrix.python-version }} - name: Install dependencies From b7aaa35693d795e8cc14c227109751ed5736febb Mon Sep 17 00:00:00 2001 From: Facundo Tuesca Date: Mon, 8 Jun 2026 19:56:50 +0200 Subject: [PATCH 4/5] Address zizmor findings --- .github/dependabot.yml | 2 ++ .github/workflows/pip-audit.yml | 4 ++++ .github/workflows/tests.yml | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5b1b32f..fa7ddb4 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,3 +5,5 @@ updates: directory: / schedule: interval: daily + cooldown: + default-days: 7 diff --git a/.github/workflows/pip-audit.yml b/.github/workflows/pip-audit.yml index 5ba7aa2..34b3844 100644 --- a/.github/workflows/pip-audit.yml +++ b/.github/workflows/pip-audit.yml @@ -8,6 +8,8 @@ on: schedule: - cron: "0 12 * * *" +permissions: {} + jobs: pip-audit: runs-on: ubuntu-latest @@ -15,6 +17,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + with: + persist-credentials: false - name: Install Python uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5666772..169ac9a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,6 +9,8 @@ on: pull_request: branches: [ master ] +permissions: {} + jobs: build: @@ -20,6 +22,8 @@ jobs: steps: - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + with: + persist-credentials: false - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: From 0aa8bf39039f1436183bf5df94454489972ff176 Mon Sep 17 00:00:00 2001 From: Facundo Tuesca Date: Mon, 8 Jun 2026 19:57:21 +0200 Subject: [PATCH 5/5] Add zizmor workflow --- .github/workflows/zizmor.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/zizmor.yml diff --git a/.github/workflows/zizmor.yml b/.github/workflows/zizmor.yml new file mode 100644 index 0000000..0e162fe --- /dev/null +++ b/.github/workflows/zizmor.yml @@ -0,0 +1,24 @@ +name: GitHub Actions Security Analysis with zizmor 🌈 + +on: + push: + branches: ["main"] + pull_request: + branches: ["**"] + +permissions: {} + +jobs: + zizmor: + name: Run zizmor 🌈 + runs-on: ubuntu-latest + permissions: + security-events: write # Required for upload-sarif (used by zizmor-action) to upload SARIF files. + steps: + - name: Checkout repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Run zizmor 🌈 + uses: zizmorcore/zizmor-action@5f14fd08f7cf1cb1609c1e344975f152c7ee938d # v0.5.6