socketsecurity 0.0.58__tar.gz → 0.0.60__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.58 → socketsecurity-0.0.60}/PKG-INFO +1 -1
- {socketsecurity-0.0.58 → socketsecurity-0.0.60}/pyproject.toml +1 -1
- socketsecurity-0.0.60/socketsecurity/__init__.py +4 -0
- {socketsecurity-0.0.58 → socketsecurity-0.0.60}/socketsecurity/core/__init__.py +1 -1
- {socketsecurity-0.0.58 → socketsecurity-0.0.60}/socketsecurity/core/glitlab.py +2 -2
- {socketsecurity-0.0.58 → socketsecurity-0.0.60}/socketsecurity/core/issues.py +26 -4
- {socketsecurity-0.0.58 → socketsecurity-0.0.60}/socketsecurity/socketcli.py +21 -9
- {socketsecurity-0.0.58 → socketsecurity-0.0.60}/socketsecurity.egg-info/PKG-INFO +1 -1
- socketsecurity-0.0.58/socketsecurity/__init__.py +0 -2
- {socketsecurity-0.0.58 → socketsecurity-0.0.60}/README.md +0 -0
- {socketsecurity-0.0.58 → socketsecurity-0.0.60}/setup.cfg +0 -0
- {socketsecurity-0.0.58 → socketsecurity-0.0.60}/socketsecurity/core/classes.py +0 -0
- {socketsecurity-0.0.58 → socketsecurity-0.0.60}/socketsecurity/core/exceptions.py +0 -0
- {socketsecurity-0.0.58 → socketsecurity-0.0.60}/socketsecurity/core/github.py +0 -0
- {socketsecurity-0.0.58 → socketsecurity-0.0.60}/socketsecurity/core/licenses.py +0 -0
- {socketsecurity-0.0.58 → socketsecurity-0.0.60}/socketsecurity/core/messages.py +0 -0
- {socketsecurity-0.0.58 → socketsecurity-0.0.60}/socketsecurity.egg-info/SOURCES.txt +0 -0
- {socketsecurity-0.0.58 → socketsecurity-0.0.60}/socketsecurity.egg-info/dependency_links.txt +0 -0
- {socketsecurity-0.0.58 → socketsecurity-0.0.60}/socketsecurity.egg-info/entry_points.txt +0 -0
- {socketsecurity-0.0.58 → socketsecurity-0.0.60}/socketsecurity.egg-info/requires.txt +0 -0
- {socketsecurity-0.0.58 → socketsecurity-0.0.60}/socketsecurity.egg-info/top_level.txt +0 -0
|
@@ -124,7 +124,7 @@ class Gitlab:
|
|
|
124
124
|
self.api_url = ci_api_v4_url
|
|
125
125
|
self.ref_type = ""
|
|
126
126
|
self.event_name = ci_pipeline_source
|
|
127
|
-
self.workspace =
|
|
127
|
+
self.workspace = ci_project_dir
|
|
128
128
|
self.repository = ci_project_name
|
|
129
129
|
if "/" in self.repository:
|
|
130
130
|
self.repository = self.repository.rsplit("/")[1]
|
|
@@ -146,7 +146,7 @@ class Gitlab:
|
|
|
146
146
|
|
|
147
147
|
@staticmethod
|
|
148
148
|
def check_event_type() -> str:
|
|
149
|
-
if ci_pipeline_source.lower() == "push":
|
|
149
|
+
if ci_pipeline_source.lower() == "push" or ci_pipeline_source.lower == 'merge_request_event':
|
|
150
150
|
if ci_merge_request_iid is None or ci_merge_request_iid == "":
|
|
151
151
|
event_type = "main"
|
|
152
152
|
else:
|
|
@@ -55,6 +55,7 @@ __all__ = [
|
|
|
55
55
|
"missingDependency",
|
|
56
56
|
"missingLicense",
|
|
57
57
|
"mixedLicense",
|
|
58
|
+
"ambiguousClassifier",
|
|
58
59
|
"modifiedException",
|
|
59
60
|
"modifiedLicense",
|
|
60
61
|
"networkAccess",
|
|
@@ -382,7 +383,7 @@ class copyleftLicense:
|
|
|
382
383
|
|
|
383
384
|
def __init__(self):
|
|
384
385
|
self.description = "(Experimental) Copyleft license information was found"
|
|
385
|
-
self.props = {"comments": "Comments", "
|
|
386
|
+
self.props = {"comments": "Comments", "licenseId": "License Identifiers"}
|
|
386
387
|
self.suggestion = "Determine whether use of copyleft material works for you"
|
|
387
388
|
self.title = "Copyleft License"
|
|
388
389
|
self.emoji = "\u26a0\ufe0f"
|
|
@@ -402,7 +403,7 @@ class nonpermissiveLicense:
|
|
|
402
403
|
|
|
403
404
|
def __init__(self):
|
|
404
405
|
self.description = "(Experimental) A license not known to be considered permissive was found"
|
|
405
|
-
self.props = {"comments": "Comments", "
|
|
406
|
+
self.props = {"comments": "Comments", "licenseId": "License Identifier"}
|
|
406
407
|
self.suggestion = "Determine whether use of material not offered under a known permissive license works for you"
|
|
407
408
|
self.title = "Non-permissive License"
|
|
408
409
|
self.emoji = "\u26a0\ufe0f"
|
|
@@ -1106,7 +1107,7 @@ class mixedLicense:
|
|
|
1106
1107
|
|
|
1107
1108
|
def __init__(self):
|
|
1108
1109
|
self.description = "(Experimental) Package contains multiple licenses."
|
|
1109
|
-
self.props = {"licenseId": "License
|
|
1110
|
+
self.props = {"licenseId": "License Ids"}
|
|
1110
1111
|
self.suggestion = "A new version of the package should be published that includes a single license. Consumers may seek clarification from the package author. Ensure that the license details are consistent across the LICENSE file, package.json license field and license details mentioned in the README."
|
|
1111
1112
|
self.title = "Mixed license"
|
|
1112
1113
|
self.emoji = "\u26a0\ufe0f"
|
|
@@ -1116,6 +1117,26 @@ class mixedLicense:
|
|
|
1116
1117
|
return json.dumps(self.__dict__)
|
|
1117
1118
|
|
|
1118
1119
|
|
|
1120
|
+
class ambiguousClassifier:
|
|
1121
|
+
props: dict
|
|
1122
|
+
description: str
|
|
1123
|
+
suggestion: str
|
|
1124
|
+
title: str
|
|
1125
|
+
emoji: str
|
|
1126
|
+
nextStepTitle: str
|
|
1127
|
+
|
|
1128
|
+
def __init__(self):
|
|
1129
|
+
self.props = {"classifier": "The classifier"}
|
|
1130
|
+
self.description = "(Experimental) An ambiguous license classifier was found."
|
|
1131
|
+
self.suggestion = "A specific license or licenses should be identified"
|
|
1132
|
+
self.title = "Ambiguous License Classifier"
|
|
1133
|
+
self.emoji = "\u26a0\ufe0f"
|
|
1134
|
+
self.nextStepTitle = "What is an ambiguous license classifier?"
|
|
1135
|
+
|
|
1136
|
+
def __str__(self):
|
|
1137
|
+
return json.dumps(self.__dict__)
|
|
1138
|
+
|
|
1139
|
+
|
|
1119
1140
|
class modifiedException:
|
|
1120
1141
|
description: str
|
|
1121
1142
|
props: dict
|
|
@@ -1943,6 +1964,7 @@ class AllIssues:
|
|
|
1943
1964
|
missingDependency: missingDependency
|
|
1944
1965
|
missingLicense: missingLicense
|
|
1945
1966
|
mixedLicense: mixedLicense
|
|
1967
|
+
ambiguousClassifier: ambiguousClassifier
|
|
1946
1968
|
modifiedException: modifiedException
|
|
1947
1969
|
modifiedLicense: modifiedLicense
|
|
1948
1970
|
networkAccess: networkAccess
|
|
@@ -1983,7 +2005,6 @@ class AllIssues:
|
|
|
1983
2005
|
zeroWidth: zeroWidth
|
|
1984
2006
|
floatingDependency: floatingDependency
|
|
1985
2007
|
unpopularPackage: unpopularPackage
|
|
1986
|
-
|
|
1987
2008
|
def __init__(self):
|
|
1988
2009
|
self.badEncoding = badEncoding()
|
|
1989
2010
|
self.badSemver = badSemver()
|
|
@@ -2037,6 +2058,7 @@ class AllIssues:
|
|
|
2037
2058
|
self.missingDependency = missingDependency()
|
|
2038
2059
|
self.missingLicense = missingLicense()
|
|
2039
2060
|
self.mixedLicense = mixedLicense()
|
|
2061
|
+
self.ambiguousClassifier = ambiguousClassifier()
|
|
2040
2062
|
self.modifiedException = modifiedException()
|
|
2041
2063
|
self.modifiedLicense = modifiedLicense()
|
|
2042
2064
|
self.networkAccess = networkAccess()
|
|
@@ -5,7 +5,10 @@ from socketsecurity.core.classes import FullScanParams, Diff, Package
|
|
|
5
5
|
from socketsecurity.core.messages import Messages
|
|
6
6
|
import os
|
|
7
7
|
import sys
|
|
8
|
+
import logging
|
|
8
9
|
|
|
10
|
+
logging.basicConfig(level=logging.INFO)
|
|
11
|
+
log = logging.getLogger("socketcli")
|
|
9
12
|
|
|
10
13
|
parser = argparse.ArgumentParser(
|
|
11
14
|
prog="socketcli",
|
|
@@ -80,19 +83,28 @@ parser.add_argument(
|
|
|
80
83
|
help='Display the version',
|
|
81
84
|
)
|
|
82
85
|
|
|
86
|
+
parser.add_argument(
|
|
87
|
+
'--enable-debug',
|
|
88
|
+
help='Enable debug mode',
|
|
89
|
+
action='store_true',
|
|
90
|
+
default=False
|
|
91
|
+
)
|
|
83
92
|
|
|
84
93
|
def output_console_comments(diff_report) -> None:
|
|
85
94
|
console_security_comment = Messages.create_console_security_alert_table(diff_report)
|
|
86
95
|
if len(diff_report.new_alerts) > 0:
|
|
87
|
-
|
|
88
|
-
|
|
96
|
+
log.info("Security issues detected by Socket Security")
|
|
97
|
+
log.info(console_security_comment)
|
|
89
98
|
sys.exit(1)
|
|
90
99
|
else:
|
|
91
|
-
|
|
100
|
+
log.info("No New Security issues detected by Socket Security")
|
|
92
101
|
|
|
93
102
|
|
|
94
103
|
def cli():
|
|
95
104
|
arguments = parser.parse_args()
|
|
105
|
+
debug = arguments.enable_debug
|
|
106
|
+
if debug:
|
|
107
|
+
logging.basicConfig(level=logging.DEBUG)
|
|
96
108
|
repo = arguments.repo
|
|
97
109
|
branch = arguments.branch
|
|
98
110
|
commit_message = arguments.commit_message
|
|
@@ -111,12 +123,12 @@ def cli():
|
|
|
111
123
|
license_file += ".json"
|
|
112
124
|
api_token = os.getenv("SOCKET_SECURITY_API_KEY") or arguments.api_token
|
|
113
125
|
if api_token is None:
|
|
114
|
-
|
|
126
|
+
log.info("Unable to find Socket API Token")
|
|
115
127
|
sys.exit(3)
|
|
116
128
|
if repo is None:
|
|
117
|
-
|
|
129
|
+
log.info("Repo name needs to be set")
|
|
118
130
|
sys.exit(2)
|
|
119
|
-
|
|
131
|
+
log.info(f"Starting Socket Security Scan version {__version__}")
|
|
120
132
|
scm = None
|
|
121
133
|
if scm_type == "github":
|
|
122
134
|
from socketsecurity.core.github import Github
|
|
@@ -143,11 +155,11 @@ def cli():
|
|
|
143
155
|
)
|
|
144
156
|
diff = None
|
|
145
157
|
if scm is not None and scm.check_event_type() == "comment":
|
|
146
|
-
|
|
158
|
+
log.info("Comment initiated flow")
|
|
147
159
|
comments = scm.get_comments_for_pr(scm.repository, str(scm.pr_number))
|
|
148
160
|
scm.remove_comment_alerts(comments)
|
|
149
161
|
elif scm is not None and scm.check_event_type() != "comment":
|
|
150
|
-
|
|
162
|
+
log.info("Push initiated flow")
|
|
151
163
|
diff: Diff
|
|
152
164
|
diff = core.create_new_diff(target_path, params, workspace=target_path)
|
|
153
165
|
if scm.check_event_type() == "diff":
|
|
@@ -158,7 +170,7 @@ def cli():
|
|
|
158
170
|
scm.add_socket_comments(security_comment, overview_comment, comments)
|
|
159
171
|
output_console_comments(diff)
|
|
160
172
|
else:
|
|
161
|
-
|
|
173
|
+
log.info("API Mode")
|
|
162
174
|
diff: Diff
|
|
163
175
|
diff = core.create_new_diff(target_path, params, workspace=target_path)
|
|
164
176
|
output_console_comments(diff)
|
|
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.58 → socketsecurity-0.0.60}/socketsecurity.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|