socketdev 3.6.0__tar.gz → 3.6.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.
Files changed (94) hide show
  1. {socketdev-3.6.0 → socketdev-3.6.2}/.github/actions/setup-hatch/action.yml +1 -2
  2. {socketdev-3.6.0 → socketdev-3.6.2}/.github/actions/setup-sfw/action.yml +1 -1
  3. {socketdev-3.6.0 → socketdev-3.6.2}/.github/workflows/api-drift-check.yml +1 -1
  4. {socketdev-3.6.0 → socketdev-3.6.2}/.github/workflows/dependency-review.yml +2 -2
  5. {socketdev-3.6.0 → socketdev-3.6.2}/.github/workflows/package-check.yml +2 -2
  6. {socketdev-3.6.0 → socketdev-3.6.2}/.github/workflows/pr-preview.yml +4 -4
  7. {socketdev-3.6.0 → socketdev-3.6.2}/.github/workflows/release.yml +2 -2
  8. {socketdev-3.6.0 → socketdev-3.6.2}/.github/workflows/version-check.yml +57 -13
  9. {socketdev-3.6.0 → socketdev-3.6.2}/CHANGELOG.md +58 -0
  10. {socketdev-3.6.0 → socketdev-3.6.2}/PKG-INFO +23 -7
  11. {socketdev-3.6.0 → socketdev-3.6.2}/README.rst +16 -1
  12. {socketdev-3.6.0 → socketdev-3.6.2}/pyproject.toml +13 -8
  13. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/__init__.py +5 -9
  14. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/core/api.py +7 -1
  15. socketdev-3.6.2/socketdev/core/retired_token.py +34 -0
  16. socketdev-3.6.2/socketdev/core/token_selection.py +19 -0
  17. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/fullscans/__init__.py +61 -4
  18. socketdev-3.6.2/socketdev/version.py +1 -0
  19. socketdev-3.6.2/tests/support/socket_api_fixture.py +121 -0
  20. socketdev-3.6.2/tests/unit/test_full_scan_cached_polling_http.py +182 -0
  21. socketdev-3.6.2/tests/unit/test_retired_token.py +85 -0
  22. {socketdev-3.6.0 → socketdev-3.6.2}/tests/unit/test_socket_purl_type.py +29 -21
  23. {socketdev-3.6.0 → socketdev-3.6.2}/uv.lock +202 -625
  24. socketdev-3.6.0/socketdev/version.py +0 -1
  25. {socketdev-3.6.0 → socketdev-3.6.2}/.gitattributes +0 -0
  26. {socketdev-3.6.0 → socketdev-3.6.2}/.github/CODEOWNERS +0 -0
  27. {socketdev-3.6.0 → socketdev-3.6.2}/.github/PULL_REQUEST_TEMPLATE/bug-fix.md +0 -0
  28. {socketdev-3.6.0 → socketdev-3.6.2}/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -0
  29. {socketdev-3.6.0 → socketdev-3.6.2}/.github/PULL_REQUEST_TEMPLATE/improvement.md +0 -0
  30. {socketdev-3.6.0 → socketdev-3.6.2}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  31. {socketdev-3.6.0 → socketdev-3.6.2}/.github/dependabot.yml +0 -0
  32. {socketdev-3.6.0 → socketdev-3.6.2}/.gitignore +0 -0
  33. {socketdev-3.6.0 → socketdev-3.6.2}/.hooks/sync_version.py +0 -0
  34. {socketdev-3.6.0 → socketdev-3.6.2}/.python-version +0 -0
  35. {socketdev-3.6.0 → socketdev-3.6.2}/CONTRIBUTING.md +0 -0
  36. {socketdev-3.6.0 → socketdev-3.6.2}/LICENSE +0 -0
  37. {socketdev-3.6.0 → socketdev-3.6.2}/scripts/build.sh +0 -0
  38. {socketdev-3.6.0 → socketdev-3.6.2}/scripts/check_api_enum_drift.py +0 -0
  39. {socketdev-3.6.0 → socketdev-3.6.2}/scripts/deploy-test-pypi.sh +0 -0
  40. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/alertfullscansearch/__init__.py +0 -0
  41. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/alerts/__init__.py +0 -0
  42. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/alerttypes/__init__.py +0 -0
  43. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/analytics/__init__.py +0 -0
  44. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/apitokens/__init__.py +0 -0
  45. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/auditlog/__init__.py +0 -0
  46. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/basics/__init__.py +0 -0
  47. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/core/classes.py +0 -0
  48. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/core/dedupe.py +0 -0
  49. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/core/enums.py +0 -0
  50. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/core/issues.py +0 -0
  51. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/dependencies/__init__.py +0 -0
  52. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/diffscans/__init__.py +0 -0
  53. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/exceptions.py +0 -0
  54. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/export/__init__.py +0 -0
  55. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/fixes/__init__.py +0 -0
  56. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/historical/__init__.py +0 -0
  57. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/labels/__init__.py +0 -0
  58. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/licensemetadata/__init__.py +0 -0
  59. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/log.py +0 -0
  60. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/npm/__init__.py +0 -0
  61. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/openapi/__init__.py +0 -0
  62. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/org/__init__.py +0 -0
  63. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/purl/__init__.py +0 -0
  64. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/quota/__init__.py +0 -0
  65. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/report/__init__.py +0 -0
  66. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/repos/__init__.py +0 -0
  67. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/repositories/__init__.py +0 -0
  68. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/sbom/__init__.py +0 -0
  69. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/settings/__init__.py +0 -0
  70. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/supportedfiles/__init__.py +0 -0
  71. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/telemetry/__init__.py +0 -0
  72. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/threatfeed/__init__.py +0 -0
  73. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/tools/__init__.py +0 -0
  74. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/triage/__init__.py +0 -0
  75. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/uploadmanifests/__init__.py +0 -0
  76. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/utils/__init__.py +0 -0
  77. {socketdev-3.6.0 → socketdev-3.6.2}/socketdev/webhooks/__init__.py +0 -0
  78. {socketdev-3.6.0 → socketdev-3.6.2}/tests/README.md +0 -0
  79. {socketdev-3.6.0 → socketdev-3.6.2}/tests/conftest.py +0 -0
  80. {socketdev-3.6.0 → socketdev-3.6.2}/tests/integration/test_all_endpoints.py +0 -0
  81. {socketdev-3.6.0 → socketdev-3.6.2}/tests/integration/test_comprehensive_integration.py +0 -0
  82. {socketdev-3.6.0 → socketdev-3.6.2}/tests/integration/test_diffscans_integration.py +0 -0
  83. {socketdev-3.6.0 → socketdev-3.6.2}/tests/integration/test_new_endpoints.py +0 -0
  84. {socketdev-3.6.0 → socketdev-3.6.2}/tests/run_tests.py +0 -0
  85. {socketdev-3.6.0 → socketdev-3.6.2}/tests/unit/__init__.py +0 -0
  86. {socketdev-3.6.0 → socketdev-3.6.2}/tests/unit/test_all_endpoints_unit.py +0 -0
  87. {socketdev-3.6.0 → socketdev-3.6.2}/tests/unit/test_dedupe.py +0 -0
  88. {socketdev-3.6.0 → socketdev-3.6.2}/tests/unit/test_enum_forward_compat.py +0 -0
  89. {socketdev-3.6.0 → socketdev-3.6.2}/tests/unit/test_exceptions.py +0 -0
  90. {socketdev-3.6.0 → socketdev-3.6.2}/tests/unit/test_issues_did_you_mean_props.py +0 -0
  91. {socketdev-3.6.0 → socketdev-3.6.2}/tests/unit/test_socket_alert_category.py +0 -0
  92. {socketdev-3.6.0 → socketdev-3.6.2}/tests/unit/test_socket_sdk_unit.py +0 -0
  93. {socketdev-3.6.0 → socketdev-3.6.2}/tests/unit/test_upload_manifests.py +0 -0
  94. {socketdev-3.6.0 → socketdev-3.6.2}/tests/unit/test_working_endpoints_unit.py +0 -0
