socketsecurity 0.0.65__tar.gz → 0.0.67__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.
Files changed (24) hide show
  1. socketsecurity-0.0.67/LICENSE +21 -0
  2. socketsecurity-0.0.67/PKG-INFO +51 -0
  3. socketsecurity-0.0.67/README.md +29 -0
  4. {socketsecurity-0.0.65 → socketsecurity-0.0.67}/pyproject.toml +1 -1
  5. {socketsecurity-0.0.65 → socketsecurity-0.0.67}/socketsecurity/core/__init__.py +5 -5
  6. {socketsecurity-0.0.65 → socketsecurity-0.0.67}/socketsecurity/socketcli.py +4 -5
  7. socketsecurity-0.0.67/socketsecurity.egg-info/PKG-INFO +51 -0
  8. {socketsecurity-0.0.65 → socketsecurity-0.0.67}/socketsecurity.egg-info/SOURCES.txt +1 -0
  9. socketsecurity-0.0.65/PKG-INFO +0 -22
  10. socketsecurity-0.0.65/README.md +0 -1
  11. socketsecurity-0.0.65/socketsecurity.egg-info/PKG-INFO +0 -22
  12. {socketsecurity-0.0.65 → socketsecurity-0.0.67}/setup.cfg +0 -0
  13. {socketsecurity-0.0.65 → socketsecurity-0.0.67}/socketsecurity/__init__.py +0 -0
  14. {socketsecurity-0.0.65 → socketsecurity-0.0.67}/socketsecurity/core/classes.py +0 -0
  15. {socketsecurity-0.0.65 → socketsecurity-0.0.67}/socketsecurity/core/exceptions.py +0 -0
  16. {socketsecurity-0.0.65 → socketsecurity-0.0.67}/socketsecurity/core/github.py +0 -0
  17. {socketsecurity-0.0.65 → socketsecurity-0.0.67}/socketsecurity/core/gitlab.py +0 -0
  18. {socketsecurity-0.0.65 → socketsecurity-0.0.67}/socketsecurity/core/issues.py +0 -0
  19. {socketsecurity-0.0.65 → socketsecurity-0.0.67}/socketsecurity/core/licenses.py +0 -0
  20. {socketsecurity-0.0.65 → socketsecurity-0.0.67}/socketsecurity/core/messages.py +0 -0
  21. {socketsecurity-0.0.65 → socketsecurity-0.0.67}/socketsecurity.egg-info/dependency_links.txt +0 -0
  22. {socketsecurity-0.0.65 → socketsecurity-0.0.67}/socketsecurity.egg-info/entry_points.txt +0 -0
  23. {socketsecurity-0.0.65 → socketsecurity-0.0.67}/socketsecurity.egg-info/requires.txt +0 -0
  24. {socketsecurity-0.0.65 → socketsecurity-0.0.67}/socketsecurity.egg-info/top_level.txt +0 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Socket Inc
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,51 @@
1
+ Metadata-Version: 2.1
2
+ Name: socketsecurity
3
+ Version: 0.0.67
4
+ Summary: Socket Security CLI for CI/CD
5
+ Author-email: Douglas Coburn <douglas@socket.dev>
6
+ Maintainer-email: Douglas Coburn <douglas@socket.dev>
7
+ Project-URL: Homepage, https://socket.dev
8
+ Keywords: socketsecurity,socket.dev,sca,oss,security
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3.9
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Requires-Python: >=3.9
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: requests
19
+ Requires-Dist: mdutils
20
+ Requires-Dist: prettytable
21
+ Requires-Dist: argparse
22
+
23
+ # Socket Security CLI
24
+
25
+ The Socket Security CLI was created to enable integrations with other tools like Github Actions, Gitlab, BitBucket, local use cases and more. The tool will get the head scan for the provided repo from Socket, create a new one, and then report any new alerts detected. If there are new alerts against the Socket security policy it'll exit with a non-Zero exit code.
26
+
27
+ ## Usage
28
+
29
+ ```` shell
30
+ socketcli [-h] [--api_token API_TOKEN] [--repo REPO] [--branch BRANCH] [--committer COMMITTER] [--pr_number PR_NUMBER] [--commit_message COMMIT_MESSAGE] [--default_branch DEFAULT_BRANCH]
31
+ [--target_path TARGET_PATH] [--mode {diff,new,license}] [--scm {api,github}] [--generate-license GENERATE_LICENSE]
32
+ ````
33
+
34
+ If you don't want to provide the Socket API Token every time then you can use the environment variable `SOCKET_SECURITY_API_KEY`
35
+
36
+
37
+ | Parameter | Alternate Name | Required | Default | Description |
38
+ |:-------------------|:---------------|:---------|:--------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------|
39
+ | -h | --help | False | | Show the CLI help message |
40
+ | --api_token | | False | | Provides the Socket API Token |
41
+ | --repo | | True | | The string name in a git approved name for repositories. |
42
+ | --branch | | False | | The string name in a git approved name for branches. |
43
+ | --committer | | False | | The string name of the person doing the commit or running the CLI. Can be specified multiple times to have more than one committer |
44
+ | --pr_number | | False | 0 | The integer for the PR or MR number |
45
+ | --commit_message | | False | | The string for a commit message if there is one |
46
+ | --default_branch | | False | False | If the flag is specified this will signal that this is the default branch. This needs to be enabled for a report to update Org Alerts and Org Dependencies |
47
+ | --target_path | | False | ./ | This is the path to where the manifest files are location. The tool will recursively search for all supported manifest files |
48
+ | --scm | | False | api | This is the mode that the tool is to run in. For local runs `api` would be the mode. Other options are `gitlab` and `github` |
49
+ | --generate-license | | False | False | If this flag is specified it will generate a json file with the license per package and license text in the current working directory |
50
+ | --version | -v | False | | Prints the version and exits |
51
+ | --enable-debug | | False | False | Enables debug messaging for the CLI |
@@ -0,0 +1,29 @@
1
+ # Socket Security CLI
2
+
3
+ The Socket Security CLI was created to enable integrations with other tools like Github Actions, Gitlab, BitBucket, local use cases and more. The tool will get the head scan for the provided repo from Socket, create a new one, and then report any new alerts detected. If there are new alerts against the Socket security policy it'll exit with a non-Zero exit code.
4
+
5
+ ## Usage
6
+
7
+ ```` shell
8
+ socketcli [-h] [--api_token API_TOKEN] [--repo REPO] [--branch BRANCH] [--committer COMMITTER] [--pr_number PR_NUMBER] [--commit_message COMMIT_MESSAGE] [--default_branch DEFAULT_BRANCH]
9
+ [--target_path TARGET_PATH] [--mode {diff,new,license}] [--scm {api,github}] [--generate-license GENERATE_LICENSE]
10
+ ````
11
+
12
+ If you don't want to provide the Socket API Token every time then you can use the environment variable `SOCKET_SECURITY_API_KEY`
13
+
14
+
15
+ | Parameter | Alternate Name | Required | Default | Description |
16
+ |:-------------------|:---------------|:---------|:--------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------|
17
+ | -h | --help | False | | Show the CLI help message |
18
+ | --api_token | | False | | Provides the Socket API Token |
19
+ | --repo | | True | | The string name in a git approved name for repositories. |
20
+ | --branch | | False | | The string name in a git approved name for branches. |
21
+ | --committer | | False | | The string name of the person doing the commit or running the CLI. Can be specified multiple times to have more than one committer |
22
+ | --pr_number | | False | 0 | The integer for the PR or MR number |
23
+ | --commit_message | | False | | The string for a commit message if there is one |
24
+ | --default_branch | | False | False | If the flag is specified this will signal that this is the default branch. This needs to be enabled for a report to update Org Alerts and Org Dependencies |
25
+ | --target_path | | False | ./ | This is the path to where the manifest files are location. The tool will recursively search for all supported manifest files |
26
+ | --scm | | False | api | This is the mode that the tool is to run in. For local runs `api` would be the mode. Other options are `gitlab` and `github` |
27
+ | --generate-license | | False | False | If this flag is specified it will generate a json file with the license per package and license text in the current working directory |
28
+ | --version | -v | False | | Prints the version and exits |
29
+ | --enable-debug | | False | False | Enables debug messaging for the CLI |
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "socketsecurity"
7
- version = "0.0.65"
7
+ version = "0.0.67"
8
8
  requires-python = ">= 3.9"
