socketsecurity 0.0.70__tar.gz → 0.0.71__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.70/socketsecurity.egg-info → socketsecurity-0.0.71}/PKG-INFO +1 -1
- {socketsecurity-0.0.70 → socketsecurity-0.0.71}/pyproject.toml +1 -1
- {socketsecurity-0.0.70 → socketsecurity-0.0.71}/socketsecurity/core/__init__.py +52 -3
- {socketsecurity-0.0.70 → socketsecurity-0.0.71}/socketsecurity/socketcli.py +20 -1
- {socketsecurity-0.0.70 → socketsecurity-0.0.71/socketsecurity.egg-info}/PKG-INFO +1 -1
- {socketsecurity-0.0.70 → socketsecurity-0.0.71}/LICENSE +0 -0
- {socketsecurity-0.0.70 → socketsecurity-0.0.71}/README.md +0 -0
- {socketsecurity-0.0.70 → socketsecurity-0.0.71}/setup.cfg +0 -0
- {socketsecurity-0.0.70 → socketsecurity-0.0.71}/socketsecurity/__init__.py +0 -0
- {socketsecurity-0.0.70 → socketsecurity-0.0.71}/socketsecurity/core/classes.py +0 -0
- {socketsecurity-0.0.70 → socketsecurity-0.0.71}/socketsecurity/core/exceptions.py +0 -0
- {socketsecurity-0.0.70 → socketsecurity-0.0.71}/socketsecurity/core/github.py +0 -0
- {socketsecurity-0.0.70 → socketsecurity-0.0.71}/socketsecurity/core/gitlab.py +0 -0
- {socketsecurity-0.0.70 → socketsecurity-0.0.71}/socketsecurity/core/issues.py +0 -0
- {socketsecurity-0.0.70 → socketsecurity-0.0.71}/socketsecurity/core/licenses.py +0 -0
- {socketsecurity-0.0.70 → socketsecurity-0.0.71}/socketsecurity/core/messages.py +0 -0
- {socketsecurity-0.0.70 → socketsecurity-0.0.71}/socketsecurity.egg-info/SOURCES.txt +0 -0
- {socketsecurity-0.0.70 → socketsecurity-0.0.71}/socketsecurity.egg-info/dependency_links.txt +0 -0
- {socketsecurity-0.0.70 → socketsecurity-0.0.71}/socketsecurity.egg-info/entry_points.txt +0 -0
- {socketsecurity-0.0.70 → socketsecurity-0.0.71}/socketsecurity.egg-info/requires.txt +0 -0
- {socketsecurity-0.0.70 → socketsecurity-0.0.71}/socketsecurity.egg-info/top_level.txt +0 -0
|
@@ -25,7 +25,7 @@ import time
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
__author__ = 'socket.dev'
|
|
28
|
-
__version__ = '0.0.
|
|
28
|
+
__version__ = '0.0.71'
|
|
29
29
|
__all__ = [
|
|
30
30
|
"Core",
|
|
31
31
|
"log",
|
|
@@ -246,6 +246,55 @@ class Core:
|
|
|
246
246
|
}
|
|
247
247
|
return org_rules
|
|
248
248
|
|
|
249
|
+
# @staticmethod
|
|
250
|
+
# def get_supported_file_types() -> dict:
|
|
251
|
+
# path = "report/supported"
|
|
252
|
+
|
|
253
|
+
@staticmethod
|
|
254
|
+
def get_manifest_files(package: Package, packages: dict) -> str:
|
|
255
|
+
if package.direct:
|
|
256
|
+
manifests = []
|
|
257
|
+
for manifest_item in package.manifestFiles:
|
|
258
|
+
manifest = manifest_item["file"]
|
|
259
|
+
manifests.append(manifest)
|
|
260
|
+
manifest_files = ";".join(manifests)
|
|
261
|
+
else:
|
|
262
|
+
manifests = []
|
|
263
|
+
for top_id in package.topLevelAncestors:
|
|
264
|
+
top_package: Package
|
|
265
|
+
top_package = packages[top_id]
|
|
266
|
+
for manifest_item in top_package.manifestFiles:
|
|
267
|
+
manifest = manifest_item["file"]
|
|
268
|
+
new_string = f"{package.name}@{package.version}({manifest})"
|
|
269
|
+
manifests.append(new_string)
|
|
270
|
+
manifest_files = ";".join(manifests)
|
|
271
|
+
return manifest_files
|
|
272
|
+
|
|
273
|
+
@staticmethod
|
|
274
|
+
def create_sbom_output(diff: Diff) -> list:
|
|
275
|
+
sbom = []
|
|
276
|
+
for package_id in diff.packages:
|
|
277
|
+
package: Package
|
|
278
|
+
package = diff.packages[package_id]
|
|
279
|
+
manifest_files = Core.get_manifest_files(package, diff.packages)
|
|
280
|
+
item = {
|
|
281
|
+
"id": package.id,
|
|
282
|
+
"license": package.license,
|
|
283
|
+
"license_text": package.license_text,
|
|
284
|
+
"manifestFiles": manifest_files,
|
|
285
|
+
"score": package.score,
|
|
286
|
+
"size": package.size,
|
|
287
|
+
"ecosystem": package.type,
|
|
288
|
+
"alerts": package.alerts,
|
|
289
|
+
"direct": package.direct,
|
|
290
|
+
"name": package.name,
|
|
291
|
+
"version": package.version,
|
|
292
|
+
"author": package.author,
|
|
293
|
+
"url": package.url
|
|
294
|
+
}
|
|
295
|
+
sbom.append(item)
|
|
296
|
+
return sbom
|
|
297
|
+
|
|
249
298
|
@staticmethod
|
|
250
299
|
def find_files(path: str) -> list:
|
|
251
300
|
"""
|
|
@@ -314,8 +363,8 @@ class Core:
|
|
|
314
363
|
"requirements.frozen": {
|
|
315
364
|
"pattern": "requirements.frozen"
|
|
316
365
|
},
|
|
317
|
-
"setup.py
|
|
318
|
-
"pattern": "setup.py
|
|
366
|
+
"setup.py": {
|
|
367
|
+
"pattern": "setup.py"
|
|
319
368
|
}
|
|
320
369
|
},
|
|
321
370
|
"golang": {
|
|
@@ -69,6 +69,20 @@ parser.add_argument(
|
|
|
69
69
|
required=False
|
|
70
70
|
)
|
|
71
71
|
|
|
72
|
+
parser.add_argument(
|
|
73
|
+
'--sbom-file',
|
|
74
|
+
default=None,
|
|
75
|
+
help='If soecified save the SBOM details to the specified file',
|
|
76
|
+
required=False
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
parser.add_argument(
|
|
80
|
+
'--commit-sha',
|
|
81
|
+
default="",
|
|
82
|
+
help='Optional git commit sha',
|
|
83
|
+
required=False
|
|
84
|
+
)
|
|
85
|
+
|
|
72
86
|
parser.add_argument(
|
|
73
87
|
'--generate-license',
|
|
74
88
|
default=False,
|
|
@@ -115,6 +129,8 @@ def cli():
|
|
|
115
129
|
pr_number = arguments.pr_number
|
|
116
130
|
target_path = arguments.target_path
|
|
117
131
|
scm_type = arguments.scm
|
|
132
|
+
commit_sha = arguments.commit_sha
|
|
133
|
+
sbom_file = arguments.sbom_file
|
|
118
134
|
license_mode = arguments.generate_license
|
|
119
135
|
license_file = f"{repo}"
|
|
120
136
|
if branch is not None:
|
|
@@ -137,6 +153,7 @@ def cli():
|
|
|
137
153
|
scm = Gitlab()
|
|
138
154
|
if scm is not None:
|
|
139
155
|
default_branch = scm.is_default_branch
|
|
156
|
+
|
|
140
157
|
base_api_url = os.getenv("BASE_API_URL") or None
|
|
141
158
|
core = Core(token=api_token, request_timeout=6000, base_api_url=base_api_url)
|
|
142
159
|
set_as_pending_head = False
|
|
@@ -146,7 +163,7 @@ def cli():
|
|
|
146
163
|
repo=repo,
|
|
147
164
|
branch=branch,
|
|
148
165
|
commit_message=commit_message,
|
|
149
|
-
commit_hash=
|
|
166
|
+
commit_hash=commit_sha,
|
|
150
167
|
pull_request=pr_number,
|
|
151
168
|
committers=committer,
|
|
152
169
|
make_default_branch=default_branch,
|
|
@@ -202,6 +219,8 @@ def cli():
|
|
|
202
219
|
}
|
|
203
220
|
all_packages[package_id] = output
|
|
204
221
|
core.save_file(license_file, json.dumps(all_packages))
|
|
222
|
+
if diff is not None and sbom_file is not None:
|
|
223
|
+
core.save_file(sbom_file, json.dumps(core.create_sbom_output(diff)))
|
|
205
224
|
|
|
206
225
|
|
|
207
226
|
if __name__ == '__main__':
|
|
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
|
|
File without changes
|
|
File without changes
|
{socketsecurity-0.0.70 → socketsecurity-0.0.71}/socketsecurity.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|