@@ -9,5 +9,4 @@ runs:
9
9
  - shell: bash
10
10
  run: |
11
11
  python -m pip install --upgrade pip
12
- pip install "virtualenv<20.36"
13
- pip install hatchling==1.27.0 hatch==1.14.0
12
+ python -m pip install "hatch==1.18.1" "hatchling==1.32.4" "virtualenv==21.14.7"
@@ -24,7 +24,7 @@ runs:
24
24
  using: "composite"
25
25
  steps:
26
26
  - if: ${{ inputs.python == 'true' || inputs.uv == 'true' }}
27
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
27
+ uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
28
28
  with:
29
29
  python-version: "3.12"
30
30
 
@@ -26,7 +26,7 @@ jobs:
26
26
  fetch-depth: 1
27
27
  persist-credentials: false
28
28
 
29
- - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
29
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
30
30
  with:
31
31
  python-version: "3.12"
32
32
 
@@ -181,7 +181,7 @@ jobs:
181
181
 
182
182
  - name: Upload SFW report artifact
183
183
  if: always()
184
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
184
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
185
185
  with:
186
186
  name: socket-firewall-free-${{ github.event.pull_request.number }}
187
187
  path: sfw-artifacts/
@@ -259,7 +259,7 @@ jobs:
259
259
 