9
9
  dependencies = [
10
10
  'requests',
@@ -25,7 +25,7 @@ import time
25
25
 
26
26
 
27
27
  __author__ = 'socket.dev'
28
- __version__ = '0.0.65'
28
+ __version__ = '0.0.67'
29
29
  __all__ = [
30
30
  "Core",
31
31
  "log",
@@ -81,7 +81,7 @@ def do_request(
81
81
  if headers is None:
82
82
  headers = {
83
83
  'Authorization': f"Basic {encoded_key}",
84
- 'User-Agent': 'SocketPythonScript/0.0.1',
84
+ 'User-Agent': f'SocketPythonCLI/{__version__}',
85
85
  "accept": "application/json"
86
86
  }
87
87
  url = f"{api_url}/{path}"
@@ -113,7 +113,7 @@ def do_request(
113
113
  elif response.status_code == 429:
114
114
  raise APIInsufficientQuota("Insufficient quota for API route")
115
115
  elif response.status_code == 524:
116
- raise APICloudflareError
116
+ raise APICloudflareError(response.text)
117
117
  else:
118
118
  msg = {
119
119
  "status_code": response.status_code,
@@ -204,8 +204,8 @@ class Core:
204
204
  data = response.json()
205
205
  results = data.get("sbom_artifacts") or []
206
206
  except Exception as error:
207
- log.info("Failed with old style full-scan API using new format")
208
- log.info(error)
207
+ log.debug("Failed with old style full-scan API using new format")
208
+ log.debug(error)
209
209
  data = response.text
210
210
  data.strip('"')
211
211
  data.strip()
@@ -50,7 +50,8 @@ parser.add_argument(
50
50
  )
51
51
  parser.add_argument(
52
52
  '--default_branch',
53
- default=1,
53
+ default=False,
54
+ action='store_true',
54
55
  help='Whether this is the default/head for run'
55
56
  )
56
57
  parser.add_argument(
@@ -90,6 +91,7 @@ parser.add_argument(
90
91
  default=False
91
92
  )
92
93
 
94
+
93
95
  def output_console_comments(diff_report) -> None:
94
96
  console_security_comment = Messages.create_console_security_alert_table(diff_report)
95
97
  if len(diff_report.new_alerts) > 0:
@@ -109,10 +111,7 @@ def cli():
109
111
  branch = arguments.branch
110
112
  commit_message = arguments.commit_message
111
113
  committer = arguments.committer
112
- default_branch_int = arguments.default_branch
113
- default_branch = False
114
- if default_branch_int == 1:
115
- default_branch = True
114
+ default_branch = arguments.default_branch
116
115
  pr_number = arguments.pr_number
117
116
  target_path = arguments.target_path
118
117
  scm_type = arguments.scm
@@ -0,0 +1,51 @@
1
+ Metadata-Version: 2.1
2
+ Name: socketsecurity
3
+ Version: 0.0.67
4
+ Summary: Socket Security CLI for CI/CD
5
+ Author-email: Douglas Coburn <douglas@socket.dev>
6
+ Maintainer-email: Douglas Coburn <douglas@socket.dev>
7
+ Project-URL: Homepage, https://socket.dev
8
+ Keywords: socketsecurity,socket.dev,sca,oss,security
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3.9
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Requires-Python: >=3.9
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: requests
19
+ Requires-Dist: mdutils
20
+ Requires-Dist: prettytable
21
+ Requires-Dist: argparse
22
+
23
+ # Socket Security CLI
24
+
25
+ The Socket Security CLI was created to enable integrations with other tools like Github Actions, Gitlab, BitBucket, local use cases and more. The tool will get the head scan for the provided repo from Socket, create a new one, and then report any new alerts detected. If there are new alerts against the Socket security policy it'll exit with a non-Zero exit code.
26
+
27
+ ## Usage
28
+
29
+ ```` shell
30
+ socketcli [-h] [--api_token API_TOKEN] [--repo REPO] [--branch BRANCH] [--committer COMMITTER] [--pr_number PR_NUMBER] [--commit_message COMMIT_MESSAGE] [--default_branch DEFAULT_BRANCH]
31
+ [--target_path TARGET_PATH] [--mode {diff,new,license}] [--scm {api,github}] [--generate-license GENERATE_LICENSE]
32
+ ````
33
+
34
+ If you don't want to provide the Socket API Token every time then you can use the environment variable `SOCKET_SECURITY_API_KEY`
35
+
36
+
37
+ | Parameter | Alternate Name | Required | Default | Description |
38
+ |:-------------------|:---------------|:---------|:--------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------|
39
+ | -h | --help | False | | Show the CLI help message |
40
+ | --api_token | | False | | Provides the Socket API Token |
41
+ | --repo | | True | | The string name in a git approved name for repositories. |
42
+ | --branch | | False | | The string name in a git approved name for branches. |
43
+ | --committer | | False | | The string name of the person doing the commit or running the CLI. Can be specified multiple times to have more than one committer |
44
+ | --pr_number | | False | 0 | The integer for the PR or MR number |
45
+ | --commit_message | | False | | The string for a commit message if there is one |
46
+ | --default_branch | | False | False | If the flag is specified this will signal that this is the default branch. This needs to be enabled for a report to update Org Alerts and Org Dependencies |
47
+ | --target_path | | False | ./ | This is the path to where the manifest files are location. The tool will recursively search for all supported manifest files |
48
+ | --scm | | False | api | This is the mode that the tool is to run in. For local runs `api` would be the mode. Other options are `gitlab` and `github` |
49
+ | --generate-license | | False | False | If this flag is specified it will generate a json file with the license per package and license text in the current working directory |
50
+ | --version | -v | False | | Prints the version and exits |
51
+ | --enable-debug | | False | False | Enables debug messaging for the CLI |
@@ -1,3 +1,4 @@
1
+ LICENSE
1
2
  README.md
2
3
  pyproject.toml
3
4
  socketsecurity/__init__.py
@@ -1,22 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: socketsecurity
3
- Version: 0.0.65
4
- Summary: Socket Security CLI for CI/CD
5
- Author-email: Douglas Coburn <douglas@socket.dev>
6
- Maintainer-email: Douglas Coburn <douglas@socket.dev>
7
- Project-URL: Homepage, https://socket.dev
8
- Keywords: socketsecurity,socket.dev,sca,oss,security
9
- Classifier: Development Status :: 4 - Beta
10
- Classifier: Intended Audience :: Developers
11
- Classifier: Programming Language :: Python :: 3.9
12
- Classifier: Programming Language :: Python :: 3.10
13
- Classifier: Programming Language :: Python :: 3.11
14
- Classifier: Programming Language :: Python :: 3.12
15
- Requires-Python: >=3.9
16
- Description-Content-Type: text/markdown
17
- Requires-Dist: requests
18
- Requires-Dist: mdutils
19
- Requires-Dist: prettytable
20
- Requires-Dist: argparse
21
-
22
- # Socket Security CLI
@@ -1 +0,0 @@
1
- # Socket Security CLI
@@ -1,22 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: socketsecurity
3
- Version: 0.0.65
4
- Summary: Socket Security CLI for CI/CD
5
- Author-email: Douglas Coburn <douglas@socket.dev>
6
- Maintainer-email: Douglas Coburn <douglas@socket.dev>
7
- Project-URL: Homepage, https://socket.dev
8
- Keywords: socketsecurity,socket.dev,sca,oss,security
9
- Classifier: Development Status :: 4 - Beta
10
- Classifier: Intended Audience :: Developers
11
- Classifier: Programming Language :: Python :: 3.9
12
- Classifier: Programming Language :: Python :: 3.10
13
- Classifier: Programming Language :: Python :: 3.11
14
- Classifier: Programming Language :: Python :: 3.12
15
- Requires-Python: >=3.9
16
- Description-Content-Type: text/markdown
17
- Requires-Dist: requests
18
- Requires-Dist: mdutils
19
- Requires-Dist: prettytable
20
- Requires-Dist: argparse
21
-
22
- # Socket Security CLI