socket 0.0.1 → 0.14.11

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.
package/LICENSE ADDED
@@ -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.
package/README.md ADDED
@@ -0,0 +1,128 @@
1
+ # Socket CLI
2
+
3
+ [![Socket Badge](https://socket.dev/api/badge/npm/package/socket)](https://socket.dev/npm/package/socket)
4
+ [![Follow @SocketSecurity](https://img.shields.io/twitter/follow/SocketSecurity?style=social)](https://twitter.com/SocketSecurity)
5
+
6
+ > CLI tool for [Socket.dev](https://socket.dev/)
7
+
8
+ ## Usage
9
+
10
+ ```bash
11
+ npm install -g socket
12
+ ```
13
+
14
+ ```bash
15
+ socket --help
16
+ socket info webtorrent@1.9.1
17
+ socket report create package.json --view
18
+ socket report view QXU8PmK7LfH608RAwfIKdbcHgwEd_ZeWJ9QEGv05FJUQ
19
+ socket wrapper --enable
20
+ ```
21
+
22
+ ## Commands
23
+
24
+ - `socket info <package@version>` - Look up issues for a package.
25
+
26
+ - `socket optimize` - Optimize dependencies with
27
+ [`@socketregistry`](https://github.com/SocketDev/socket-registry-js) overrides
28
+
29
+ - `socket raw-npm` and `socket raw-npx` - Temporarily disable the Socket
30
+ 'safe-npm' wrapper.
31
+
32
+ - `socket report create <path(s)-to-folder-or-file>` - creates a report on
33
+ [socket.dev](https://socket.dev/)
34
+
35
+ Upload the specified `package.json` and lock files for JavaScript, Python, and
36
+ Go dependency manifests. If any folder is specified, the ones found in there
37
+ recursively are uploaded.
38
+
39
+ Supports globbing such as `**/package.json`, `**/requirements.txt`,
40
+ `**/pyproject.toml`, and `**/go.mod`.
41
+
42
+ Ignores any file specified in your project's `.gitignore`, the
43
+ `projectIgnorePaths` in your project's
44
+ [`socket.yml`](https://docs.socket.dev/docs/socket-yml) and on top of that has
45
+ a sensible set of
46
+ [default ignores](https://socket.dev/npm/package/ignore-by-default)
47
+
48
+ - `socket report view <report-id>` - Look up issues and scores from a report.
49
+
50
+ - `socket wrapper --enable` and `socket wrapper --disable` - Enable and disable
51
+ the Socket 'safe-npm' wrapper.
52
+
53
+ ## Aliases
54
+
55
+ All aliases supports flags and arguments of the commands they alias.
56
+
57
+ - `socket ci` - alias for `socket report create --view --strict` which creates a
58
+ report and quits with an exit code if the result is unhealthy. Use like eg.
59
+ `socket ci .` for a report for the current folder
60
+
61
+ ## Flags
62
+
63
+ ### Command specific flags
64
+
65
+ - `--view` - when set on `socket report create` the command will immediately do
66
+ a `socket report view` style view of the created report, waiting for the
67
+ server to complete it
68
+
69
+ ### Output flags
70
+
71
+ - `--json` - outputs result as json which you can then pipe into
72
+ [`jq`](https://stedolan.github.io/jq/) and other tools
73
+ - `--markdown` - outputs result as markdown which you can then copy into an
74
+ issue, PR or even chat
75
+
76
+ ## Strictness flags
77
+
78
+ - `--all` - by default only `high` and `critical` issues are included, by
79
+ setting this flag all issues will be included
80
+ - `--strict` - when set, exits with an error code if report result is deemed
81
+ unhealthy
82
+
83
+ ### Other flags
84
+
85
+ - `--dry-run` - like all CLI tools that perform an action should have, we have a
86
+ dry run flag. Eg. `socket report create` supports running the command without
87
+ actually uploading anything
88
+ - `--debug` - outputs additional debug output. Great for debugging, geeks and us
89
+ who develop. Hopefully you will never _need_ it, but it can still be fun,
90
+ right?
91
+ - `--help` - prints the help for the current command. All CLI tools should have
92
+ this flag
93
+ - `--version` - prints the version of the tool. All CLI tools should have this
94
+ flag
95
+
96
+ ## Configuration files
97
+
98
+ The CLI reads and uses data from a
99
+ [`socket.yml` file](https://docs.socket.dev/docs/socket-yml) in the folder you
100
+ run it in. It supports the version 2 of the `socket.yml` file format and makes
101
+ use of the `projectIgnorePaths` to excludes files when creating a report.
102
+
103
+ ## Environment variables
104
+
105
+ - `SOCKET_SECURITY_API_KEY` - if set, this will be used as the API-key
106
+
107
+ ## Contributing
108
+
109
+ ### Environment variables for development
110
+
111
+ - `SOCKET_SECURITY_API_BASE_URL` - if set, this will be the base for all
112
+ API-calls. Defaults to `https://api.socket.dev/v0/`
113
+ - `SOCKET_SECURITY_API_PROXY` - if set to something like
114
+ [`http://127.0.0.1:9090`](https://docs.proxyman.io/troubleshooting/couldnt-see-any-requests-from-3rd-party-network-libraries),
115
+ then all request will be proxied through that proxy
116
+
117
+ ## Similar projects
118
+
119
+ - [`@socketsecurity/sdk`](https://github.com/SocketDev/socket-sdk-js) - the SDK
120
+ used in this CLI
121
+
122
+ ## See also
123
+
124
+ - [Announcement blog post](https://socket.dev/blog/announcing-socket-cli-preview)
125
+ - [Socket API Reference](https://docs.socket.dev/reference) - the API used in
126
+ this CLI
127
+ - [Socket GitHub App](https://github.com/apps/socket-security) - the
128
+ plug-and-play GitHub App
package/bin/npm ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('../dist/npm-cli.js')
package/bin/npx ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('../dist/npx-cli.js')
@@ -0,0 +1,23 @@
1
+ declare const logSymbols: {
2
+ __proto__: null;
3
+ info: string;
4
+ success: string;
5
+ warning: string;
6
+ error: string;
7
+ };
8
+ declare class ChalkOrMarkdown {
9
+ useMarkdown: boolean;
10
+ constructor(useMarkdown: boolean);
11
+ header(text: string, level?: number): string;
12
+ bold(text: string): string;
13
+ italic(text: string): string;
14
+ hyperlink(text: string, url: string | undefined, { fallback, fallbackToUrl }?: {
15
+ fallback?: boolean;
16
+ fallbackToUrl?: boolean;
17
+ }): string;
18
+ list(items: string[]): string;
19
+ get logSymbols(): typeof logSymbols;
20
+ indent(text: string, level?: number): string;
21
+ json(value: unknown): string;
22
+ }
23
+ export { logSymbols, ChalkOrMarkdown };
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts","../src/utils/formatting.ts","../src/utils/sorts.ts","../src/utils/meow-with-subcommands.ts","../src/commands/cdxgen.ts","../src/flags.ts","../src/utils/api-helpers.ts","../src/utils/objects.ts","../src/utils/format-issues.ts","../src/commands/info.ts","../src/commands/login.ts","../src/commands/logout.ts","../src/commands/npm.ts","../src/commands/npx.ts","../src/utils/fs.ts","../src/utils/json.ts","../src/utils/strings.ts","../src/utils/package-manager-detector.ts","../src/utils/regexps.ts","../src/commands/optimize.ts","../src/commands/organization.ts","../src/commands/raw-npm.ts","../src/commands/raw-npx.ts","../src/commands/report/view.ts","../src/commands/report/create.ts","../src/commands/report/index.ts","../src/commands/wrapper.ts","../src/commands/scan/create.ts","../src/commands/scan/delete.ts","../src/commands/scan/list.ts","../src/commands/scan/metadata.ts","../src/commands/scan/stream.ts","../src/commands/scan/index.ts","../src/commands/audit-log.ts","../src/commands/repos/create.ts","../src/commands/repos/delete.ts","../src/commands/repos/list.ts","../src/commands/repos/update.ts","../src/commands/repos/view.ts","../src/commands/repos/index.ts","../src/commands/dependencies.ts","../src/commands/analytics.ts","../src/commands/diff-scan/get.ts","../src/commands/diff-scan/index.ts","../src/commands/threat-feed.ts","../src/commands/index.ts"],"names":[],"mappings":""}