260
260
  - name: Upload SFW report artifact
261
261
  if: always()
262
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
262
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
263
263
  with:
264
264
  name: socket-firewall-enterprise-${{ github.event.pull_request.number }}
265
265
  path: sfw-artifacts/
@@ -23,7 +23,7 @@ jobs:
23
23
  fetch-depth: 1
24
24
  persist-credentials: false
25
25
 
26
- - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
26
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
27
27
  with:
28
28
  python-version: "3.12"
29
29
 
@@ -50,7 +50,7 @@ jobs:
50
50
  "$RUNNER_TEMP/package-check/bin/python" -c "import socketdev; from socketdev.version import __version__; print('wheel smoke OK', __version__)"
51
51
 
52
52
  - name: Upload distributions
53
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
53
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
54
54
  with:
55
55
  name: socketdev-${{ github.sha }}
56
56
  path: dist/*
@@ -92,7 +92,7 @@ jobs:
92
92
  fetch-depth: 0
93
93
  persist-credentials: false
94
94
 
95
- - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
95
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
96
96
  with:
97
97
  python-version: "3.12"
98
98
 
@@ -127,7 +127,7 @@ jobs:
127
127
  "$RUNNER_TEMP/preview-check/bin/python" -c "import socketdev; from socketdev.version import __version__; print('preview wheel smoke OK', __version__)"
128
128
 
129
129
  - name: Upload preview distributions
130
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
130
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
131
131
  with:
132
132
  name: socketdev-preview-${{ github.run_id }}-${{ github.run_attempt }}
133
133
  path: dist/*
@@ -144,13 +144,13 @@ jobs:
144
144
  pull-requests: write
145
145
  steps:
146
146
  - name: Download preview distributions
147
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
147
+ uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
148
148
  with:
149
149
  name: socketdev-preview-${{ github.run_id }}-${{ github.run_attempt }}
150
150
  path: dist
151
151
 
152
152
  - name: Publish to TestPyPI
153
- uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
153
+ uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
154
154
  with:
155
155
  repository-url: https://test.pypi.org/legacy/
156
156
  verbose: true
@@ -14,7 +14,7 @@ jobs:
14
14
  with:
15
15
  fetch-depth: 0
16
16
  persist-credentials: false
17
- - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
17
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
18
18
  with:
19
19
  python-version: '3.13'
20
20
 
@@ -53,7 +53,7 @@ jobs:
53
53
 
54
54
  - name: Publish to PyPI
55
55
  if: steps.version_check.outputs.pypi_exists != 'true'
56
- uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
56
+ uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
57
57
 
58
58
  - name: Verify package is installable
59
59
  id: verify_package
@@ -6,6 +6,8 @@ on:
6
6
  - 'socketdev/**'
7
7
  - 'pyproject.toml'
8
8
  - 'uv.lock'
9
+ # Included so a change to the check itself is exercised by its own PR.
10
+ - '.github/workflows/version-check.yml'
9
11
 
10
12
  permissions:
11
13
  contents: read
@@ -32,15 +34,29 @@ jobs:
32
34
  PR_VERSION=$(grep -o "__version__.*" socketdev/version.py | awk '{print $3}' | tr -d '"' | tr -d "'")
33
35
  echo "PR_VERSION=$PR_VERSION" >> $GITHUB_ENV
34
36
 
35
- # Get version from main branch
36
- git checkout origin/main
37
- MAIN_VERSION=$(grep -o "__version__.*" socketdev/version.py | awk '{print $3}' | tr -d '"' | tr -d "'")
37
+ # Get version from main branch. Read it straight out of the ref:
38
+ # `git checkout origin/main` leaves the working tree detached on main,
39
+ # so the uv.lock guard below ends up diffing main against itself and
40
+ # never fires.
41
+ MAIN_VERSION=$(git show origin/main:socketdev/version.py | grep -o "__version__.*" | awk '{print $3}' | tr -d '"' | tr -d "'")
38
42
  echo "MAIN_VERSION=$MAIN_VERSION" >> $GITHUB_ENV
39
43
 
40
44
  export PR_VERSION
41
45
  export MAIN_VERSION
42
46
 
43
- # Compare against both main and latest published PyPI release.
47
+ # Only enforce a bump when the PR actually changes shipped content.
48
+ # This workflow sits in its own paths filter so edits to it are
49
+ # exercised, but a CI-only change ships nothing and must not be told
50
+ # to cut a release. The comparison still runs and reports either way.
51
+ if git diff --name-only origin/main...HEAD \
52
+ | grep -qE '^(socketdev/|pyproject\.toml$|uv\.lock$)'; then
53
+ PACKAGE_CHANGED=true
54
+ else
55
+ PACKAGE_CHANGED=false
56
+ fi
57
+ export PACKAGE_CHANGED
58
+
59
+ # Compare against the latest published PyPI release.
44
60
  python3 <<'PY'
45
61
  import json
46
62
  import os
@@ -60,19 +76,47 @@ jobs:
60
76
  published_versions.append(parsed)
61
77
 
62
78
  pypi_ver = max(published_versions) if published_versions else version.parse("0.0.0")
63
- required_floor = max(main_ver, pypi_ver)
64
79
 
65
- if pr_ver <= required_floor:
80
+ enforced = os.environ["PACKAGE_CHANGED"] == "true"
81
+
82
+ def reject(message):
83
+ print(message)
84
+ if enforced:
85
+ raise SystemExit(1)
66
86
  print(
67
- f"❌ Version must be greater than main and PyPI! "
68
- f"Main: {main_ver}, PyPI: {pypi_ver}, PR: {pr_ver}"
87
+ "ℹ️ Not enforced: this PR changes no packaged files, "
88
+ "so it ships nothing that needs a new version."
89
+ )
90
+ raise SystemExit(0)
91
+
92
+ # The only hard requirement is that the version is ahead of what is
93
+ # actually released. Treating main's version as a second floor breaks
94
+ # the legitimate case where several PRs share one unreleased release:
95
+ # the first bumps main to the new version and the rest ride it without
96
+ # bumping again, which is what keeps them under a single changelog
97
+ # header. Main is therefore only a floor when this PR moves the
98
+ # version -- a change to it must go forwards, never backwards.
99
+ if pr_ver <= pypi_ver:
100
+ reject(
101
+ f"❌ Version {pr_ver} is already published on PyPI "
102
+ f"(latest release: {pypi_ver}). Bump it."
103
+ )
104
+
105
+ if pr_ver < main_ver:
106
+ reject(
107
+ f"❌ Version moves backwards: main is {main_ver}, PR is {pr_ver}."
69
108
  )
70
- raise SystemExit(1)
71
109
 
72
- print(
73
- f"✅ Version properly incremented. "
74
- f"Main: {main_ver}, PyPI: {pypi_ver}, PR: {pr_ver}"
75
- )
110
+ if pr_ver == main_ver:
111
+ print(
112
+ f"✅ Riding main's unreleased {pr_ver} "
113
+ f"(latest PyPI release: {pypi_ver})."
114
+ )
115
+ else:
116
+ print(
117
+ f"✅ Version properly incremented. "
118
+ f"Main: {main_ver}, PyPI: {pypi_ver}, PR: {pr_ver}"
119
+ )
76
120
  PY
77
121
 
78
122
  - name: Require uv.lock update when pyproject changes
@@ -1,5 +1,63 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.6.2
4
+
5
+ ### Fixed: reject retired API credentials before use
6
+
7
+ - The SDK rejects the retired API credential before storing or encoding it.
8
+
9
+ ### Fixed: full-scan reads wait for analysis to finish
10
+
11
+ - `fullscans.stream()` now requests cached results (`?cached=true`) and polls
12
+ while the API answers `202 Processing`, instead of treating the first `202`
13
+ as a failed result. Polling backs off from 5s to 10s between attempts and
14
+ stops when the budget runs out, raising `APITimeout`.
15
+ - The polling budget defaults to the SDK's configured `timeout`. Callers can
16
+ tune it with the new keyword-only arguments `poll_timeout_seconds`,
17
+ `poll_initial_interval_seconds` and `poll_max_interval_seconds`. Each
18
+ request is bounded by the configured `timeout` or the remaining budget,
19
+ whichever is shorter, and polling stops early once the next attempt could
20
+ not start before the budget runs out.
21
+ - Transient failures (HTTP 408/502/503/504, timeouts, dropped connections) are
22
+ retried within the budget. Authorization, not-found and quota errors still
23
+ raise immediately.
24
+ - Invalid polling settings (zero, negative, non-finite, booleans, or an
25
+ initial interval above the maximum) raise `ValueError` before any request is
26
+ sent.
27
+ - The organization slug and full scan ID are now URL-encoded in the request
28
+ path.
29
+ - `API.do_request()` accepts an optional keyword-only `request_timeout` that
30
+ overrides the configured timeout for a single call.
31
+
32
+ ## 3.6.1
33
+
34
+ ### Security: patched releases of certifi, uv and virtualenv
35
+
36
+ - Updated the locked versions of `certifi` (2025.11.12 → 2026.10.19), `uv`
37
+ (0.11.17 → 0.13.4) and `virtualenv` (20.36.1 → 21.14.7) to pick up fixes for
38
+ critical vulnerabilities. These versions are pinned in `uv.lock`, which
39
+ controls the development and CI environment.
40
+ - socketdev now requires `certifi>=2026.10.19`, so installing it also upgrades
41
+ the CA bundle `requests` uses. Older bundles trust the compromised eMudhra
42
+ intermediate CAs.
43
+ - The release build toolchain (`.github/actions/setup-hatch`) now installs
44
+ `virtualenv==21.14.7` and `hatchling==1.32.4`, matching `uv.lock` and the
45
+ `[build-system]` pin. Published artifacts are built with the patched versions.
46
+ - Raised the `requests` floor to `>=2.33.0`.
47
+
48
+ ### Changed: Python 3.10 or newer is required
49
+
50
+ - `requires-python` is now `>=3.10` (previously `>=3.9`). The patched
51
+ dependency releases no longer support Python 3.9, which reached end of life
52
+ in October 2025. On Python 3.9, pip continues to resolve socketdev 3.6.0.
53
+
54
+ ### Maintenance
55
+
56
+ - Pinned the `hatchling` build backend to 1.32.4 and capped built
57
+ distributions at core metadata 2.4 so the locked Twine can validate them.
58
+ - Raised the dev and test extras floors to `hatch>=1.18.1` and
59
+ `pytest>=9.0.3`.
60
+
3
61
  ## 3.6.0
4
62
 
5
63
  ### Changed: every API-sourced enum now tolerates unknown values
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.5
1
+ Metadata-Version: 2.4
2
2
  Name: socketdev
3
- Version: 3.6.0
3
+ Version: 3.6.2
4
4
  Summary: Socket Security Python SDK
5
5
  Project-URL: Homepage, https://github.com/SocketDev/socket-sdk-python
6
6
  Author-email: Douglas Coburn <douglas@socket.dev>
@@ -35,23 +35,29 @@ Classifier: Programming Language :: Python :: 3.11
35
35
  Classifier: Programming Language :: Python :: 3.12
36
36
  Classifier: Programming Language :: Python :: 3.13
37
37
  Classifier: Programming Language :: Python :: 3.14
38
- Requires-Python: >=3.9
39
- Requires-Dist: requests<3,>=2.32.5
38
+ Requires-Python: >=3.10
39
+ Requires-Dist: certifi>=2026.10.19
40
+ Requires-Dist: requests<3,>=2.33.0
40
41
  Requires-Dist: typing-extensions<5,>=4.12.2
41
42
  Provides-Extra: dev
42
- Requires-Dist: hatch>=1.14.0; extra == 'dev'
43
+ Requires-Dist: hatch>=1.18.1; extra == 'dev'
43
44
  Requires-Dist: hatchling>=1.27.0; extra == 'dev'
44
45
  Requires-Dist: ruff>=0.3.0; extra == 'dev'
45
46
  Requires-Dist: twine>=4.0.0; extra == 'dev'
46
47
  Provides-Extra: test
47
48
  Requires-Dist: pytest-cov>=4.0.0; extra == 'test'
48
- Requires-Dist: pytest>=7.0.0; extra == 'test'
49
+ Requires-Dist: pytest>=9.0.3; extra == 'test'
49
50
  Description-Content-Type: text/x-rst
50
51
 
51
52
 
52
53
  socketdev
53
54
  #########
54
55
 
56
+ Supported Python versions
57
+ -------------------------
58
+
59
+ This SDK supports Python 3.10 and newer.
60
+
55
61
  Purpose
56
62
  -------
57
63
 
@@ -336,7 +342,11 @@ Stream a diff between two full scans. Returns a scan diff.
336
342
 
337
343
  fullscans.stream(org_slug, full_scan_id, use_types=False)
338
344
  """""""""""""""""""""""""""""""""""""""""""""""""""""""""
339
- Stream all SBOM artifacts for a full scan.
345
+ Stream all SBOM artifacts for a full scan. If the scan is still being analyzed, the SDK polls
346
+ cached results until they are ready, backing off from 5 to 10 seconds between attempts, and
347
+ raises ``APITimeout`` if they are not ready within the polling budget. Transient failures
348
+ (HTTP 408/502/503/504, timeouts, dropped connections) are retried within the budget; other
349
+ errors raise immediately.
340
350
 
341
351
  **Usage:**
342
352
 
@@ -349,11 +359,17 @@ Stream all SBOM artifacts for a full scan.
349
359
  # With typed response
350
360
  print(socket.fullscans.stream("org_slug", "full_scan_id", use_types=True))
351
361
 
362
+ # Wait up to 10 minutes for analysis to finish
363
+ print(socket.fullscans.stream("org_slug", "full_scan_id", poll_timeout_seconds=600))
364
+
352
365
  **PARAMETERS:**
353
366
 
354
367
  - **org_slug (str)** - The organization name
355
368
  - **full_scan_id (str)** - The ID of the full scan
356
369
  - **use_types (bool)** - Whether to return typed response objects (default: False)
370
+ - **poll_timeout_seconds (float)** - Keyword-only. Total time to wait for results (default: the SDK's configured ``timeout``)
371
+ - **poll_initial_interval_seconds (float)** - Keyword-only. Wait before the first retry (default: 5.0)
372
+ - **poll_max_interval_seconds (float)** - Keyword-only. Longest wait between retries (default: 10.0)
357
373
 
358
374
  fullscans.metadata(org_slug, full_scan_id, use_types=False)
359
375
  """""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@@ -2,6 +2,11 @@
2
2
  socketdev
3
3
  #########
4
4
 
5
+ Supported Python versions
6
+ -------------------------
7
+
8
+ This SDK supports Python 3.10 and newer.
9
+
5
10
  Purpose
6
11
  -------
7
12
 
@@ -286,7 +291,11 @@ Stream a diff between two full scans. Returns a scan diff.
286
291
 
287
292
  fullscans.stream(org_slug, full_scan_id, use_types=False)
288
293
  """""""""""""""""""""""""""""""""""""""""""""""""""""""""
289
- Stream all SBOM artifacts for a full scan.
294
+ Stream all SBOM artifacts for a full scan. If the scan is still being analyzed, the SDK polls
295
+ cached results until they are ready, backing off from 5 to 10 seconds between attempts, and
296
+ raises ``APITimeout`` if they are not ready within the polling budget. Transient failures
297
+ (HTTP 408/502/503/504, timeouts, dropped connections) are retried within the budget; other
298
+ errors raise immediately.
290
299
 
291
300
  **Usage:**
292
301
 
@@ -299,11 +308,17 @@ Stream all SBOM artifacts for a full scan.
299
308
  # With typed response
300
309
  print(socket.fullscans.stream("org_slug", "full_scan_id", use_types=True))
301
310
 
311
+ # Wait up to 10 minutes for analysis to finish
312
+ print(socket.fullscans.stream("org_slug", "full_scan_id", poll_timeout_seconds=600))
313
+
302
314
  **PARAMETERS:**
303
315
 
304
316
  - **org_slug (str)** - The organization name
305
317
  - **full_scan_id (str)** - The ID of the full scan
306
318
  - **use_types (bool)** - Whether to return typed response objects (default: False)
319
+ - **poll_timeout_seconds (float)** - Keyword-only. Total time to wait for results (default: the SDK's configured ``timeout``)
320
+ - **poll_initial_interval_seconds (float)** - Keyword-only. Wait before the first retry (default: 5.0)
321
+ - **poll_max_interval_seconds (float)** - Keyword-only. Longest wait between retries (default: 10.0)
307
322
 
308
323
  fullscans.metadata(org_slug, full_scan_id, use_types=False)
309
324
  """""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@@ -1,16 +1,17 @@
1
1
  [build-system]
2
- # 1.27.0 is the newest hatchling that supports Python 3.9, which this
3
- # package's requires-python still includes.
4
- requires = ["hatchling==1.32.0"]
2
+ requires = ["hatchling==1.32.4"]
5
3
  build-backend = "hatchling.build"
6
4
 
7
5
  [project]
8
6
  name = "socketdev"
9
7
  dynamic = ["version"]
10
- requires-python = ">= 3.9"
8
+ requires-python = ">= 3.10"
11
9
  dependencies = [
12
- 'requests>=2.32.5,<3',
13
- 'typing-extensions>=4.12.2,<5'
10
+ 'requests>=2.33.0,<3',
11
+ 'typing-extensions>=4.12.2,<5',
12
+ # requests' CA bundle. 2026.10.19 drops the roots behind the compromised
13
+ # eMudhra intermediates; a floor, so later trust-store fixes still apply.
14
+ 'certifi>=2026.10.19'
14
15
  ]
15
16
  readme = "README.rst"
16
17
  license = {file = "LICENSE"}
@@ -37,17 +38,21 @@ path = "socketdev/version.py"
37
38
 
38
39
  [tool.hatch.build.targets.wheel]
39
40
  packages = ["socketdev"]
41
+ core-metadata-version = "2.4"
42
+
43
+ [tool.hatch.build.targets.sdist]
44
+ core-metadata-version = "2.4"
40
45
 
41
46
  # modern, faster linter and language server. install with `pip install -e ".[dev]"`
42
47
  [project.optional-dependencies]
43
48
  dev = [
44
49
  "ruff>=0.3.0",
45
- "hatch>=1.14.0",
50
+ "hatch>=1.18.1",
46
51
  "hatchling>=1.27.0",
47
52
  "twine>=4.0.0"
48
53
  ]
49
54
  test = [
50
- "pytest>=7.0.0",
55
+ "pytest>=9.0.3",
51
56
  "pytest-cov>=4.0.0"
52
57
  ]
53
58
 
@@ -1,5 +1,7 @@
1
1
  import os
2
2
  from socketdev.core.api import API
3
+ from socketdev.core.retired_token import reject_retired_token
4
+ from socketdev.core.token_selection import select_token
3
5
  from socketdev.dependencies import Dependencies
4
6
  from socketdev.diffscans import DiffScans
5
7
  from socketdev.export import Export
@@ -53,21 +55,15 @@ request_timeout = 1200
53
55
 
54
56
  class socketdev:
55
57
  def __init__(self, token: Optional[str] = None, timeout: int = 1200, allow_unverified: bool = False, user_agent: Optional[str] = None):
56
- # Try to get token from environment variables if not provided
57
- if token is None:
58
- token = (
59
- os.getenv("SOCKET_SECURITY_API_TOKEN") or
60
- os.getenv("SOCKET_SECURITY_API_KEY") or
61
- os.getenv("SOCKET_API_KEY") or
62
- os.getenv("SOCKET_API_TOKEN")
63
- )
64
-
58
+ token = select_token(token, os.environ)
65
59
  if token is None:
66
60
  raise ValueError(
67
61
  "API token is required. Provide it as a parameter or set one of these environment variables: "
68
62
  "SOCKET_SECURITY_API_TOKEN, SOCKET_SECURITY_API_KEY, SOCKET_API_KEY, SOCKET_API_TOKEN"
69
63
  )
70
64
 
65
+ reject_retired_token(token)
66
+
71
67
  self.api = API()
72
68
  self.token = token + ":"
73
69
  self.api.encode_key(self.token)
@@ -1,5 +1,7 @@
1
1
  import base64
2
+ from typing import Optional
2
3
  from socketdev.log import log
4
+ from socketdev.core.retired_token import reject_retired_basic_auth_token
3
5
 
4
6
  import requests
5
7
  from socketdev.core.classes import Response
@@ -29,6 +31,7 @@ class API:
29
31
  self.user_agent = None
30
32
 
31
33
  def encode_key(self, token: str):
34
+ reject_retired_basic_auth_token(token)
32
35
  self.encoded_key = base64.b64encode(token.encode()).decode("ascii")
33
36
 
34
37
  def set_timeout(self, timeout: int):
@@ -47,6 +50,8 @@ class API:
47
50
  payload: [dict, str] = None,
48
51
  files: list = None,
49
52
  method: str = "GET",
53
+ *,
54
+ request_timeout: Optional[float] = None,
50
55
  ) -> Response:
51
56
  if self.encoded_key is None or self.encoded_key == "":
52
57
  raise APIKeyMissing
@@ -68,7 +73,8 @@ class API:
68
73
 
69
74
  response = requests.request(
70
75
  method.upper(), url, headers=headers, data=payload, files=files,
71
- timeout=self.request_timeout, verify=not self.allow_unverified
76
+ timeout=self.request_timeout if request_timeout is None else request_timeout,
77
+ verify=not self.allow_unverified
72
78
  )
73
79
  request_duration = time.time() - start_time
74
80
 
@@ -0,0 +1,34 @@
1
+ import hashlib
2
+ import hmac
3
+ from typing import Optional
4
+
5
+ RETIRED_TOKEN_SHA256 = "9cab58b24140ee12c08e265729d246f9200f8ef9b1d884f90c06c4e6b69adf18"
6
+ RETIRED_TOKEN_ERROR = (
7
+ "This API token has been retired. Create a new API token in Socket "
8
+ "and update your configuration."
9
+ )
10
+
11
+
12
+ # Fingerprint identifies a retired credential; it is not a password verifier.
13
+ def _matches_retired_digest(token: Optional[str], digest: str) -> bool:
14
+ if token is None:
15
+ return False
16
+ token_digest = hashlib.sha256(token.strip().encode("utf-8")).hexdigest()
17
+ return hmac.compare_digest(token_digest, digest)
18
+
19
+
20
+ def _reject_retired_token(token: Optional[str], digest: str) -> None:
21
+ if _matches_retired_digest(token, digest):
22
+ raise ValueError(RETIRED_TOKEN_ERROR)
23
+
24
+
25
+ def _reject_basic_auth_token(token: str, digest: str) -> None:
26
+ _reject_retired_token(token.partition(":")[0], digest)
27
+
28
+
29
+ def reject_retired_token(token: Optional[str]) -> None:
30
+ _reject_retired_token(token, RETIRED_TOKEN_SHA256)
31
+
32
+
33
+ def reject_retired_basic_auth_token(token: str) -> None:
34
+ _reject_basic_auth_token(token, RETIRED_TOKEN_SHA256)
@@ -0,0 +1,19 @@
1
+ from typing import Mapping, Optional
2
+
3
+ TOKEN_ENVIRONMENT_VARIABLES = (
4
+ "SOCKET_SECURITY_API_TOKEN",
5
+ "SOCKET_SECURITY_API_KEY",
6
+ "SOCKET_API_KEY",
7
+ "SOCKET_API_TOKEN",
8
+ )
9
+
10
+
11
+ def select_token(
12
+ explicit_token: Optional[str], environment: Mapping[str, str]
13
+ ) -> Optional[str]:
14
+ if explicit_token is not None:
15
+ return explicit_token
16
+ return next(
17
+ (environment[name] for name in TOKEN_ENVIRONMENT_VARIABLES if environment.get(name)),
18
+ None,
19
+ )