socketdev 3.0.33__tar.gz → 3.1.0__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 (74) hide show
  1. {socketdev-3.0.33 → socketdev-3.1.0}/.gitignore +4 -1
  2. {socketdev-3.0.33 → socketdev-3.1.0}/PKG-INFO +10 -6
  3. {socketdev-3.0.33 → socketdev-3.1.0}/README.rst +8 -4
  4. {socketdev-3.0.33 → socketdev-3.1.0}/pyproject.toml +2 -2
  5. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/purl/__init__.py +16 -2
  6. socketdev-3.1.0/socketdev/version.py +1 -0
  7. {socketdev-3.0.33 → socketdev-3.1.0}/tests/integration/test_all_endpoints.py +14 -10
  8. {socketdev-3.0.33 → socketdev-3.1.0}/tests/integration/test_comprehensive_integration.py +9 -5
  9. {socketdev-3.0.33 → socketdev-3.1.0}/tests/unit/test_all_endpoints_unit.py +32 -15
  10. {socketdev-3.0.33 → socketdev-3.1.0}/tests/unit/test_socket_sdk_unit.py +3 -3
  11. {socketdev-3.0.33 → socketdev-3.1.0}/tests/unit/test_working_endpoints_unit.py +4 -4
  12. {socketdev-3.0.33 → socketdev-3.1.0}/uv.lock +1 -1
  13. socketdev-3.0.33/socketdev/version.py +0 -1
  14. {socketdev-3.0.33 → socketdev-3.1.0}/.github/CODEOWNERS +0 -0
  15. {socketdev-3.0.33 → socketdev-3.1.0}/.github/PULL_REQUEST_TEMPLATE/bug-fix.md +0 -0
  16. {socketdev-3.0.33 → socketdev-3.1.0}/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -0
  17. {socketdev-3.0.33 → socketdev-3.1.0}/.github/PULL_REQUEST_TEMPLATE/improvement.md +0 -0
  18. {socketdev-3.0.33 → socketdev-3.1.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  19. {socketdev-3.0.33 → socketdev-3.1.0}/.github/workflows/pr-preview.yml +0 -0
  20. {socketdev-3.0.33 → socketdev-3.1.0}/.github/workflows/release.yml +0 -0
  21. {socketdev-3.0.33 → socketdev-3.1.0}/.github/workflows/version-check.yml +0 -0
  22. {socketdev-3.0.33 → socketdev-3.1.0}/.hooks/sync_version.py +0 -0
  23. {socketdev-3.0.33 → socketdev-3.1.0}/.python-version +0 -0
  24. {socketdev-3.0.33 → socketdev-3.1.0}/LICENSE +0 -0
  25. {socketdev-3.0.33 → socketdev-3.1.0}/scripts/build.sh +0 -0
  26. {socketdev-3.0.33 → socketdev-3.1.0}/scripts/deploy-test-pypi.sh +0 -0
  27. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/__init__.py +0 -0
  28. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/alertfullscansearch/__init__.py +0 -0
  29. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/alerts/__init__.py +0 -0
  30. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/alerttypes/__init__.py +0 -0
  31. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/analytics/__init__.py +0 -0
  32. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/apitokens/__init__.py +0 -0
  33. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/auditlog/__init__.py +0 -0
  34. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/basics/__init__.py +0 -0
  35. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/core/api.py +0 -0
  36. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/core/classes.py +0 -0
  37. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/core/dedupe.py +0 -0
  38. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/core/issues.py +0 -0
  39. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/dependencies/__init__.py +0 -0
  40. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/diffscans/__init__.py +0 -0
  41. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/exceptions.py +0 -0
  42. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/export/__init__.py +0 -0
  43. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/fixes/__init__.py +0 -0
  44. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/fullscans/__init__.py +0 -0
  45. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/historical/__init__.py +0 -0
  46. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/labels/__init__.py +0 -0
  47. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/licensemetadata/__init__.py +0 -0
  48. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/log.py +0 -0
  49. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/npm/__init__.py +0 -0
  50. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/openapi/__init__.py +0 -0
  51. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/org/__init__.py +0 -0
  52. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/quota/__init__.py +0 -0
  53. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/report/__init__.py +0 -0
  54. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/repos/__init__.py +0 -0
  55. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/repositories/__init__.py +0 -0
  56. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/sbom/__init__.py +0 -0
  57. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/settings/__init__.py +0 -0
  58. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/supportedfiles/__init__.py +0 -0
  59. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/telemetry/__init__.py +0 -0
  60. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/threatfeed/__init__.py +0 -0
  61. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/tools/__init__.py +0 -0
  62. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/triage/__init__.py +0 -0
  63. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/uploadmanifests/__init__.py +0 -0
  64. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/utils/__init__.py +0 -0
  65. {socketdev-3.0.33 → socketdev-3.1.0}/socketdev/webhooks/__init__.py +0 -0
  66. {socketdev-3.0.33 → socketdev-3.1.0}/tests/README.md +0 -0
  67. {socketdev-3.0.33 → socketdev-3.1.0}/tests/conftest.py +0 -0
  68. {socketdev-3.0.33 → socketdev-3.1.0}/tests/integration/test_diffscans_integration.py +0 -0
  69. {socketdev-3.0.33 → socketdev-3.1.0}/tests/integration/test_new_endpoints.py +0 -0
  70. {socketdev-3.0.33 → socketdev-3.1.0}/tests/run_tests.py +0 -0
  71. {socketdev-3.0.33 → socketdev-3.1.0}/tests/unit/__init__.py +0 -0
  72. {socketdev-3.0.33 → socketdev-3.1.0}/tests/unit/test_dedupe.py +0 -0
  73. {socketdev-3.0.33 → socketdev-3.1.0}/tests/unit/test_socket_alert_category.py +0 -0
  74. {socketdev-3.0.33 → socketdev-3.1.0}/tests/unit/test_upload_manifests.py +0 -0
@@ -16,4 +16,7 @@ dist
16
16
  *.egg-info
17
17
  *.cpython-312.pyc
18
18
  example-socket-export.py
19
- __pycache__/
19
+ __pycache__/
20
+ .coverage
21
+ .coverage.*
22
+ htmlcov/
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: socketdev
3
- Version: 3.0.33
3
+ Version: 3.1.0
4
4
  Summary: Socket Security Python SDK
5
- Project-URL: Homepage, https://github.com/socketdev/socketdev
5
+ Project-URL: Homepage, https://github.com/SocketDev/socket-sdk-python
6
6
  Author-email: Douglas Coburn <douglas@socket.dev>
7
7
  Maintainer-email: Douglas Coburn <douglas@socket.dev>
8
8
  License: MIT License
@@ -78,9 +78,11 @@ Supported Functions
78
78
  -------------------
79
79
 
80
80
 
81
- purl.post(license, components)
82
- """"""""""""""""""""""""""""""
83
- Retrieve the package information for a purl post
81
+ purl.post(license, components, org_slug=None)
82
+ """""""""""""""""""""""""""""""""""""""""""""
83
+ Retrieve package information for one or more PURLs. Pass ``org_slug`` to use the
84
+ current org-scoped endpoint. Omitting ``org_slug`` keeps the legacy deprecated
85
+ endpoint for backwards compatibility.
84
86
 
85
87
  **Usage:**
86
88
 
@@ -88,6 +90,7 @@ Retrieve the package information for a purl post
88
90
 
89
91
  from socketdev import socketdev
90
92
  socket = socketdev(token="REPLACE_ME")
93
+ org_slug = "your-org-slug"
91
94
  license = "true"
92
95
  components = [
93
96
  {
@@ -97,12 +100,13 @@ Retrieve the package information for a purl post
97
100
  "purl": "pkg:pypi/socketsecurity"
98
101
  }
99
102
  ]
100
- print(socket.purl.post(license, components))
103
+ print(socket.purl.post(license, components, org_slug=org_slug))
101
104
 
102
105
  **PARAMETERS:**
103
106
 
104
107
  - **license (str)** - The license parameter if enabled will show alerts and license information. If disabled will only show the basic package metadata and scores. Default is true
105
108
  - **components (array{dict})** - The components list of packages urls
109
+ - **org_slug (str, optional)** - Organization slug for the supported org-scoped PURL endpoint. If omitted, the SDK uses the deprecated legacy endpoint for backwards compatibility.
106
110
 
107
111
  export.cdx_bom(org_slug, id, query_params)
108
112
  """"""""""""""""""""""""""""""""""""""""""
@@ -28,9 +28,11 @@ Supported Functions
28
28
  -------------------
29
29
 
30
30
 
31
- purl.post(license, components)
32
- """"""""""""""""""""""""""""""
33
- Retrieve the package information for a purl post
31
+ purl.post(license, components, org_slug=None)
32
+ """""""""""""""""""""""""""""""""""""""""""""
33
+ Retrieve package information for one or more PURLs. Pass ``org_slug`` to use the
34
+ current org-scoped endpoint. Omitting ``org_slug`` keeps the legacy deprecated
35
+ endpoint for backwards compatibility.
34
36
 
35
37
  **Usage:**
36
38
 
@@ -38,6 +40,7 @@ Retrieve the package information for a purl post
38
40
 
39
41
  from socketdev import socketdev
40
42
  socket = socketdev(token="REPLACE_ME")
43
+ org_slug = "your-org-slug"
41
44
  license = "true"
42
45
  components = [
43
46
  {
@@ -47,12 +50,13 @@ Retrieve the package information for a purl post
47
50
  "purl": "pkg:pypi/socketsecurity"
48
51
  }
49
52
  ]
50
- print(socket.purl.post(license, components))
53
+ print(socket.purl.post(license, components, org_slug=org_slug))
51
54
 
52
55
  **PARAMETERS:**
53
56
 
54
57
  - **license (str)** - The license parameter if enabled will show alerts and license information. If disabled will only show the basic package metadata and scores. Default is true
55
58
  - **components (array{dict})** - The components list of packages urls
59
+ - **org_slug (str, optional)** - Organization slug for the supported org-scoped PURL endpoint. If omitted, the SDK uses the deprecated legacy endpoint for backwards compatibility.
56
60
 
57
61
  export.cdx_bom(org_slug, id, query_params)
58
62
  """"""""""""""""""""""""""""""""""""""""""
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "socketdev"
7
- version = "3.0.33"
7
+ version = "3.1.0"
8
8
  requires-python = ">= 3.9"
9
9
  dependencies = [
10
10
  'requests',
@@ -50,7 +50,7 @@ test = [
50
50
  ]
51
51
 
52
52
  [project.urls]
53
- Homepage = "https://github.com/socketdev/socketdev"
53
+ Homepage = "https://github.com/SocketDev/socket-sdk-python"
54
54
 
55
55
  [tool.ruff]
56
56
  # Exclude a variety of commonly ignored directories.
@@ -1,5 +1,6 @@
1
1
  import json
2
2
  import urllib.parse
3
+ import warnings
3
4
  from socketdev.log import log
4
5
  from ..core.dedupe import Dedupe
5
6
 
@@ -8,8 +9,21 @@ class Purl:
8
9
  def __init__(self, api):
9
10
  self.api = api
10
11
 
11
- def post(self, license: str = "false", components: list = None, **kwargs) -> list:
12
- path = "purl?"
12
+ def post(
13
+ self,
14
+ license: str = "false",
15
+ components: list = None,
16
+ org_slug: str = None,
17
+ **kwargs,
18
+ ) -> list:
19
+ if org_slug is None:
20
+ warnings.warn(
21
+ "Calling purl.post() without org_slug uses the deprecated POST /v0/purl endpoint. "
22
+ "Pass org_slug to migrate to POST /v0/orgs/{org_slug}/purl.",
23
+ DeprecationWarning,
24
+ stacklevel=2,
25
+ )
26
+ path = f"orgs/{org_slug}/purl?" if org_slug else "purl?"
13
27
  if components is None:
14
28
  components = []
15
29
  purls = {"components": components}
@@ -0,0 +1 @@
1
+ __version__ = "3.1.0"
@@ -181,13 +181,13 @@ class TestAllEndpointsMocked(unittest.TestCase):
181
181
  def test_npm_issues_mocked(self):
182
182
  """Test npm issues endpoint."""
183
183
  self._mock_success_response([{"type": "security", "severity": "high"}])
184
- result = self.sdk.npm.issues("lodash", "4.17.21")
184
+ result = self.sdk.npm.issues("lodash", "4.18.1")
185
185
  self.assertIsInstance(result, list)
186
186
 
187
187
  def test_npm_score_mocked(self):
188
188
  """Test npm score endpoint."""
189
189
  self._mock_success_response([{"category": "security", "value": 85}])
190
- result = self.sdk.npm.score("lodash", "4.17.21")
190
+ result = self.sdk.npm.score("lodash", "4.18.1")
191
191
  self.assertIsInstance(result, list)
192
192
 
193
193
  # OpenAPI endpoints
@@ -206,9 +206,13 @@ class TestAllEndpointsMocked(unittest.TestCase):
206
206
 
207
207
  # PURL endpoints
208
208
  def test_purl_post_mocked(self):
209
- """Test purl post endpoint."""
210
- self._mock_success_response([{"purl": "pkg:npm/lodash@4.17.21", "valid": True}])
211
- result = self.sdk.purl.post("false", [{"purl": "pkg:npm/lodash@4.17.21"}])
209
+ """Test org-scoped purl post endpoint."""
210
+ mock_response = Mock()
211
+ mock_response.status_code = 200
212
+ mock_response.headers = {'content-type': 'application/x-ndjson'}
213
+ mock_response.text = '{"inputPurl": "pkg:npm/lodash@4.18.1", "purl": "pkg:npm/lodash@4.18.1", "type": "npm", "name": "lodash", "version": "4.18.1", "valid": true, "alerts": []}'
214
+ self.mock_requests.request.return_value = mock_response
215
+ result = self.sdk.purl.post("false", [{"purl": "pkg:npm/lodash@4.18.1"}], org_slug="test-org")
212
216
  self.assertIsInstance(result, list)
213
217
 
214
218
  # Quota endpoints
@@ -372,7 +376,7 @@ class TestAllEndpointsIntegration(unittest.TestCase):
372
376
  test_package = {
373
377
  "name": "test-integration-package",
374
378
  "version": "1.0.0",
375
- "dependencies": {"lodash": "4.17.21"}
379
+ "dependencies": {"lodash": "4.18.1"}
376
380
  }
377
381
  with open(cls.package_json_path, 'w') as f:
378
382
  json.dump(test_package, f, indent=2)
@@ -414,20 +418,20 @@ class TestAllEndpointsIntegration(unittest.TestCase):
414
418
  # NPM endpoints (should work for public packages)
415
419
  def test_npm_issues_integration(self):
416
420
  """Test npm issues endpoint."""
417
- result = self._try_endpoint(self.sdk.npm.issues, "lodash", "4.17.21")
421
+ result = self._try_endpoint(self.sdk.npm.issues, "lodash", "4.18.1")
418
422
  if result:
419
423
  self.assertIsInstance(result, list)
420
424
 
421
425
  def test_npm_score_integration(self):
422
426
  """Test npm score endpoint."""
423
- result = self._try_endpoint(self.sdk.npm.score, "lodash", "4.17.21")
427
+ result = self._try_endpoint(self.sdk.npm.score, "lodash", "4.18.1")
424
428
  if result:
425
429
  self.assertIsInstance(result, list)
426
430
 
427
431
  # PURL endpoints
428
432
  def test_purl_post_integration(self):
429
433
  """Test purl post endpoint."""
430
- components = [{"purl": "pkg:npm/lodash@4.17.21"}]
434
+ components = [{"purl": "pkg:npm/lodash@4.18.1"}]
431
435
  result = self._try_endpoint(self.sdk.purl.post, "false", components)
432
436
  if result:
433
437
  self.assertIsInstance(result, list)
@@ -515,7 +519,7 @@ class TestAllEndpointsIntegration(unittest.TestCase):
515
519
  """Test dependencies get endpoint."""
516
520
  result = self._try_endpoint(
517
521
  self.sdk.dependencies.get,
518
- self.org_slug, "npm", "lodash", "4.17.21"
522
+ self.org_slug, "npm", "lodash", "4.18.1"
519
523
  )
520
524
  if result:
521
525
  self.assertIsInstance(result, dict)
@@ -53,7 +53,7 @@ class TestSocketSDKIntegration(unittest.TestCase):
53
53
  "name": "test-integration-project",
54
54
  "version": "1.0.0",
55
55
  "dependencies": {
56
- "lodash": "4.17.21"
56
+ "lodash": "4.18.1"
57
57
  }
58
58
  }
59
59
 
@@ -264,7 +264,7 @@ class TestSocketSDKIntegration(unittest.TestCase):
264
264
  """Test NPM-related endpoints."""
265
265
  # Test getting package issues - this should work for most packages
266
266
  try:
267
- issues = self.sdk.npm.issues("lodash", "4.17.21")
267
+ issues = self.sdk.npm.issues("lodash", "4.18.1")
268
268
  self.assertIsInstance(issues, dict)
269
269
  except Exception as e:
270
270
  print(f"NPM issues endpoint not available: {e}")
@@ -281,9 +281,13 @@ class TestSocketSDKIntegration(unittest.TestCase):
281
281
  """Test PURL (Package URL) functionality."""
282
282
  try:
283
283
  # Test with a common npm package
284
- purl = "pkg:npm/lodash@4.17.21"
285
- result = self.sdk.purl.post([purl])
286
- self.assertIsInstance(result, dict)
284
+ purl = "pkg:npm/lodash@4.18.1"
285
+ result = self.sdk.purl.post(
286
+ license="false",
287
+ components=[{"purl": purl}],
288
+ org_slug=self.org_slug,
289
+ )
290
+ self.assertIsInstance(result, list)
287
291
  except Exception as e:
288
292
  print(f"PURL endpoint not available: {e}")
289
293
 
@@ -44,11 +44,11 @@ class TestAllEndpointsUnit(unittest.TestCase):
44
44
  # Dependencies endpoints
45
45
  def test_dependencies_post_unit(self):
46
46
  """Test dependencies post with proper file handling."""
47
- expected_data = {"packages": [{"name": "lodash", "version": "4.17.21"}]}
47
+ expected_data = {"packages": [{"name": "lodash", "version": "4.18.1"}]}
48
48
  self._mock_response(expected_data)
49
49
 
50
50
  with tempfile.NamedTemporaryFile(mode='w', suffix='.json', delete=False) as f:
51
- json.dump({"name": "test-package", "dependencies": {"lodash": "4.17.21"}}, f)
51
+ json.dump({"name": "test-package", "dependencies": {"lodash": "4.18.1"}}, f)
52
52
  f.flush()
53
53
 
54
54
  try:
@@ -72,12 +72,12 @@ class TestAllEndpointsUnit(unittest.TestCase):
72
72
  expected_data = {"dependencies": [{"name": "sub-dependency", "version": "1.0.0"}]}
73
73
  self._mock_response(expected_data)
74
74
 
75
- result = self.sdk.dependencies.get("test-org", "npm", "lodash", "4.17.21")
75
+ result = self.sdk.dependencies.get("test-org", "npm", "lodash", "4.18.1")
76
76
 
77
77
  self.assertEqual(result, expected_data)
78
78
  call_args = self.mock_requests.request.call_args
79
79
  self.assertEqual(call_args[0][0], "GET")
80
- self.assertIn("/orgs/test-org/dependencies/npm/lodash/4.17.21", call_args[0][1])
80
+ self.assertIn("/orgs/test-org/dependencies/npm/lodash/4.18.1", call_args[0][1])
81
81
 
82
82
  # DiffScans endpoints
83
83
  def test_diffscans_list_unit(self):
@@ -305,24 +305,24 @@ class TestAllEndpointsUnit(unittest.TestCase):
305
305
  expected_data = [{"type": "security", "severity": "high", "title": "Test issue"}]
306
306
  self._mock_response(expected_data)
307
307
 
308
- result = self.sdk.npm.issues("lodash", "4.17.21")
308
+ result = self.sdk.npm.issues("lodash", "4.18.1")
309
309
 
310
310
  self.assertEqual(result, expected_data)
311
311
  call_args = self.mock_requests.request.call_args
312
312
  self.assertEqual(call_args[0][0], "GET")
313
- self.assertIn("/npm/lodash/4.17.21/issues", call_args[0][1])
313
+ self.assertIn("/npm/lodash/4.18.1/issues", call_args[0][1])
314
314
 
315
315
  def test_npm_score_unit(self):
316
316
  """Test npm score endpoint."""
317
317
  expected_data = [{"category": "security", "value": 85}]
318
318
  self._mock_response(expected_data)
319
319
 
320
- result = self.sdk.npm.score("lodash", "4.17.21")
320
+ result = self.sdk.npm.score("lodash", "4.18.1")
321
321
 
322
322
  self.assertEqual(result, expected_data)
323
323
  call_args = self.mock_requests.request.call_args
324
324
  self.assertEqual(call_args[0][0], "GET")
325
- self.assertIn("/npm/lodash/4.17.21/score", call_args[0][1])
325
+ self.assertIn("/npm/lodash/4.18.1/score", call_args[0][1])
326
326
 
327
327
  # OpenAPI endpoints
328
328
  def test_openapi_get_unit(self):
@@ -352,14 +352,14 @@ class TestAllEndpointsUnit(unittest.TestCase):
352
352
 
353
353
  # PURL endpoints
354
354
  def test_purl_post_unit(self):
355
- """Test PURL validation endpoint."""
355
+ """Test org-scoped PURL validation endpoint."""
356
356
  # Expected final result after deduplication - should match what the dedupe function produces
357
357
  expected_data = [{
358
- "inputPurl": "pkg:npm/lodash@4.17.21",
359
- "purl": "pkg:npm/lodash@4.17.21",
358
+ "inputPurl": "pkg:npm/lodash@4.18.1",
359
+ "purl": "pkg:npm/lodash@4.18.1",
360
360
  "type": "npm",
361
361
  "name": "lodash",
362
- "version": "4.17.21",
362
+ "version": "4.18.1",
363
363
  "valid": True,
364
364
  "alerts": [],
365
365
  "releases": ["npm"]
@@ -367,7 +367,7 @@ class TestAllEndpointsUnit(unittest.TestCase):
367
367
 
368
368
  # Mock the NDJSON response that would come from the actual API
369
369
  # This simulates what the API returns: newline-delimited JSON with SocketArtifact objects
370
- mock_ndjson_response = '{"inputPurl": "pkg:npm/lodash@4.17.21", "purl": "pkg:npm/lodash@4.17.21", "type": "npm", "name": "lodash", "version": "4.17.21", "valid": true, "alerts": []}'
370
+ mock_ndjson_response = '{"inputPurl": "pkg:npm/lodash@4.18.1", "purl": "pkg:npm/lodash@4.18.1", "type": "npm", "name": "lodash", "version": "4.18.1", "valid": true, "alerts": []}'
371
371
 
372
372
  # Mock the response with NDJSON format
373
373
  mock_response = Mock()
@@ -376,13 +376,30 @@ class TestAllEndpointsUnit(unittest.TestCase):
376
376
  mock_response.text = mock_ndjson_response
377
377
  self.mock_requests.request.return_value = mock_response
378
378
 
379
- components = [{"purl": "pkg:npm/lodash@4.17.21"}]
380
- result = self.sdk.purl.post("false", components)
379
+ components = [{"purl": "pkg:npm/lodash@4.18.1"}]
380
+ result = self.sdk.purl.post("false", components, org_slug="test-org")
381
381
 
382
382
  self.assertEqual(result, expected_data)
383
+ call_args = self.mock_requests.request.call_args
384
+ self.assertEqual(call_args[0][0], "POST")
385
+ self.assertIn("/orgs/test-org/purl", call_args[0][1])
386
+
387
+ def test_purl_post_unit_legacy_path(self):
388
+ """Test legacy PURL validation endpoint remains available for compatibility."""
389
+ mock_ndjson_response = '{"inputPurl": "pkg:npm/lodash@4.18.1", "purl": "pkg:npm/lodash@4.18.1", "type": "npm", "name": "lodash", "version": "4.18.1", "valid": true, "alerts": []}'
390
+
391
+ mock_response = Mock()
392
+ mock_response.status_code = 200
393
+ mock_response.headers = {'content-type': 'application/x-ndjson'}
394
+ mock_response.text = mock_ndjson_response
395
+ self.mock_requests.request.return_value = mock_response
396
+
397
+ self.sdk.purl.post("false", [{"purl": "pkg:npm/lodash@4.18.1"}])
398
+
383
399
  call_args = self.mock_requests.request.call_args
384
400
  self.assertEqual(call_args[0][0], "POST")
385
401
  self.assertIn("/purl", call_args[0][1])
402
+ self.assertNotIn("/orgs/", call_args[0][1])
386
403
 
387
404
  # Quota endpoints
388
405
  def test_quota_get_unit(self):
@@ -110,13 +110,13 @@ class TestSocketSDKUnit(unittest.TestCase):
110
110
  type=SocketPURL_Type.NPM,
111
111
  name="lodash",
112
112
  namespace=None,
113
- release="4.17.21"
113
+ release="4.18.1"
114
114
  )
115
115
 
116
116
  self.assertEqual(purl.type, SocketPURL_Type.NPM)
117
117
  self.assertEqual(purl.name, "lodash")
118
118
  self.assertIsNone(purl.namespace)
119
- self.assertEqual(purl.release, "4.17.21")
119
+ self.assertEqual(purl.release, "4.18.1")
120
120
 
121
121
  def test_integration_types(self):
122
122
  """Test that all integration types are available."""
@@ -223,7 +223,7 @@ class TestSocketSDKFileHandling(unittest.TestCase):
223
223
  "name": "test-package",
224
224
  "version": "1.0.0",
225
225
  "dependencies": {
226
- "lodash": "4.17.21"
226
+ "lodash": "4.18.1"
227
227
  }
228
228
  }
229
229
 
@@ -50,24 +50,24 @@ class TestWorkingEndpointsUnit(unittest.TestCase):
50
50
  expected_data = [{"type": "security", "severity": "high"}]
51
51
  self._mock_response(expected_data)
52
52
 
53
- result = self.sdk.npm.issues("lodash", "4.17.21")
53
+ result = self.sdk.npm.issues("lodash", "4.18.1")
54
54
 
55
55
  self.assertEqual(result, expected_data)
56
56
  call_args = self.mock_requests.request.call_args
57
57
  self.assertEqual(call_args[0][0], "GET")
58
- self.assertIn("/npm/lodash/4.17.21/issues", call_args[0][1])
58
+ self.assertIn("/npm/lodash/4.18.1/issues", call_args[0][1])
59
59
 
60
60
  def test_npm_score_unit(self):
61
61
  """Test NPM score endpoint - WORKING."""
62
62
  expected_data = [{"category": "security", "value": 85}]
63
63
  self._mock_response(expected_data)
64
64
 
65
- result = self.sdk.npm.score("lodash", "4.17.21")
65
+ result = self.sdk.npm.score("lodash", "4.18.1")
66
66
 
67
67
  self.assertEqual(result, expected_data)
68
68
  call_args = self.mock_requests.request.call_args
69
69
  self.assertEqual(call_args[0][0], "GET")
70
- self.assertIn("/npm/lodash/4.17.21/score", call_args[0][1])
70
+ self.assertIn("/npm/lodash/4.18.1/score", call_args[0][1])
71
71
 
72
72
  def test_openapi_get_unit(self):
73
73
  """Test OpenAPI specification retrieval - WORKING."""
@@ -1343,7 +1343,7 @@ wheels = [
1343
1343
 
1344
1344
  [[package]]
1345
1345
  name = "socketdev"
1346
- version = "3.0.29"
1346
+ version = "3.1.0"
1347
1347
  source = { editable = "." }
1348
1348
  dependencies = [
1349
1349
  { name = "requests" },
@@ -1 +0,0 @@
1
- __version__ = "3.0.33"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes