Skip to content
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
35b64f2
Enforce ruff in CI and pre-commit, and clear the existing violations
lelia Sep 4, 2026
ea36905
Release 2.7.2
lelia Sep 4, 2026
a3acbc8
Make every __version__ consumer quote-agnostic
lelia Sep 7, 2026
3742c39
Determine SCM type from config instead of sniffing the Socket report URL
lelia Sep 7, 2026
4886a34
Merge remote-tracking branch 'origin/main' into lelia/ruff-ci-precomm…
lelia Sep 8, 2026
8ee3bad
Keep credentials out of log output
lelia Sep 8, 2026
72fdd20
Add 2.7.3 changelog entries for the credential and manifest-link fixes
lelia Sep 8, 2026
19f5b8a
Merge remote-tracking branch 'origin/main' into lelia/ruff-ci-precomm…
lelia Sep 9, 2026
eeef68d
Merge main for the httpx2/httpcore2 security bumps, and align the hat…
lelia Sep 9, 2026
d947eb2
ci: only enforce a version bump when the PR ships packaged content
lelia Sep 10, 2026
ebf39ca
Merge main into the ruff/QoL branch and move the release to 2.8.1
lelia Sep 11, 2026
d2fe20b
Describe the log redaction by what it does rather than what it prevented
lelia Sep 11, 2026
1f6bcc5
Refresh Ruff enforcement against current main
lelia Nov 14, 2026
45ede41
Document Ruff enforcement in the release notes
lelia Nov 14, 2026
66a825c
Keep the ignore authorization policy visible in debug output
lelia Nov 14, 2026
261efff
Keep release notes focused on CLI behavior
lelia Nov 14, 2026
8660622
Protect notification output and test release version checks
lelia Nov 14, 2026
1338e4d
Merge main and prepare version 2.12.2
lelia Nov 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/actions/setup-hatch/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ description: >-
runs:
using: "composite"
steps:
# Match the dev extra and build-system backend pins in pyproject.toml.
- shell: bash
run: |
python -m pip install --upgrade pip
pip install "virtualenv<20.36"
pip install hatchling==1.27.0 hatch==1.14.0
pip install hatchling==1.33.0 hatch==1.18.2
12 changes: 6 additions & 6 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ jobs:
echo "sha=${{ github.event.pull_request.head.sha }}"
} > sfw-artifacts/context.txt

- uses: $/.github/actions/setup-sfw
- uses: ./.github/actions/setup-sfw
with:
uv: "true"
mode: firewall-free
Expand Down Expand Up @@ -241,7 +241,7 @@ jobs:
echo "sha=${{ github.event.pull_request.head.sha }}"
} > sfw-artifacts/context.txt

- uses: $/.github/actions/setup-sfw
- uses: ./.github/actions/setup-sfw
with:
uv: "true"
mode: firewall-enterprise
Expand Down Expand Up @@ -332,7 +332,7 @@ jobs:
echo "sha=${{ github.event.pull_request.head.sha }}"
} > sfw-artifacts/context.txt

- uses: $/.github/actions/setup-sfw
- uses: ./.github/actions/setup-sfw
with:
node: "true"
mode: firewall-free
Expand Down Expand Up @@ -393,7 +393,7 @@ jobs:
echo "sha=${{ github.event.pull_request.head.sha }}"
} > sfw-artifacts/context.txt

- uses: $/.github/actions/setup-sfw
- uses: ./.github/actions/setup-sfw
with:
node: "true"
mode: firewall-enterprise
Expand Down Expand Up @@ -454,7 +454,7 @@ jobs:
echo "sha=${{ github.event.pull_request.head.sha }}"
} > sfw-artifacts/context.txt

- uses: $/.github/actions/setup-sfw
- uses: ./.github/actions/setup-sfw
with:
python: "true"
mode: firewall-free
Expand Down Expand Up @@ -518,7 +518,7 @@ jobs:
echo "sha=${{ github.event.pull_request.head.sha }}"
} > sfw-artifacts/context.txt

- uses: $/.github/actions/setup-sfw
- uses: ./.github/actions/setup-sfw
with:
python: "true"
mode: firewall-enterprise
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
persist-credentials: false

- name: Set up Docker publishing
uses: $/.github/actions/setup-docker
uses: ./.github/actions/setup-docker
with:
# Retagging copies manifests between tags; nothing is built.
enable-qemu: "false"
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Lint

