socketsecurity 1.0.6__tar.gz → 1.0.8__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.6/socketsecurity.egg-info → socketsecurity-1.0.8}/PKG-INFO +1 -1
- {socketsecurity-1.0.6 → socketsecurity-1.0.8}/socketsecurity/__init__.py +1 -1
- {socketsecurity-1.0.6 → socketsecurity-1.0.8}/socketsecurity/core/__init__.py +46 -37
- {socketsecurity-1.0.6 → socketsecurity-1.0.8}/socketsecurity/core/messages.py +2 -1
- {socketsecurity-1.0.6 → socketsecurity-1.0.8}/socketsecurity/socketcli.py +1 -0
- {socketsecurity-1.0.6 → socketsecurity-1.0.8/socketsecurity.egg-info}/PKG-INFO +1 -1
- {socketsecurity-1.0.6 → socketsecurity-1.0.8}/LICENSE +0 -0
- {socketsecurity-1.0.6 → socketsecurity-1.0.8}/README.md +0 -0
- {socketsecurity-1.0.6 → socketsecurity-1.0.8}/pyproject.toml +0 -0
- {socketsecurity-1.0.6 → socketsecurity-1.0.8}/setup.cfg +0 -0
- {socketsecurity-1.0.6 → socketsecurity-1.0.8}/socketsecurity/core/classes.py +0 -0
- {socketsecurity-1.0.6 → socketsecurity-1.0.8}/socketsecurity/core/exceptions.py +0 -0
- {socketsecurity-1.0.6 → socketsecurity-1.0.8}/socketsecurity/core/git_interface.py +0 -0
- {socketsecurity-1.0.6 → socketsecurity-1.0.8}/socketsecurity/core/github.py +0 -0
- {socketsecurity-1.0.6 → socketsecurity-1.0.8}/socketsecurity/core/gitlab.py +0 -0
- {socketsecurity-1.0.6 → socketsecurity-1.0.8}/socketsecurity/core/issues.py +0 -0
- {socketsecurity-1.0.6 → socketsecurity-1.0.8}/socketsecurity/core/licenses.py +0 -0
- {socketsecurity-1.0.6 → socketsecurity-1.0.8}/socketsecurity/core/scm_comments.py +0 -0
- {socketsecurity-1.0.6 → socketsecurity-1.0.8}/socketsecurity.egg-info/SOURCES.txt +0 -0
- {socketsecurity-1.0.6 → socketsecurity-1.0.8}/socketsecurity.egg-info/dependency_links.txt +0 -0
- {socketsecurity-1.0.6 → socketsecurity-1.0.8}/socketsecurity.egg-info/entry_points.txt +0 -0
- {socketsecurity-1.0.6 → socketsecurity-1.0.8}/socketsecurity.egg-info/requires.txt +0 -0
- {socketsecurity-1.0.6 → socketsecurity-1.0.8}/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.8'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from pathlib import PurePath
|
|
3
|
-
|
|
3
|
+
from semver.version import Version
|
|
4
4
|
import requests
|
|
5
5
|
from urllib.parse import urlencode
|
|
6
6
|
import base64
|
|
@@ -512,7 +512,9 @@ class Core:
|
|
|
512
512
|
:return:
|
|
513
513
|
"""
|
|
514
514
|
if no_change:
|
|
515
|
-
|
|
515
|
+
diff = Diff()
|
|
516
|
+
diff.id = "no_diff_ran"
|
|
517
|
+
return diff
|
|
516
518
|
files = Core.find_files(path, new_files)
|
|
517
519
|
if files is None or len(files) == 0:
|
|
518
520
|
return Diff()
|
|
@@ -555,20 +557,25 @@ class Core:
|
|
|
555
557
|
new_scan_alerts = {}
|
|
556
558
|
head_scan_alerts = {}
|
|
557
559
|
consolidated = []
|
|
560
|
+
previous_versions = []
|
|
561
|
+
previous_capabilities = {}
|
|
558
562
|
for package_id in new_packages:
|
|
559
563
|
purl, package = Core.create_purl(package_id, new_packages)
|
|
560
|
-
|
|
564
|
+
base_name = f"{purl.ecosystem}/{purl.name}"
|
|
565
|
+
base_purl = f"{base_name}@{purl.version}"
|
|
561
566
|
if package_id not in head_packages and package.direct and base_purl not in consolidated:
|
|
562
567
|
diff.new_packages.append(purl)
|
|
563
568
|
consolidated.append(base_purl)
|
|
569
|
+
previous_versions.append(base_name)
|
|
564
570
|
new_scan_alerts = Core.create_issue_alerts(package, new_scan_alerts, new_packages)
|
|
565
571
|
for package_id in head_packages:
|
|
566
572
|
purl, package = Core.create_purl(package_id, head_packages)
|
|
567
|
-
|
|
573
|
+
base_name = f"{purl.ecosystem}/{purl.name}"
|
|
574
|
+
if package_id not in new_packages and package.direct and base_name not in previous_versions:
|
|
568
575
|
diff.removed_packages.append(purl)
|
|
569
576
|
head_scan_alerts = Core.create_issue_alerts(package, head_scan_alerts, head_packages)
|
|
570
577
|
diff.new_alerts = Core.compare_issue_alerts(new_scan_alerts, head_scan_alerts, diff.new_alerts)
|
|
571
|
-
diff.new_capabilities = Core.
|
|
578
|
+
diff.new_capabilities = Core.check_alert_capabilities(new_packages, head_packages)
|
|
572
579
|
diff = Core.add_capabilities_to_purl(diff)
|
|
573
580
|
return diff
|
|
574
581
|
|
|
@@ -588,48 +595,50 @@ class Core:
|
|
|
588
595
|
return diff
|
|
589
596
|
|
|
590
597
|
@staticmethod
|
|
591
|
-
def
|
|
598
|
+
def check_alert_capabilities(
|
|
599
|
+
new_packages: dict,
|
|
600
|
+
old_packages: dict
|
|
601
|
+
) -> dict:
|
|
592
602
|
capabilities = {}
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
else:
|
|
603
|
-
capabilities = Core.check_alert_capabilities(package, capabilities, package_id)
|
|
604
|
-
|
|
603
|
+
capabilities_details = {}
|
|
604
|
+
capabilities_details = Core.compare_version_capabilities(old_packages, capabilities_details)
|
|
605
|
+
capabilities_details = Core.compare_version_capabilities(new_packages, capabilities_details)
|
|
606
|
+
for base_name in capabilities_details:
|
|
607
|
+
data = capabilities_details[base_name]
|
|
608
|
+
package_id = data["package_id"]
|
|
609
|
+
package_capabilities = data["capabilities"]
|
|
610
|
+
if len(package_capabilities) > 0:
|
|
611
|
+
capabilities[package_id] = package_capabilities
|
|
605
612
|
return capabilities
|
|
606
613
|
|
|
607
614
|
@staticmethod
|
|
608
|
-
def
|
|
609
|
-
package: Package,
|
|
610
|
-
capabilities: dict,
|
|
611
|
-
package_id: str,
|
|
612
|
-
head_package: Package = None
|
|
613
|
-
) -> dict:
|
|
615
|
+
def compare_version_capabilities(packages: dict, capabilities_details: dict) -> dict:
|
|
614
616
|
alert_types = {
|
|
615
617
|
"envVars": "Environment",
|
|
616
618
|
"networkAccess": "Network",
|
|
617
619
|
"filesystemAccess": "File System",
|
|
618
620
|
"shellAccess": "Shell"
|
|
619
621
|
}
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
capabilities
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
622
|
+
for package_id in packages:
|
|
623
|
+
package: Package
|
|
624
|
+
package = packages[package_id]
|
|
625
|
+
base_name = f"{package.type}/{package.name}"
|
|
626
|
+
if base_name not in capabilities_details:
|
|
627
|
+
capabilities_details[base_name] = {
|
|
628
|
+
"last_version": package.version,
|
|
629
|
+
"package_id": package.id,
|
|
630
|
+
"capabilities": []
|
|
631
|
+
}
|
|
632
|
+
new_version = Version.parse(package.version)
|
|
633
|
+
last_version = Version.parse(capabilities_details[base_name]["last_version"])
|
|
634
|
+
previous_capabilities = capabilities_details[base_name]["capabilities"]
|
|
635
|
+
if new_version > last_version:
|
|
636
|
+
capabilities_details[base_name]["last_version"] = package.version
|
|
637
|
+
for alert in package.alerts:
|
|
638
|
+
value = alert_types[alert["type"]]
|
|
639
|
+
if value not in previous_capabilities or len(previous_capabilities) == 0:
|
|
640
|
+
capabilities_details[base_name]["capabilities"].append(value)
|
|
641
|
+
return capabilities_details
|
|
633
642
|
|
|
634
643
|
@staticmethod
|
|
635
644
|
def compare_issue_alerts(new_scan_alerts: dict, head_scan_alerts: dict, alerts: list) -> list:
|
|
@@ -154,6 +154,7 @@ parser.add_argument(
|
|
|
154
154
|
def output_console_comments(diff_report: Diff, sbom_file_name: str = None) -> None:
|
|
155
155
|
console_security_comment = Messages.create_console_security_alert_table(diff_report)
|
|
156
156
|
save_sbom_file(diff_report, sbom_file_name)
|
|
157
|
+
log.info(f"Socket Full Scan ID: {diff_report.id}")
|
|
157
158
|
if not report_pass(diff_report):
|
|
158
159
|
log.info("Security issues detected by Socket Security")
|
|
159
160
|
msg = f"\n{console_security_comment}"
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|