Skip to content

Commit 155fb4a

Browse files
committed
Initial Version
0 parents  commit 155fb4a

28 files changed

+26110
-0
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @SocketDev/eng

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.idea
2+
venv
3+
.venv
4+
build
5+
dist
6+
*.build
7+
*.dist
8+
*.egg-info
9+
test
10+
*.env
11+
run_container.sh
12+
*.zip
13+
bin
14+
scripts/*.py
15+
*.json
16+
markdown_overview_temp.md
17+
markdown_security_temp.md
18+
.DS_Store

Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM python:3-alpine
2+
LABEL org.opencontainers.image.authors="socket.dev"
3+
4+
RUN apk update \
5+
&& apk add --no-cache git
6+
RUN pip install socketsecurity

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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.

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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 |

pyproject.toml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[build-system]
2+
requires = ["setuptools >= 61.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "socketsecurity"
7+
version = "0.0.67"
8+
requires-python = ">= 3.9"
9+
dependencies = [
10+
'requests',
11+
'mdutils',
12+
'prettytable',
13+
'argparse'
14+
]
15+
readme = "README.md"
16+
description = "Socket Security CLI for CI/CD"
17+
keywords = ["socketsecurity", "socket.dev", "sca", "oss", "security"]
18+
authors = [
19+
{name = "Douglas Coburn", email = "[email protected]"}
20+
]
21+
maintainers = [
22+
{name = "Douglas Coburn", email = "[email protected]"}
23+
]
24+
classifiers = [
25+
"Development Status :: 4 - Beta",
26+
"Intended Audience :: Developers",
27+
"Programming Language :: Python :: 3.9",
28+
"Programming Language :: Python :: 3.10",
29+
"Programming Language :: Python :: 3.11",
30+
"Programming Language :: Python :: 3.12",
31+
]
32+
33+
[project.scripts]
34+
socketcli = "socketsecurity.socketcli:cli"
35+
36+
[project.urls]
37+
Homepage = "https://socket.dev"
38+
39+
[tool.setuptools.packages.find]
40+
include = [
41+
"socketsecurity",
42+
"socketsecurity.core"
43+
]

requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
requests~=2.31.0
2+
mdutils~=1.6.0
3+
prettytable
4+
argparse

scripts/run.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
cd /socketcli
4+
python3 socketcli.py

socketsecurity/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import socketsecurity.core
2+
3+
__author__ = 'socket.dev'
4+
__version = socketsecurity.core.__version__
213 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)