env:
PYTHON_VERSION: "3.12"

# Report on every PR, including changes outside the Python test paths.
# Required checks need a result even when a PR changes no Python files.
on:
push:
branches: [main]
pull_request:
workflow_dispatch:

permissions:
contents: read

concurrency:
group: lint-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
ruff:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 1
persist-credentials: false
- name: 🐍 setup python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: 🛠️ install deps
run: |
python -m pip install --upgrade pip
pip install uv
uv sync --locked --extra dev
- name: 🧹 ruff check
run: uv run --locked --extra dev ruff check
- name: 🎨 ruff format
run: uv run --locked --extra dev ruff format --check
2 changes: 1 addition & 1 deletion .github/workflows/package-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
python-version: "3.12"

- name: Install build tooling
uses: $/.github/actions/setup-hatch
uses: ./.github/actions/setup-hatch

- name: Install distribution validator
run: python -m pip install "twine>=4.0.0"
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/pr-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ jobs:
core.setOutput('head_sha', pullRequest.head.sha);

build:
# Manual builds execute PR code in the default branch's cache scope.
# Keep this job free of cache restore/save steps. Publishing runs separately
# with write permissions and consumes artifacts without checking out PR code.
needs: context
runs-on: ubuntu-latest
timeout-minutes: 10
Expand All @@ -112,7 +115,7 @@ jobs:
python-version: "3.12"

- name: Install build tooling
uses: $/.github/actions/setup-hatch
uses: ./.github/actions/setup-hatch

- name: Install distribution validator
run: python -m pip install "twine>=4.0.0"
Expand Down Expand Up @@ -252,7 +255,7 @@ jobs:
path: dist

- name: Set up Docker publishing
uses: $/.github/actions/setup-docker
uses: ./.github/actions/setup-docker
with:
# QEMU is required to build the arm64 layer on an amd64 runner.
enable-qemu: "true"
Expand Down
20 changes: 0 additions & 20 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,26 +60,6 @@ jobs:
print('import smoke OK')
"

ruff:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 1
persist-credentials: false
- name: 🐍 setup python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: 🛠️ install deps
run: |
python -m pip install --upgrade pip
pip install uv
uv sync --extra dev
- name: 🧹 run ruff
run: uv run ruff check

unsupported-python-install:
runs-on: ubuntu-latest
timeout-minutes: 10
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ jobs:
python-version: '3.13'

- name: Install build tooling
uses: $/.github/actions/setup-hatch
uses: ./.github/actions/setup-hatch

- name: Get Version
id: version
env:
REF_NAME: ${{ github.ref_name }}
run: |
RAW_VERSION=$(hatch version)
echo "VERSION=$RAW_VERSION" >> $GITHUB_ENV
echo "VERSION=$RAW_VERSION" >> "$GITHUB_ENV"
if [ "v$RAW_VERSION" != "$REF_NAME" ]; then
echo "Error: Git tag ($REF_NAME) does not match hatch version (v$RAW_VERSION)"
exit 1
Expand All @@ -39,12 +39,12 @@ jobs:
env:
VERSION: ${{ env.VERSION }}
run: |
if curl -s -f https://pypi.org/pypi/socketsecurity/$VERSION/json > /dev/null; then
if curl -s -f "https://pypi.org/pypi/socketsecurity/$VERSION/json" > /dev/null; then
echo "Version ${VERSION} already exists on PyPI"
echo "pypi_exists=true" >> $GITHUB_OUTPUT
echo "pypi_exists=true" >> "$GITHUB_OUTPUT"
else
echo "Version ${VERSION} not found on PyPI - proceeding with PyPI deployment"
echo "pypi_exists=false" >> $GITHUB_OUTPUT
echo "pypi_exists=false" >> "$GITHUB_OUTPUT"
fi

- name: Check Docker image existence
Expand All @@ -54,9 +54,9 @@ jobs:
run: |
if curl -s -f "https://hub.docker.com/v2/repositories/socketdev/cli/tags/${VERSION}" > /dev/null; then
echo "Docker image socketdev/cli:${VERSION} already exists"
echo "docker_exists=true" >> $GITHUB_OUTPUT
echo "docker_exists=true" >> "$GITHUB_OUTPUT"
else
echo "docker_exists=false" >> $GITHUB_OUTPUT
echo "docker_exists=false" >> "$GITHUB_OUTPUT"
fi

