socketsecurity 0.0.77__tar.gz → 0.0.78__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.
- {socketsecurity-0.0.77/socketsecurity.egg-info → socketsecurity-0.0.78}/PKG-INFO +1 -1
- {socketsecurity-0.0.77 → socketsecurity-0.0.78}/pyproject.toml +5 -2
- socketsecurity-0.0.78/socketsecurity/__init__.py +2 -0
- {socketsecurity-0.0.77 → socketsecurity-0.0.78}/socketsecurity/core/__init__.py +19 -5
- {socketsecurity-0.0.77 → socketsecurity-0.0.78}/socketsecurity/core/classes.py +23 -3
- {socketsecurity-0.0.77 → socketsecurity-0.0.78}/socketsecurity/core/messages.py +11 -27
- {socketsecurity-0.0.77 → socketsecurity-0.0.78/socketsecurity.egg-info}/PKG-INFO +1 -1
- socketsecurity-0.0.77/socketsecurity/__init__.py +0 -4
- {socketsecurity-0.0.77 → socketsecurity-0.0.78}/LICENSE +0 -0
- {socketsecurity-0.0.77 → socketsecurity-0.0.78}/README.md +0 -0
- {socketsecurity-0.0.77 → socketsecurity-0.0.78}/setup.cfg +0 -0
- {socketsecurity-0.0.77 → socketsecurity-0.0.78}/socketsecurity/core/exceptions.py +0 -0
- {socketsecurity-0.0.77 → socketsecurity-0.0.78}/socketsecurity/core/github.py +0 -0
- {socketsecurity-0.0.77 → socketsecurity-0.0.78}/socketsecurity/core/gitlab.py +0 -0
- {socketsecurity-0.0.77 → socketsecurity-0.0.78}/socketsecurity/core/issues.py +0 -0
- {socketsecurity-0.0.77 → socketsecurity-0.0.78}/socketsecurity/core/licenses.py +0 -0
- {socketsecurity-0.0.77 → socketsecurity-0.0.78}/socketsecurity/socketcli.py +0 -0
- {socketsecurity-0.0.77 → socketsecurity-0.0.78}/socketsecurity.egg-info/SOURCES.txt +0 -0
- {socketsecurity-0.0.77 → socketsecurity-0.0.78}/socketsecurity.egg-info/dependency_links.txt +0 -0
- {socketsecurity-0.0.77 → socketsecurity-0.0.78}/socketsecurity.egg-info/entry_points.txt +0 -0
- {socketsecurity-0.0.77 → socketsecurity-0.0.78}/socketsecurity.egg-info/requires.txt +0 -0
- {socketsecurity-0.0.77 → socketsecurity-0.0.78}/socketsecurity.egg-info/top_level.txt +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "socketsecurity"
|
|
7
|
-
|
|
7
|
+
dynamic = ["version"]
|
|
8
8
|
requires-python = ">= 3.9"
|
|
9
9
|
dependencies = [
|
|
10
10
|
'requests',
|
|
@@ -40,4 +40,7 @@ Homepage = "https://socket.dev"
|
|
|
40
40
|
include = [
|
|
41
41
|
"socketsecurity",
|
|
42
42
|
"socketsecurity.core"
|
|
43
|
-
]
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[tool.setuptools.dynamic]
|
|
46
|
+
version = {attr = "socketsecurity.__version__"}
|
|
@@ -6,6 +6,7 @@ import json
|
|
|
6
6
|
from socketsecurity.core.exceptions import (
|
|
7
7
|
APIFailure, APIKeyMissing, APIAccessDenied, APIInsufficientQuota, APIResourceNotFound, APICloudflareError
|
|
8
8
|
)
|
|
9
|
+
from socketsecurity import __version__
|
|
9
10
|
from socketsecurity.core.licenses import Licenses
|
|
10
11
|
from socketsecurity.core.issues import AllIssues
|
|
11
12
|
from socketsecurity.core.classes import (
|
|
@@ -23,9 +24,6 @@ import platform
|
|
|
23
24
|
from glob import glob
|
|
24
25
|
import time
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
__author__ = 'socket.dev'
|
|
28
|
-
__version__ = '0.0.77'
|
|
29
27
|
__all__ = [
|
|
30
28
|
"Core",
|
|
31
29
|
"log",
|
|
@@ -93,6 +91,18 @@ def do_request(
|
|
|
93
91
|
files=files,
|
|
94
92
|
timeout=timeout
|
|
95
93
|
)
|
|
94
|
+
output_headers = headers
|
|
95
|
+
output_headers['Authorization'] = "Basic API_KEY_REDACTED"
|
|
96
|
+
output = {
|
|
97
|
+
"url": url,
|
|
98
|
+
"headers": output_headers,
|
|
99
|
+
"status_code": response.status_code,
|
|
100
|
+
"body": response.text,
|
|
101
|
+
"payload": payload,
|
|
102
|
+
"files": files,
|
|
103
|
+
"timeout": timeout
|
|
104
|
+
}
|
|
105
|
+
log.debug(output)
|
|
96
106
|
if response.status_code <= 399:
|
|
97
107
|
return response
|
|
98
108
|
elif response.status_code == 400:
|
|
@@ -672,7 +682,9 @@ class Core:
|
|
|
672
682
|
title=title,
|
|
673
683
|
suggestion=suggestion,
|
|
674
684
|
next_step_title=next_step_title,
|
|
675
|
-
introduced_by=introduced_by
|
|
685
|
+
introduced_by=introduced_by,
|
|
686
|
+
purl=package.purl,
|
|
687
|
+
url=package.url
|
|
676
688
|
)
|
|
677
689
|
if issue_alert.key not in alerts:
|
|
678
690
|
alerts[issue_alert.key] = [issue_alert]
|
|
@@ -732,7 +744,9 @@ class Core:
|
|
|
732
744
|
introduced_by=introduced_by,
|
|
733
745
|
author=package.author or [],
|
|
734
746
|
size=package.size,
|
|
735
|
-
transitives=package.transitives
|
|
747
|
+
transitives=package.transitives,
|
|
748
|
+
url=package.url,
|
|
749
|
+
purl=package.purl
|
|
736
750
|
)
|
|
737
751
|
return purl, package
|
|
738
752
|
|
|
@@ -86,6 +86,7 @@ class Package:
|
|
|
86
86
|
transitives: int
|
|
87
87
|
license: str
|
|
88
88
|
license_text: str
|
|
89
|
+
purl: str
|
|
89
90
|
|
|
90
91
|
def __init__(self, **kwargs):
|
|
91
92
|
if kwargs:
|
|
@@ -122,6 +123,8 @@ class Package:
|
|
|
122
123
|
self.license = "NoLicenseFound"
|
|
123
124
|
if not hasattr(self, "license_text"):
|
|
124
125
|
self.license_text = ""
|
|
126
|
+
self.url = f"https://socket.dev/{self.type}/package/{self.name}/overview/{self.version}"
|
|
127
|
+
self.purl = f"{self.type}/{self.name}@{self.version}"
|
|
125
128
|
|
|
126
129
|
def __str__(self):
|
|
127
130
|
return json.dumps(self.__dict__)
|
|
@@ -159,8 +162,6 @@ class Issue:
|
|
|
159
162
|
self.introduced_by = []
|
|
160
163
|
if not hasattr(self, "manifests"):
|
|
161
164
|
self.manifests = ""
|
|
162
|
-
self.url = f"https://socket.dev/{self.pkg_type}/{self.pkg_name}/overview/{self.pkg_version}"
|
|
163
|
-
self.purl = f"{self.pkg_type}/{self.pkg_name}@{self.pkg_version}"
|
|
164
165
|
|
|
165
166
|
def __str__(self):
|
|
166
167
|
return json.dumps(self.__dict__)
|
|
@@ -324,12 +325,15 @@ class Purl:
|
|
|
324
325
|
version: str
|
|
325
326
|
ecosystem: str
|
|
326
327
|
direct: bool
|
|
327
|
-
author:
|
|
328
|
+
author: list
|
|
328
329
|
size: int
|
|
329
330
|
transitives: int
|
|
330
331
|
introduced_by: list
|
|
331
332
|
capabilities: dict
|
|
332
333
|
is_new: bool
|
|
334
|
+
author_url: str
|
|
335
|
+
url: str
|
|
336
|
+
purl: str
|
|
333
337
|
|
|
334
338
|
def __init__(self, **kwargs):
|
|
335
339
|
if kwargs:
|
|
@@ -341,6 +345,22 @@ class Purl:
|
|
|
341
345
|
self.capabilities = {}
|
|
342
346
|
if not hasattr(self, "is_new"):
|
|
343
347
|
self.is_new = False
|
|
348
|
+
self.author_url = Purl.generate_author_data(self.author, self.ecosystem)
|
|
349
|
+
|
|
350
|
+
@staticmethod
|
|
351
|
+
def generate_author_data(authors: list, ecosystem: str) -> str:
|
|
352
|
+
"""
|
|
353
|
+
Creates the Author links for the package
|
|
354
|
+
:param authors:
|
|
355
|
+
:param ecosystem:
|
|
356
|
+
:return:
|
|
357
|
+
"""
|
|
358
|
+
authors_str = ""
|
|
359
|
+
for author in authors:
|
|
360
|
+
author_url = f"https://socket.dev/{ecosystem}/user/{author}"
|
|
361
|
+
authors += f"[{author}]({author_url}),"
|
|
362
|
+
authors_str = authors_str.rstrip(",")
|
|
363
|
+
return authors_str
|
|
344
364
|
|
|
345
365
|
def __str__(self):
|
|
346
366
|
return json.dumps(self.__dict__)
|
|
@@ -220,17 +220,16 @@ class Messages:
|
|
|
220
220
|
added: Purl
|
|
221
221
|
package_url = Messages.create_purl_link(added)
|
|
222
222
|
capabilities = ", ".join(added.capabilities)
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
count += 1
|
|
223
|
+
row = [
|
|
224
|
+
package_url,
|
|
225
|
+
added.direct,
|
|
226
|
+
capabilities,
|
|
227
|
+
added.transitives,
|
|
228
|
+
f"{added.size} KB",
|
|
229
|
+
added.author_url
|
|
230
|
+
]
|
|
231
|
+
overview_table.extend(row)
|
|
232
|
+
count += 1
|
|
234
233
|
num_of_overview_rows = count + 1
|
|
235
234
|
md.new_table(
|
|
236
235
|
columns=num_of_overview_columns,
|
|
@@ -240,20 +239,6 @@ class Messages:
|
|
|
240
239
|
)
|
|
241
240
|
return md
|
|
242
241
|
|
|
243
|
-
@staticmethod
|
|
244
|
-
def generate_author_data(package: Purl):
|
|
245
|
-
"""
|
|
246
|
-
Creates the Author links for the Dependency Overview Template
|
|
247
|
-
:param package:
|
|
248
|
-
:return:
|
|
249
|
-
"""
|
|
250
|
-
authors = ""
|
|
251
|
-
for author in package.author:
|
|
252
|
-
author_url = f"https://socket.dev/{package.ecosystem}/user/{author}"
|
|
253
|
-
authors += f"[{author}]({author_url}),"
|
|
254
|
-
authors = authors.rstrip(",")
|
|
255
|
-
return authors
|
|
256
|
-
|
|
257
242
|
@staticmethod
|
|
258
243
|
def create_purl_link(details: Purl) -> str:
|
|
259
244
|
"""
|
|
@@ -261,8 +246,7 @@ class Messages:
|
|
|
261
246
|
:param details: Purl - Details about the package needed to create the URLs
|
|
262
247
|
:return:
|
|
263
248
|
"""
|
|
264
|
-
|
|
265
|
-
package_url = f"[{purl}](https://socket.dev/{details.ecosystem}/{details.name}/overview/{details.version})"
|
|
249
|
+
package_url = f"[{details.purl}]({details.url})"
|
|
266
250
|
return package_url
|
|
267
251
|
|
|
268
252
|
@staticmethod
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{socketsecurity-0.0.77 → socketsecurity-0.0.78}/socketsecurity.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|