socketsecurity 1.0.24__tar.gz → 1.0.26__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-1.0.24/socketsecurity.egg-info → socketsecurity-1.0.26}/PKG-INFO +1 -1
- {socketsecurity-1.0.24 → socketsecurity-1.0.26}/socketsecurity/__init__.py +1 -1
- {socketsecurity-1.0.24 → socketsecurity-1.0.26}/socketsecurity/core/__init__.py +7 -8
- {socketsecurity-1.0.24 → socketsecurity-1.0.26}/socketsecurity/socketcli.py +24 -20
- {socketsecurity-1.0.24 → socketsecurity-1.0.26/socketsecurity.egg-info}/PKG-INFO +1 -1
- {socketsecurity-1.0.24 → socketsecurity-1.0.26}/LICENSE +0 -0
- {socketsecurity-1.0.24 → socketsecurity-1.0.26}/README.md +0 -0
- {socketsecurity-1.0.24 → socketsecurity-1.0.26}/pyproject.toml +0 -0
- {socketsecurity-1.0.24 → socketsecurity-1.0.26}/setup.cfg +0 -0
- {socketsecurity-1.0.24 → socketsecurity-1.0.26}/socketsecurity/core/classes.py +0 -0
- {socketsecurity-1.0.24 → socketsecurity-1.0.26}/socketsecurity/core/exceptions.py +0 -0
- {socketsecurity-1.0.24 → socketsecurity-1.0.26}/socketsecurity/core/git_interface.py +0 -0
- {socketsecurity-1.0.24 → socketsecurity-1.0.26}/socketsecurity/core/github.py +0 -0
- {socketsecurity-1.0.24 → socketsecurity-1.0.26}/socketsecurity/core/gitlab.py +0 -0
- {socketsecurity-1.0.24 → socketsecurity-1.0.26}/socketsecurity/core/issues.py +0 -0
- {socketsecurity-1.0.24 → socketsecurity-1.0.26}/socketsecurity/core/licenses.py +0 -0
- {socketsecurity-1.0.24 → socketsecurity-1.0.26}/socketsecurity/core/messages.py +0 -0
- {socketsecurity-1.0.24 → socketsecurity-1.0.26}/socketsecurity/core/scm_comments.py +0 -0
- {socketsecurity-1.0.24 → socketsecurity-1.0.26}/socketsecurity.egg-info/SOURCES.txt +0 -0
- {socketsecurity-1.0.24 → socketsecurity-1.0.26}/socketsecurity.egg-info/dependency_links.txt +0 -0
- {socketsecurity-1.0.24 → socketsecurity-1.0.26}/socketsecurity.egg-info/entry_points.txt +0 -0
- {socketsecurity-1.0.24 → socketsecurity-1.0.26}/socketsecurity.egg-info/requires.txt +0 -0
- {socketsecurity-1.0.24 → socketsecurity-1.0.26}/socketsecurity.egg-info/top_level.txt +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
__author__ = 'socket.dev'
|
|
2
|
-
__version__ = '1.0.
|
|
2
|
+
__version__ = '1.0.26'
|
|
@@ -163,9 +163,9 @@ def do_request(
|
|
|
163
163
|
'User-Agent': f'SocketPythonCLI/{__version__}',
|
|
164
164
|
"accept": "application/json"
|
|
165
165
|
}
|
|
166
|
-
verify =
|
|
166
|
+
verify = True
|
|
167
167
|
if allow_unverified_ssl:
|
|
168
|
-
verify =
|
|
168
|
+
verify = False
|
|
169
169
|
response = requests.request(
|
|
170
170
|
method.upper(),
|
|
171
171
|
url,
|
|
@@ -410,12 +410,11 @@ class Core:
|
|
|
410
410
|
Globs the path for supported manifest files.
|
|
411
411
|
Note: Might move the source to a JSON file
|
|
412
412
|
:param path: Str - path to where the manifest files are located
|
|
413
|
-
:param files: override finding the manifest files using the glob matcher
|
|
414
413
|
:return:
|
|
415
414
|
"""
|
|
416
415
|
log.debug("Starting Find Files")
|
|
417
416
|
start_time = time.time()
|
|
418
|
-
files =
|
|
417
|
+
files = set()
|
|
419
418
|
for ecosystem in socket_globs:
|
|
420
419
|
patterns = socket_globs[ecosystem]
|
|
421
420
|
for file_name in patterns:
|
|
@@ -427,7 +426,7 @@ class Core:
|
|
|
427
426
|
glob_files = glob(file_path, recursive=True)
|
|
428
427
|
for glob_file in glob_files:
|
|
429
428
|
if glob_file not in files:
|
|
430
|
-
files.
|
|
429
|
+
files.add(glob_file)
|
|
431
430
|
glob_end = time.time()
|
|
432
431
|
glob_total_time = glob_end - glob_start
|
|
433
432
|
log.debug(f"Glob for pattern {file_path} took {glob_total_time:.2f} seconds")
|
|
@@ -436,7 +435,7 @@ class Core:
|
|
|
436
435
|
end_time = time.time()
|
|
437
436
|
total_time = end_time - start_time
|
|
438
437
|
log.info(f"Found {len(files)} in {total_time:.2f} seconds")
|
|
439
|
-
return files
|
|
438
|
+
return list(files)
|
|
440
439
|
|
|
441
440
|
@staticmethod
|
|
442
441
|
def create_full_scan(files: list, params: FullScanParams, workspace: str) -> FullScan:
|
|
@@ -594,13 +593,13 @@ class Core:
|
|
|
594
593
|
head_packages = Core.create_sbom_dict(head_scan)
|
|
595
594
|
new_scan_alerts = {}
|
|
596
595
|
head_scan_alerts = {}
|
|
597
|
-
consolidated =
|
|
596
|
+
consolidated = set()
|
|
598
597
|
for package_id in new_packages:
|
|
599
598
|
purl, package = Core.create_purl(package_id, new_packages)
|
|
600
599
|
base_purl = f"{purl.ecosystem}/{purl.name}@{purl.version}"
|
|
601
600
|
if package_id not in head_packages and package.direct and base_purl not in consolidated:
|
|
602
601
|
diff.new_packages.append(purl)
|
|
603
|
-
consolidated.
|
|
602
|
+
consolidated.add(base_purl)
|
|
604
603
|
new_scan_alerts = Core.create_issue_alerts(package, new_scan_alerts, new_packages)
|
|
605
604
|
for package_id in head_packages:
|
|
606
605
|
purl, package = Core.create_purl(package_id, head_packages)
|
|
@@ -163,25 +163,27 @@ parser.add_argument(
|
|
|
163
163
|
|
|
164
164
|
|
|
165
165
|
def output_console_comments(diff_report: Diff, sbom_file_name: str = None) -> None:
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
166
|
+
if diff_report.id != "NO_DIFF_RAN":
|
|
167
|
+
console_security_comment = Messages.create_console_security_alert_table(diff_report)
|
|
168
|
+
save_sbom_file(diff_report, sbom_file_name)
|
|
169
|
+
log.info(f"Socket Full Scan ID: {diff_report.id}")
|
|
170
|
+
if not report_pass(diff_report):
|
|
171
|
+
log.info("Security issues detected by Socket Security")
|
|
172
|
+
msg = f"\n{console_security_comment}"
|
|
173
|
+
log.info(msg)
|
|
174
|
+
if not blocking_disabled:
|
|
175
|
+
sys.exit(1)
|
|
176
|
+
else:
|
|
177
|
+
log.info("No New Security issues detected by Socket Security")
|
|
177
178
|
|
|
178
179
|
|
|
179
180
|
def output_console_json(diff_report: Diff, sbom_file_name: str = None) -> None:
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
181
|
+
if diff_report.id != "NO_DIFF_RAN":
|
|
182
|
+
console_security_comment = Messages.create_security_comment_json(diff_report)
|
|
183
|
+
save_sbom_file(diff_report, sbom_file_name)
|
|
184
|
+
print(json.dumps(console_security_comment))
|
|
185
|
+
if not report_pass(diff_report) and not blocking_disabled:
|
|
186
|
+
sys.exit(1)
|
|
185
187
|
|
|
186
188
|
|
|
187
189
|
def report_pass(diff_report: Diff) -> bool:
|
|
@@ -299,7 +301,7 @@ def main_code():
|
|
|
299
301
|
default_branch = scm.is_default_branch
|
|
300
302
|
|
|
301
303
|
base_api_url = os.getenv("BASE_API_URL") or None
|
|
302
|
-
core = Core(token=api_token, request_timeout=1200, base_api_url=base_api_url)
|
|
304
|
+
core = Core(token=api_token, request_timeout=1200, base_api_url=base_api_url, allow_unverified=allow_unverified)
|
|
303
305
|
no_change = True
|
|
304
306
|
if ignore_commit_files:
|
|
305
307
|
no_change = False
|
|
@@ -319,7 +321,8 @@ def main_code():
|
|
|
319
321
|
make_default_branch=default_branch,
|
|
320
322
|
set_as_pending_head=set_as_pending_head
|
|
321
323
|
)
|
|
322
|
-
diff =
|
|
324
|
+
diff = Diff()
|
|
325
|
+
diff.id = "NO_DIFF_RAN"
|
|
323
326
|
if scm is not None and scm.check_event_type() == "comment":
|
|
324
327
|
log.info("Comment initiated flow")
|
|
325
328
|
log.debug(f"Getting comments for Repo {scm.repository} for PR {scm.pr_number}")
|
|
@@ -329,10 +332,11 @@ def main_code():
|
|
|
329
332
|
elif scm is not None and scm.check_event_type() != "comment":
|
|
330
333
|
log.info("Push initiated flow")
|
|
331
334
|
diff: Diff
|
|
332
|
-
diff = core.create_new_diff(target_path, params, workspace=target_path, no_change=no_change)
|
|
333
335
|
if no_change:
|
|
334
|
-
log.info("No
|
|
336
|
+
log.info("No manifest files changes, skipping scan")
|
|
337
|
+
# log.info("No dependency changes")
|
|
335
338
|
elif scm.check_event_type() == "diff":
|
|
339
|
+
diff = core.create_new_diff(target_path, params, workspace=target_path, no_change=no_change)
|
|
336
340
|
log.info("Starting comment logic for PR/MR event")
|
|
337
341
|
log.debug(f"Getting comments for Repo {scm.repository} for PR {scm.pr_number}")
|
|
338
342
|
comments = scm.get_comments_for_pr(repo, str(pr_number))
|
|
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
|
|
File without changes
|
|
File without changes
|
{socketsecurity-1.0.24 → socketsecurity-1.0.26}/socketsecurity.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|