- name: Build package
Expand All @@ -70,7 +70,7 @@ jobs:
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3

- name: Set up Docker publishing
uses: $/.github/actions/setup-docker
uses: ./.github/actions/setup-docker
with:
dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }}
Expand Down
41 changes: 29 additions & 12 deletions .github/workflows/version-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,25 @@ jobs:
pip install packaging

# Get version from current PR
PR_VERSION=$(grep -o "__version__.*" socketsecurity/__init__.py | awk '{print $3}' | tr -d "'")
echo "PR_VERSION=$PR_VERSION" >> $GITHUB_ENV
PR_VERSION=$(grep -E '^__version__[[:space:]]*=' socketsecurity/__init__.py | awk '{print $3}' | tr -d "\"'")
echo "PR_VERSION=$PR_VERSION" >> "$GITHUB_ENV"

# Get version from main branch
MAIN_VERSION=$(git show origin/main:socketsecurity/__init__.py | grep -o "__version__.*" | awk '{print $3}' | tr -d "'")
echo "MAIN_VERSION=$MAIN_VERSION" >> $GITHUB_ENV
MAIN_VERSION=$(git show origin/main:socketsecurity/__init__.py | grep -E '^__version__[[:space:]]*=' | awk '{print $3}' | tr -d "\"'")
echo "MAIN_VERSION=$MAIN_VERSION" >> "$GITHUB_ENV"

export PR_VERSION
export MAIN_VERSION

# CI and documentation changes do not require a package release.
if git diff --name-only origin/main...HEAD \
| grep -qE '^(socketsecurity/|pyproject\.toml$|uv\.lock$)'; then
PACKAGE_CHANGED=true
else
PACKAGE_CHANGED=false
fi
export PACKAGE_CHANGED

# Compare against the latest published PyPI release.
python3 <<'PY'
import json
Expand All @@ -52,6 +61,18 @@ jobs:
pr_ver = version.parse(os.environ["PR_VERSION"])
main_ver = version.parse(os.environ["MAIN_VERSION"])

enforced = os.environ["PACKAGE_CHANGED"] == "true"

def reject(message):
print(message)
if enforced:
raise SystemExit(1)
print(
"ℹ️ Not enforced: this PR changes no packaged files, "
"so it ships nothing that needs a new version."
)
raise SystemExit(0)

with open("pyproject.toml", "rb") as fh:
pyproject_ver = version.parse(tomllib.load(fh)["project"]["version"])

Expand All @@ -65,12 +86,11 @@ jobs:
# copy, but uv derives it and `uv lock --locked` in python-tests
# already fails when it drifts.)
if pr_ver != pyproject_ver:
print(
reject(
f"❌ Version mismatch inside the PR: pyproject.toml is "
f"{pyproject_ver}, socketsecurity/__init__.py is {pr_ver}. "
f"Bump both."
)
raise SystemExit(1)

with urllib.request.urlopen("https://pypi.org/pypi/socketsecurity/json") as response:
pypi_data = json.load(response)
Expand All @@ -91,11 +111,10 @@ jobs:
# header. Main is therefore only a floor when this PR moves the
# version -- a change to it must go forwards, never backwards.
if pr_ver <= pypi_ver:
print(
reject(
f"❌ Version {pr_ver} is already published on PyPI "
f"(latest release: {pypi_ver}). Bump it."
)
raise SystemExit(1)

# Releases are immutable: once a v<version> release is published, its tag can't
# be moved or reused, even when that release failed and nothing reached PyPI.
Expand All @@ -106,17 +125,15 @@ jobs:
["git", "rev-parse", "--quiet", "--verify", f"refs/tags/{tag}"],
capture_output=True,
).returncode == 0:
print(
reject(
f"❌ Tag {tag} already exists, so {pr_ver} can never be released "
f"(latest PyPI release: {pypi_ver}). Bump to a version with no tag."
)
raise SystemExit(1)

if pr_ver < main_ver:
print(
reject(
f"❌ Version moves backwards: main is {main_ver}, PR is {pr_ver}."
)
raise SystemExit(1)

if pr_ver == main_ver:
print(
Expand Down
Loading
Loading