mobbdev 0.0.6 → 0.0.8
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/README.md +15 -10
- package/package.json +45 -45
- package/src/snyk.mjs +56 -15
package/README.md
CHANGED
|
@@ -1,32 +1,37 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Bugsy
|
|
2
2
|
|
|
3
|
-
[Mobb](https://www.mobb.dev)
|
|
3
|
+
Bugsy is a command-line interface (CLI) tool that provides automatic security vulnerability remediation for your code. It is the community edition version of [Mobb](https://www.mobb.dev), the first vendor-agnostic automatic security vulnerability remediation tool. Bugsy is designed to help developers easily identify and fix security vulnerabilities in their code.
|
|
4
4
|
|
|
5
5
|
<img width="750" alt="Screenshot 2023-03-27 at 5 23 19 PM" src="https://user-images.githubusercontent.com/96389636/228070025-2a1c3aae-6b40-427f-a1e9-2b10ef97b5ea.png">
|
|
6
6
|
|
|
7
7
|
## What is [Mobb](https://www.mobb.dev)?
|
|
8
8
|
|
|
9
|
-
[Mobb](https://www.mobb.dev) is the first vendor
|
|
9
|
+
[Mobb](https://www.mobb.dev) is the first vendor-agnostic automatic security vulnerability remediation tool. It ingests SAST results from Checkmarx, GitHub Advanced Security, and Snyk and produces code fixes for developers to review and commit to their code.
|
|
10
10
|
|
|
11
|
-
## What does
|
|
11
|
+
## What does Bugsy do?
|
|
12
12
|
|
|
13
|
-
- Uses Snyk
|
|
14
|
-
- Analyzes the
|
|
15
|
-
-
|
|
13
|
+
- Uses Snyk CLI tool to run a SAST analysis on a given open-source GitHub repo
|
|
14
|
+
- Analyzes the vulnerability report to identify issues that can be remediated automatically
|
|
15
|
+
- Produces the code fixes and redirects the user to the fix report page on the Mobb platform
|
|
16
16
|
|
|
17
17
|
## Disclaimer
|
|
18
18
|
|
|
19
|
-
This is
|
|
19
|
+
This is a community edition version that only analyzes public GitHub repositories.
|
|
20
|
+
Snyk CLI is used to produce a SAST vulnerability report.
|
|
20
21
|
|
|
21
22
|
- Only Java projects are supported at the moment.
|
|
22
|
-
- Only SQLi, CMDi, XSS, and
|
|
23
|
+
- Only SQLi, CMDi, XSS, XXE, and Path Traversal are currently supported.
|
|
23
24
|
|
|
24
25
|
## Usage
|
|
25
26
|
|
|
27
|
+
You can use Bugsy from the command line. To evaluate and remediate a new open-source repository, you can run the following command:
|
|
28
|
+
|
|
26
29
|
```shell
|
|
27
30
|
npx mobbdev https://github.com/mobb-dev/simple-vulnerable-java-project
|
|
28
31
|
```
|
|
29
32
|
|
|
33
|
+
Bugsy will automatically generate a fix for each supported vulnerability identified in the SAST results, present it to developers for review and commit to their code.
|
|
34
|
+
|
|
30
35
|
## Getting support
|
|
31
36
|
|
|
32
|
-
If you need support using
|
|
37
|
+
If you need support using Bugsy or just want to share your thoughts and learn more, you are more than welcome to join our [discord server](https://discord.gg/ks6Nz3H828)
|
package/package.json
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
2
|
+
"name": "mobbdev",
|
|
3
|
+
"version": "0.0.8",
|
|
4
|
+
"description": "Automated secure code remediation tool",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"mobbdev": "bin/cli.mjs"
|
|
8
|
+
},
|
|
9
|
+
"author": "",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"colors": "1.4.0",
|
|
13
|
+
"configstore": "6.0.0",
|
|
14
|
+
"dotenv": "16.0.3",
|
|
15
|
+
"extract-zip": "2.0.1",
|
|
16
|
+
"form-data": "4.0.0",
|
|
17
|
+
"got": "12.6.0",
|
|
18
|
+
"open": "8.4.2",
|
|
19
|
+
"snyk": "1.1118.0",
|
|
20
|
+
"tmp": "0.2.1",
|
|
21
|
+
"zod": "3.21.4"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@jest/globals": "29.5.0",
|
|
25
|
+
"eslint": "8.36.0",
|
|
26
|
+
"jest": "29.5.0",
|
|
27
|
+
"prettier": "2.8.4"
|
|
28
|
+
},
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=8.5.0"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"bin",
|
|
34
|
+
"src",
|
|
35
|
+
"index.mjs",
|
|
36
|
+
".env",
|
|
37
|
+
"README.md",
|
|
38
|
+
"LICENSE",
|
|
39
|
+
"package.json"
|
|
40
|
+
],
|
|
41
|
+
"scripts": {
|
|
42
|
+
"lint": "prettier --check . && eslint **/*.mjs",
|
|
43
|
+
"lint:fix": "prettier --write . && eslint --fix **/*.mjs",
|
|
44
|
+
"test": "DOTENV_ME=${ENV_VAULT_CLI} dotenv-vault pull development .env && TOKEN=$(../../scripts/login_auth0.sh) NODE_OPTIONS=--experimental-vm-modules jest"
|
|
45
|
+
}
|
|
46
|
+
}
|
package/src/snyk.mjs
CHANGED
|
@@ -1,41 +1,82 @@
|
|
|
1
1
|
import cp from 'node:child_process';
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
+
import readline from 'node:readline';
|
|
4
|
+
import { stdout } from 'colors/lib/system/supports-colors.js';
|
|
5
|
+
import open from 'open';
|
|
6
|
+
import * as process from 'process';
|
|
3
7
|
|
|
4
8
|
const require = createRequire(import.meta.url);
|
|
5
9
|
const SNYK_PATH = require.resolve('snyk/bin/snyk');
|
|
6
10
|
|
|
7
|
-
async function forkSnyk(args,
|
|
11
|
+
async function forkSnyk(args, display) {
|
|
8
12
|
return new Promise((resolve, reject) => {
|
|
9
13
|
const child = cp.fork(SNYK_PATH, args, {
|
|
10
|
-
stdio,
|
|
14
|
+
stdio: ['inherit', 'pipe', 'pipe', 'ipc'],
|
|
15
|
+
env: { FORCE_COLOR: stdout.level },
|
|
11
16
|
});
|
|
12
17
|
let out = '';
|
|
18
|
+
const onData = (chunk) => {
|
|
19
|
+
out += chunk;
|
|
20
|
+
};
|
|
13
21
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
child.stdout.on('data', onData);
|
|
23
|
+
child.stderr.on('data', onData);
|
|
24
|
+
|
|
25
|
+
if (display) {
|
|
26
|
+
child.stdout.pipe(process.stdout);
|
|
27
|
+
child.stderr.pipe(process.stderr);
|
|
18
28
|
}
|
|
19
29
|
|
|
20
30
|
child.on('exit', () => {
|
|
21
31
|
resolve(out);
|
|
22
32
|
});
|
|
33
|
+
child.on('error', (err) => {
|
|
34
|
+
reject(err);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function question(questionString) {
|
|
40
|
+
const rl = readline.createInterface({
|
|
41
|
+
input: process.stdin,
|
|
42
|
+
output: process.stdout,
|
|
43
|
+
});
|
|
23
44
|
|
|
24
|
-
|
|
45
|
+
return new Promise((resolve) => {
|
|
46
|
+
rl.question(`${questionString} `, (answer) => {
|
|
47
|
+
rl.close();
|
|
48
|
+
resolve(answer);
|
|
49
|
+
});
|
|
25
50
|
});
|
|
26
51
|
}
|
|
27
52
|
|
|
28
53
|
export async function getSnykReport(reportPath, repoRoot) {
|
|
29
|
-
const config = await forkSnyk(['config'],
|
|
54
|
+
const config = await forkSnyk(['config'], false);
|
|
30
55
|
|
|
31
56
|
if (!config.includes('api: ')) {
|
|
32
|
-
await forkSnyk(['auth']);
|
|
57
|
+
await forkSnyk(['auth'], true);
|
|
33
58
|
}
|
|
34
59
|
|
|
35
|
-
await forkSnyk(
|
|
36
|
-
'code',
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
60
|
+
const out = await forkSnyk(
|
|
61
|
+
['code', 'test', `--sarif-file-output=${reportPath}`, repoRoot],
|
|
62
|
+
true
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
if (
|
|
66
|
+
out.includes(
|
|
67
|
+
'Snyk Code is not supported for org: enable in Settings > Snyk Code'
|
|
68
|
+
)
|
|
69
|
+
) {
|
|
70
|
+
const answer = await question(
|
|
71
|
+
"Do you want to be taken to the relevant Snyk's online article? (Y/N)"
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
if (['y', 'yes', ''].includes(answer.toLowerCase())) {
|
|
75
|
+
await open(
|
|
76
|
+
'https://docs.snyk.io/scan-application-code/snyk-code/getting-started-with-snyk-code/activating-snyk-code-using-the-web-ui/step-1-enabling-the-snyk-code-option'
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
process.exit(0);
|
|
81
|
+
}
|
|
41
82
|
}
|