socketdev 3.1.0__tar.gz → 3.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- socketdev-3.1.2/.github/actions/setup-hatch/action.yml +13 -0
- socketdev-3.1.2/.github/actions/setup-sfw/action.yml +41 -0
- socketdev-3.1.2/.github/dependabot.yml +63 -0
- socketdev-3.1.2/.github/workflows/dependency-review.yml +281 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/.github/workflows/pr-preview.yml +15 -7
- {socketdev-3.1.0 → socketdev-3.1.2}/.github/workflows/release.yml +3 -8
- {socketdev-3.1.0 → socketdev-3.1.2}/.github/workflows/version-check.yml +53 -10
- socketdev-3.1.2/.hooks/sync_version.py +172 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/PKG-INFO +1 -1
- {socketdev-3.1.0 → socketdev-3.1.2}/pyproject.toml +1 -1
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/core/issues.py +1 -1
- socketdev-3.1.2/socketdev/version.py +1 -0
- socketdev-3.1.2/tests/unit/test_issues_did_you_mean_props.py +28 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/uv.lock +91 -80
- socketdev-3.1.0/.hooks/sync_version.py +0 -95
- socketdev-3.1.0/socketdev/version.py +0 -1
- {socketdev-3.1.0 → socketdev-3.1.2}/.github/CODEOWNERS +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/.github/PULL_REQUEST_TEMPLATE/bug-fix.md +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/.github/PULL_REQUEST_TEMPLATE/improvement.md +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/.gitignore +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/.python-version +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/LICENSE +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/README.rst +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/scripts/build.sh +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/scripts/deploy-test-pypi.sh +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/alertfullscansearch/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/alerts/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/alerttypes/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/analytics/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/apitokens/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/auditlog/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/basics/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/core/api.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/core/classes.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/core/dedupe.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/dependencies/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/diffscans/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/exceptions.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/export/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/fixes/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/fullscans/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/historical/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/labels/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/licensemetadata/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/log.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/npm/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/openapi/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/org/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/purl/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/quota/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/report/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/repos/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/repositories/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/sbom/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/settings/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/supportedfiles/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/telemetry/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/threatfeed/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/tools/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/triage/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/uploadmanifests/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/utils/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/socketdev/webhooks/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/tests/README.md +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/tests/conftest.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/tests/integration/test_all_endpoints.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/tests/integration/test_comprehensive_integration.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/tests/integration/test_diffscans_integration.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/tests/integration/test_new_endpoints.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/tests/run_tests.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/tests/unit/__init__.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/tests/unit/test_all_endpoints_unit.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/tests/unit/test_dedupe.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/tests/unit/test_socket_alert_category.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/tests/unit/test_socket_sdk_unit.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/tests/unit/test_upload_manifests.py +0 -0
- {socketdev-3.1.0 → socketdev-3.1.2}/tests/unit/test_working_endpoints_unit.py +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
name: "Set up Hatch build tooling"
|
|
2
|
+
description: >-
|
|
3
|
+
Install the pinned hatch / hatchling / virtualenv toolchain used to build
|
|
4
|
+
and publish the package. Assumes Python is already set up by the caller.
|
|
5
|
+
|
|
6
|
+
runs:
|
|
7
|
+
using: "composite"
|
|
8
|
+
steps:
|
|
9
|
+
- shell: bash
|
|
10
|
+
run: |
|
|
11
|
+
python -m pip install --upgrade pip
|
|
12
|
+
pip install "virtualenv<20.36"
|
|
13
|
+
pip install hatchling==1.27.0 hatch==1.14.0
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: "Set up Socket Firewall"
|
|
2
|
+
description: >-
|
|
3
|
+
Set up the requested Python/uv toolchain and install Socket Firewall so
|
|
4
|
+
subsequent steps can run package-manager commands wrapped with `sfw`.
|
|
5
|
+
Defaults to free/anonymous mode (no API token -- safe on untrusted /
|
|
6
|
+
Dependabot / fork PRs). Pass mode: firewall-enterprise + socket-token for
|
|
7
|
+
full org-policy enforcement on trusted maintainer PRs.
|
|
8
|
+
|
|
9
|
+
inputs:
|
|
10
|
+
python:
|
|
11
|
+
description: "Set up Python 3.12"
|
|
12
|
+
default: "false"
|
|
13
|
+
uv:
|
|
14
|
+
description: "Install uv (implies Python)"
|
|
15
|
+
default: "false"
|
|
16
|
+
mode:
|
|
17
|
+
description: "socketdev/action mode: firewall-free or firewall-enterprise"
|
|
18
|
+
default: "firewall-free"
|
|
19
|
+
socket-token:
|
|
20
|
+
description: "Socket API token (only used/required for firewall-enterprise)"
|
|
21
|
+
default: ""
|
|
22
|
+
|
|
23
|
+
runs:
|
|
24
|
+
using: "composite"
|
|
25
|
+
steps:
|
|
26
|
+
- if: ${{ inputs.python == 'true' || inputs.uv == 'true' }}
|
|
27
|
+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
|
28
|
+
with:
|
|
29
|
+
python-version: "3.12"
|
|
30
|
+
|
|
31
|
+
# Official Socket setup action. Wires up sfw routing correctly.
|
|
32
|
+
# socket-token is ignored in firewall-free mode and empty when absent.
|
|
33
|
+
- uses: socketdev/action@ba6de6cc0565af1f42295590380973573297e31f # v1.3.2
|
|
34
|
+
with:
|
|
35
|
+
mode: ${{ inputs.mode }}
|
|
36
|
+
socket-token: ${{ inputs.socket-token }}
|
|
37
|
+
|
|
38
|
+
- if: ${{ inputs.uv == 'true' }}
|
|
39
|
+
name: Install uv
|
|
40
|
+
shell: bash
|
|
41
|
+
run: python -m pip install --upgrade pip uv
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Dependabot configuration for socket-sdk-python.
|
|
2
|
+
#
|
|
3
|
+
# Design notes:
|
|
4
|
+
# - Python deps are grouped into a weekly PR (minor/patch), with a
|
|
5
|
+
# separate group for majors so breaking bumps stay reviewable.
|
|
6
|
+
# - GitHub Actions are grouped similarly into one weekly PR, and Dependabot
|
|
7
|
+
# scans both the workflows and the local composite actions.
|
|
8
|
+
# - 7-day cooldown enforced across all ecosystems.
|
|
9
|
+
# - This repo ships no Dockerfile, so there is no docker ecosystem entry.
|
|
10
|
+
|
|
11
|
+
version: 2
|
|
12
|
+
updates:
|
|
13
|
+
|
|
14
|
+
# Python deps (uv-tracked via uv.lock)
|
|
15
|
+
- package-ecosystem: "uv"
|
|
16
|
+
directory: "/"
|
|
17
|
+
schedule:
|
|
18
|
+
interval: "weekly"
|
|
19
|
+
open-pull-requests-limit: 2
|
|
20
|
+
groups:
|
|
21
|
+
python-minor-patch:
|
|
22
|
+
patterns:
|
|
23
|
+
- "*"
|
|
24
|
+
update-types:
|
|
25
|
+
- "minor"
|
|
26
|
+
- "patch"
|
|
27
|
+
python-major:
|
|
28
|
+
patterns:
|
|
29
|
+
- "*"
|
|
30
|
+
update-types:
|
|
31
|
+
- "major"
|
|
32
|
+
labels:
|
|
33
|
+
- "dependencies"
|
|
34
|
+
- "python:uv"
|
|
35
|
+
commit-message:
|
|
36
|
+
prefix: "chore"
|
|
37
|
+
include: "scope"
|
|
38
|
+
cooldown:
|
|
39
|
+
default-days: 7
|
|
40
|
+
|
|
41
|
+
# GitHub Actions used in workflows and local composite actions.
|
|
42
|
+
- package-ecosystem: "github-actions"
|
|
43
|
+
directories:
|
|
44
|
+
- "/"
|
|
45
|
+
- "/.github/actions/*"
|
|
46
|
+
schedule:
|
|
47
|
+
interval: "weekly"
|
|
48
|
+
open-pull-requests-limit: 2
|
|
49
|
+
groups:
|
|
50
|
+
github-actions-minor-patch:
|
|
51
|
+
patterns:
|
|
52
|
+
- "*"
|
|
53
|
+
update-types:
|
|
54
|
+
- "minor"
|
|
55
|
+
- "patch"
|
|
56
|
+
labels:
|
|
57
|
+
- "dependencies"
|
|
58
|
+
- "github-actions"
|
|
59
|
+
commit-message:
|
|
60
|
+
prefix: "ci"
|
|
61
|
+
include: "scope"
|
|
62
|
+
cooldown:
|
|
63
|
+
default-days: 7
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
name: dependency-review
|
|
2
|
+
|
|
3
|
+
# Supply-chain guardrails for dependency-update PRs -- for BOTH Dependabot
|
|
4
|
+
# and maintainers. `inspect` classifies the PR, then exactly one Socket
|
|
5
|
+
# Firewall (sfw) install smoke job runs when Python deps change:
|
|
6
|
+
#
|
|
7
|
+
# - python-sfw-smoke-enterprise -- trusted authors: any in-repo (non-fork)
|
|
8
|
+
# PR other than Dependabot's (i.e. someone with write access). Runs the
|
|
9
|
+
# authenticated enterprise edition for full org-policy enforcement. The
|
|
10
|
+
# SOCKET_SFW_API_TOKEN is scoped to the `socket-firewall` environment, so
|
|
11
|
+
# it is the ONLY job that can read the token.
|
|
12
|
+
# - python-sfw-smoke-free -- everyone else (Dependabot + all fork PRs from
|
|
13
|
+
# external contributors). Anonymous free edition, no token. This job never
|
|
14
|
+
# references the secret.
|
|
15
|
+
#
|
|
16
|
+
# Splitting the jobs (rather than picking a mode in one job) keeps the token
|
|
17
|
+
# out of scope on every untrusted run and satisfies zizmor's
|
|
18
|
+
# `secrets-outside-env` audit without suppressing it. The free path runs in
|
|
19
|
+
# the unprivileged `pull_request` context with no secret-leak surface.
|
|
20
|
+
#
|
|
21
|
+
# Pattern adapted from SocketDev/socket-python-cli.
|
|
22
|
+
|
|
23
|
+
on:
|
|
24
|
+
pull_request:
|
|
25
|
+
types: [opened, synchronize, reopened, ready_for_review]
|
|
26
|
+
|
|
27
|
+
permissions:
|
|
28
|
+
contents: read
|
|
29
|
+
|
|
30
|
+
concurrency:
|
|
31
|
+
group: dependency-review-${{ github.event.pull_request.number }}
|
|
32
|
+
cancel-in-progress: true
|
|
33
|
+
|
|
34
|
+
jobs:
|
|
35
|
+
inspect:
|
|
36
|
+
runs-on: ubuntu-latest
|
|
37
|
+
timeout-minutes: 5
|
|
38
|
+
outputs:
|
|
39
|
+
python_deps_changed: ${{ steps.diff.outputs.python_deps_changed }}
|
|
40
|
+
workflow_or_action_changed: ${{ steps.diff.outputs.workflow_or_action_changed }}
|
|
41
|
+
is_trusted: ${{ steps.trust.outputs.is_trusted }}
|
|
42
|
+
steps:
|
|
43
|
+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
44
|
+
with:
|
|
45
|
+
fetch-depth: 0
|
|
46
|
+
persist-credentials: false
|
|
47
|
+
|
|
48
|
+
- name: Inspect changed files
|
|
49
|
+
id: diff
|
|
50
|
+
env:
|
|
51
|
+
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
|
52
|
+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
|
53
|
+
run: |
|
|
54
|
+
CHANGED_FILES="$(git diff --name-only "$BASE_SHA" "$HEAD_SHA")"
|
|
55
|
+
|
|
56
|
+
{
|
|
57
|
+
echo "## Changed files"
|
|
58
|
+
echo '```'
|
|
59
|
+
printf '%s\n' "$CHANGED_FILES"
|
|
60
|
+
echo '```'
|
|
61
|
+
} >> "$GITHUB_STEP_SUMMARY"
|
|
62
|
+
|
|
63
|
+
has_file() {
|
|
64
|
+
local pattern="$1"
|
|
65
|
+
if printf '%s\n' "$CHANGED_FILES" | grep -Eq "$pattern"; then
|
|
66
|
+
echo "true"
|
|
67
|
+
else
|
|
68
|
+
echo "false"
|
|
69
|
+
fi
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
{
|
|
73
|
+
echo "python_deps_changed=$(has_file '^(pyproject\.toml|uv\.lock)$')"
|
|
74
|
+
echo "workflow_or_action_changed=$(has_file '^\.github/workflows/|^\.github/actions/|^\.github/dependabot\.yml$')"
|
|
75
|
+
} >> "$GITHUB_OUTPUT"
|
|
76
|
+
|
|
77
|
+
- name: Classify PR trust
|
|
78
|
+
id: trust
|
|
79
|
+
# Trusted == any in-repo (non-fork) PR that isn't Dependabot's. Only
|
|
80
|
+
# accounts with write access can push a branch to this repo, so a
|
|
81
|
+
# non-fork PR already implies a trusted author -- the same boundary
|
|
82
|
+
# GitHub uses to decide whether secrets are exposed at all.
|
|
83
|
+
#
|
|
84
|
+
# NB: author_association is deliberately NOT used to require strict org
|
|
85
|
+
# membership. It only reflects PUBLIC org membership, so private members
|
|
86
|
+
# (the common case) show up as CONTRIBUTOR and would be misclassified.
|
|
87
|
+
# Reliable strict-membership detection would need a read:org token or
|
|
88
|
+
# public membership. This step references NO secret regardless -- it
|
|
89
|
+
# only decides which smoke job runs.
|
|
90
|
+
env:
|
|
91
|
+
IS_DEPENDABOT: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
|
|
92
|
+
IS_FORK: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
|
|
93
|
+
AUTHOR_ASSOC: ${{ github.event.pull_request.author_association }}
|
|
94
|
+
run: |
|
|
95
|
+
is_trusted=false
|
|
96
|
+
if [ "$IS_DEPENDABOT" != "true" ] && [ "$IS_FORK" != "true" ]; then
|
|
97
|
+
is_trusted=true
|
|
98
|
+
fi
|
|
99
|
+
|
|
100
|
+
echo "is_trusted=$is_trusted" >> "$GITHUB_OUTPUT"
|
|
101
|
+
{
|
|
102
|
+
echo "## Socket Firewall edition: \`$([ "$is_trusted" = true ] && echo enterprise || echo free)\`"
|
|
103
|
+
echo "- author_association: \`$AUTHOR_ASSOC\`"
|
|
104
|
+
echo "- dependabot: \`$IS_DEPENDABOT\` | fork: \`$IS_FORK\`"
|
|
105
|
+
} >> "$GITHUB_STEP_SUMMARY"
|
|
106
|
+
|
|
107
|
+
- name: Summarize review expectations
|
|
108
|
+
env:
|
|
109
|
+
PR_URL: ${{ github.event.pull_request.html_url }}
|
|
110
|
+
run: |
|
|
111
|
+
{
|
|
112
|
+
echo "## Dependency Review Checklist"
|
|
113
|
+
echo "- PR: $PR_URL"
|
|
114
|
+
echo "- Confirm upstream release notes before merge"
|
|
115
|
+
echo "- Do not treat a dependency PR as trusted solely because of the actor"
|
|
116
|
+
echo "- This workflow runs in pull_request context only; no publish secrets are exposed"
|
|
117
|
+
} >> "$GITHUB_STEP_SUMMARY"
|
|
118
|
+
|
|
119
|
+
# Untrusted PRs (Dependabot, forks, outside collaborators, externals):
|
|
120
|
+
# anonymous free edition. Never references the token.
|
|
121
|
+
python-sfw-smoke-free:
|
|
122
|
+
needs: inspect
|
|
123
|
+
if: needs.inspect.outputs.python_deps_changed == 'true' && needs.inspect.outputs.is_trusted != 'true'
|
|
124
|
+
runs-on: ubuntu-latest
|
|
125
|
+
timeout-minutes: 15
|
|
126
|
+
steps:
|
|
127
|
+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
128
|
+
with:
|
|
129
|
+
fetch-depth: 1
|
|
130
|
+
persist-credentials: false
|
|
131
|
+
|
|
132
|
+
- name: Prepare SFW artifact directory
|
|
133
|
+
run: |
|
|
134
|
+
mkdir -p sfw-artifacts
|
|
135
|
+
{
|
|
136
|
+
echo "mode=firewall-free"
|
|
137
|
+
echo "pr=${{ github.event.pull_request.number }}"
|
|
138
|
+
echo "sha=${{ github.event.pull_request.head.sha }}"
|
|
139
|
+
} > sfw-artifacts/context.txt
|
|
140
|
+
|
|
141
|
+
- uses: ./.github/actions/setup-sfw
|
|
142
|
+
with:
|
|
143
|
+
uv: "true"
|
|
144
|
+
mode: firewall-free
|
|
145
|
+
|
|
146
|
+
- name: Sync project through Socket Firewall (free)
|
|
147
|
+
# pipefail keeps sfw's exit code through the tee so a firewall block
|
|
148
|
+
# still fails the job; tee captures the report for the artifact upload.
|
|
149
|
+
env:
|
|
150
|
+
UV_PYTHON: "3.12"
|
|
151
|
+
UV_PYTHON_DOWNLOADS: never
|
|
152
|
+
run: |
|
|
153
|
+
set -o pipefail
|
|
154
|
+
sfw uv sync --locked --extra test --extra dev 2>&1 | tee sfw-artifacts/sfw-uv-sync.log
|
|
155
|
+
|
|
156
|
+
- name: Import smoke test
|
|
157
|
+
run: |
|
|
158
|
+
set -o pipefail
|
|
159
|
+
uv run python -c "
|
|
160
|
+
import socketdev
|
|
161
|
+
from socketdev import socketdev as SocketDevClient
|
|
162
|
+
from socketdev.core.api import API
|
|
163
|
+
from socketdev.version import __version__
|
|
164
|
+
print('import smoke OK', __version__)
|
|
165
|
+
" 2>&1 | tee sfw-artifacts/import-smoke.log
|
|
166
|
+
|
|
167
|
+
- name: Collect SFW JSON report
|
|
168
|
+
# socketdev/action points sfw at SFW_JSON_REPORT_PATH (a $RUNNER_TEMP
|
|
169
|
+
# file) and reads it back in its post step to render the job summary, so
|
|
170
|
+
# COPY (don't move) the report into the bundle. sfw writes it even when
|
|
171
|
+
# it blocks an install -- always() keeps it on failures too.
|
|
172
|
+
if: always()
|
|
173
|
+
run: |
|
|
174
|
+
if [ -n "${SFW_JSON_REPORT_PATH:-}" ] && [ -f "$SFW_JSON_REPORT_PATH" ]; then
|
|
175
|
+
cp "$SFW_JSON_REPORT_PATH" "$GITHUB_WORKSPACE/sfw-artifacts/sfw-report.json"
|
|
176
|
+
echo "Collected SFW report -> sfw-artifacts/sfw-report.json"
|
|
177
|
+
else
|
|
178
|
+
echo "No SFW JSON report found at '${SFW_JSON_REPORT_PATH:-<unset>}'." \
|
|
179
|
+
> "$GITHUB_WORKSPACE/sfw-artifacts/sfw-report-missing.txt"
|
|
180
|
+
fi
|
|
181
|
+
|
|
182
|
+
- name: Upload SFW report artifact
|
|
183
|
+
if: always()
|
|
184
|
+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
185
|
+
with:
|
|
186
|
+
name: socket-firewall-free-${{ github.event.pull_request.number }}
|
|
187
|
+
path: sfw-artifacts/
|
|
188
|
+
if-no-files-found: warn
|
|
189
|
+
retention-days: 14
|
|
190
|
+
|
|
191
|
+
# Trusted SocketDev members: authenticated enterprise edition. The token is
|
|
192
|
+
# scoped to the `socket-firewall` environment, so only this job can read it.
|
|
193
|
+
python-sfw-smoke-enterprise:
|
|
194
|
+
needs: inspect
|
|
195
|
+
if: needs.inspect.outputs.python_deps_changed == 'true' && needs.inspect.outputs.is_trusted == 'true'
|
|
196
|
+
runs-on: ubuntu-latest
|
|
197
|
+
timeout-minutes: 15
|
|
198
|
+
environment: socket-firewall
|
|
199
|
+
steps:
|
|
200
|
+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
201
|
+
with:
|
|
202
|
+
fetch-depth: 1
|
|
203
|
+
persist-credentials: false
|
|
204
|
+
|
|
205
|
+
- name: Prepare SFW artifact directory
|
|
206
|
+
run: |
|
|
207
|
+
mkdir -p sfw-artifacts
|
|
208
|
+
{
|
|
209
|
+
echo "mode=firewall-enterprise"
|
|
210
|
+
echo "pr=${{ github.event.pull_request.number }}"
|
|
211
|
+
echo "sha=${{ github.event.pull_request.head.sha }}"
|
|
212
|
+
} > sfw-artifacts/context.txt
|
|
213
|
+
|
|
214
|
+
- uses: ./.github/actions/setup-sfw
|
|
215
|
+
with:
|
|
216
|
+
uv: "true"
|
|
217
|
+
mode: firewall-enterprise
|
|
218
|
+
socket-token: ${{ secrets.SOCKET_SFW_API_TOKEN }}
|
|
219
|
+
|
|
220
|
+
- name: Sync project through Socket Firewall (enterprise)
|
|
221
|
+
# See free job for the UV_PYTHON rationale: .python-version pins an
|
|
222
|
+
# exact patch that uv would otherwise fetch from GitHub through the
|
|
223
|
+
# firewall (blocked by its TLS interception); use the runner's Python.
|
|
224
|
+
#
|
|
225
|
+
# pipefail keeps sfw's exit code through the tee so a firewall block
|
|
226
|
+
# still fails the job; tee captures the report for the artifact upload.
|
|
227
|
+
env:
|
|
228
|
+
UV_PYTHON: "3.12"
|
|
229
|
+
UV_PYTHON_DOWNLOADS: never
|
|
230
|
+
run: |
|
|
231
|
+
set -o pipefail
|
|
232
|
+
sfw uv sync --locked --extra test --extra dev 2>&1 | tee sfw-artifacts/sfw-uv-sync.log
|
|
233
|
+
|
|
234
|
+
- name: Import smoke test
|
|
235
|
+
run: |
|
|
236
|
+
set -o pipefail
|
|
237
|
+
uv run python -c "
|
|
238
|
+
import socketdev
|
|
239
|
+
from socketdev import socketdev as SocketDevClient
|
|
240
|
+
from socketdev.core.api import API
|
|
241
|
+
from socketdev.version import __version__
|
|
242
|
+
print('import smoke OK', __version__)
|
|
243
|
+
" 2>&1 | tee sfw-artifacts/import-smoke.log
|
|
244
|
+
|
|
245
|
+
- name: Collect SFW JSON report
|
|
246
|
+
# socketdev/action points sfw at SFW_JSON_REPORT_PATH (a $RUNNER_TEMP
|
|
247
|
+
# file) and reads it back in its post step to render the job summary, so
|
|
248
|
+
# COPY (don't move) the report into the bundle. sfw writes it even when
|
|
249
|
+
# it blocks an install -- always() keeps it on failures too.
|
|
250
|
+
if: always()
|
|
251
|
+
run: |
|
|
252
|
+
if [ -n "${SFW_JSON_REPORT_PATH:-}" ] && [ -f "$SFW_JSON_REPORT_PATH" ]; then
|
|
253
|
+
cp "$SFW_JSON_REPORT_PATH" "$GITHUB_WORKSPACE/sfw-artifacts/sfw-report.json"
|
|
254
|
+
echo "Collected SFW report -> sfw-artifacts/sfw-report.json"
|
|
255
|
+
else
|
|
256
|
+
echo "No SFW JSON report found at '${SFW_JSON_REPORT_PATH:-<unset>}'." \
|
|
257
|
+
> "$GITHUB_WORKSPACE/sfw-artifacts/sfw-report-missing.txt"
|
|
258
|
+
fi
|
|
259
|
+
|
|
260
|
+
- name: Upload SFW report artifact
|
|
261
|
+
if: always()
|
|
262
|
+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
263
|
+
with:
|
|
264
|
+
name: socket-firewall-enterprise-${{ github.event.pull_request.number }}
|
|
265
|
+
path: sfw-artifacts/
|
|
266
|
+
if-no-files-found: warn
|
|
267
|
+
retention-days: 14
|
|
268
|
+
|
|
269
|
+
workflow-notice:
|
|
270
|
+
needs: inspect
|
|
271
|
+
if: needs.inspect.outputs.workflow_or_action_changed == 'true'
|
|
272
|
+
runs-on: ubuntu-latest
|
|
273
|
+
timeout-minutes: 2
|
|
274
|
+
steps:
|
|
275
|
+
- name: Flag workflow-sensitive updates
|
|
276
|
+
run: |
|
|
277
|
+
{
|
|
278
|
+
echo "## Sensitive File Notice"
|
|
279
|
+
echo "This PR changes workflow, composite-action, or dependabot config files."
|
|
280
|
+
echo "Require explicit human review before merge."
|
|
281
|
+
} >> "$GITHUB_STEP_SUMMARY"
|
|
@@ -3,8 +3,21 @@ on:
|
|
|
3
3
|
pull_request:
|
|
4
4
|
types: [opened, synchronize, ready_for_review]
|
|
5
5
|
|
|
6
|
+
# Cancel an in-flight preview when the PR is pushed again -- previews publish
|
|
7
|
+
# to Test PyPI, so superseded runs shouldn't keep churning.
|
|
8
|
+
concurrency:
|
|
9
|
+
group: pr-preview-${{ github.event.pull_request.number }}
|
|
10
|
+
cancel-in-progress: true
|
|
11
|
+
|
|
6
12
|
jobs:
|
|
7
13
|
preview:
|
|
14
|
+
# Skip on:
|
|
15
|
+
# - PRs from forks (no access to publish secrets / OIDC)
|
|
16
|
+
# - Dependabot PRs: preview-publishing a dependency bump to Test PyPI is
|
|
17
|
+
# pointless (no package version bump) and would fail the version check.
|
|
18
|
+
if: >-
|
|
19
|
+
github.event.pull_request.head.repo.full_name == github.repository &&
|
|
20
|
+
github.event.pull_request.user.login != 'dependabot[bot]'
|
|
8
21
|
runs-on: ubuntu-latest
|
|
9
22
|
permissions:
|
|
10
23
|
id-token: write
|
|
@@ -19,13 +32,8 @@ jobs:
|
|
|
19
32
|
with:
|
|
20
33
|
python-version: '3.13'
|
|
21
34
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
run: |
|
|
25
|
-
python -m pip install --upgrade pip
|
|
26
|
-
pip install "virtualenv<20.36"
|
|
27
|
-
pip install hatchling==1.27.0
|
|
28
|
-
pip install hatch==1.14.0
|
|
35
|
+
- name: Install build tooling
|
|
36
|
+
uses: ./.github/actions/setup-hatch
|
|
29
37
|
|
|
30
38
|
- name: Inject full dynamic version
|
|
31
39
|
run: python .hooks/sync_version.py --dev
|
|
@@ -18,14 +18,9 @@ jobs:
|
|
|
18
18
|
with:
|
|
19
19
|
python-version: '3.13'
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
python -m pip install --upgrade pip
|
|
25
|
-
pip install "virtualenv<20.36"
|
|
26
|
-
pip install hatchling==1.27.0
|
|
27
|
-
pip install hatch==1.14.0
|
|
28
|
-
|
|
21
|
+
- name: Install build tooling
|
|
22
|
+
uses: ./.github/actions/setup-hatch
|
|
23
|
+
|
|
29
24
|
- name: Get Version
|
|
30
25
|
id: version
|
|
31
26
|
env:
|
|
@@ -4,8 +4,8 @@ on:
|
|
|
4
4
|
types: [opened, synchronize, ready_for_review]
|
|
5
5
|
paths:
|
|
6
6
|
- 'socketdev/**'
|
|
7
|
-
- 'setup.py'
|
|
8
7
|
- 'pyproject.toml'
|
|
8
|
+
- 'uv.lock'
|
|
9
9
|
|
|
10
10
|
permissions:
|
|
11
11
|
contents: read
|
|
@@ -14,6 +14,10 @@ permissions:
|
|
|
14
14
|
|
|
15
15
|
jobs:
|
|
16
16
|
check_version:
|
|
17
|
+
# Skip on Dependabot PRs: they bump dependencies (touching uv.lock /
|
|
18
|
+
# pyproject.toml) without bumping the package version, so the increment
|
|
19
|
+
# check would always fail. Package-version bumps come from maintainer PRs.
|
|
20
|
+
if: github.event.pull_request.user.login != 'dependabot[bot]'
|
|
17
21
|
runs-on: ubuntu-latest
|
|
18
22
|
steps:
|
|
19
23
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
@@ -33,16 +37,55 @@ jobs:
|
|
|
33
37
|
MAIN_VERSION=$(grep -o "__version__.*" socketdev/version.py | awk '{print $3}' | tr -d '"' | tr -d "'")
|
|
34
38
|
echo "MAIN_VERSION=$MAIN_VERSION" >> $GITHUB_ENV
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
export PR_VERSION
|
|
41
|
+
export MAIN_VERSION
|
|
42
|
+
|
|
43
|
+
# Compare against both main and latest published PyPI release.
|
|
44
|
+
python3 <<'PY'
|
|
45
|
+
import json
|
|
46
|
+
import os
|
|
47
|
+
import urllib.request
|
|
38
48
|
from packaging import version
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
|
|
50
|
+
pr_ver = version.parse(os.environ["PR_VERSION"])
|
|
51
|
+
main_ver = version.parse(os.environ["MAIN_VERSION"])
|
|
52
|
+
|
|
53
|
+
with urllib.request.urlopen("https://pypi.org/pypi/socketdev/json") as response:
|
|
54
|
+
pypi_data = json.load(response)
|
|
55
|
+
|
|
56
|
+
published_versions = []
|
|
57
|
+
for raw in pypi_data.get("releases", {}).keys():
|
|
58
|
+
parsed = version.parse(raw)
|
|
59
|
+
if not parsed.is_prerelease and not parsed.is_devrelease:
|
|
60
|
+
published_versions.append(parsed)
|
|
61
|
+
|
|
62
|
+
pypi_ver = max(published_versions) if published_versions else version.parse("0.0.0")
|
|
63
|
+
required_floor = max(main_ver, pypi_ver)
|
|
64
|
+
|
|
65
|
+
if pr_ver <= required_floor:
|
|
66
|
+
print(
|
|
67
|
+
f"❌ Version must be greater than main and PyPI! "
|
|
68
|
+
f"Main: {main_ver}, PyPI: {pypi_ver}, PR: {pr_ver}"
|
|
69
|
+
)
|
|
70
|
+
raise SystemExit(1)
|
|
71
|
+
|
|
72
|
+
print(
|
|
73
|
+
f"✅ Version properly incremented. "
|
|
74
|
+
f"Main: {main_ver}, PyPI: {pypi_ver}, PR: {pr_ver}"
|
|
75
|
+
)
|
|
76
|
+
PY
|
|
77
|
+
|
|
78
|
+
- name: Require uv.lock update when pyproject changes
|
|
79
|
+
run: |
|
|
80
|
+
CHANGED_FILES="$(git diff --name-only origin/main...HEAD)"
|
|
81
|
+
|
|
82
|
+
if echo "$CHANGED_FILES" | grep -qx 'pyproject.toml'; then
|
|
83
|
+
if ! echo "$CHANGED_FILES" | grep -qx 'uv.lock'; then
|
|
84
|
+
echo "❌ pyproject.toml changed, but uv.lock was not updated."
|
|
85
|
+
echo "Run 'uv lock' and commit uv.lock with the version bump."
|
|
86
|
+
exit 1
|
|
87
|
+
fi
|
|
88
|
+
fi
|
|
46
89
|
|
|
47
90
|
- name: Manage PR Comment
|
|
48
91
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
|