ship-safe 6.1.0 → 6.2.0
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 +735 -594
- package/cli/agents/api-fuzzer.js +345 -345
- package/cli/agents/auth-bypass-agent.js +348 -348
- package/cli/agents/base-agent.js +272 -272
- package/cli/agents/cicd-scanner.js +236 -201
- package/cli/agents/config-auditor.js +521 -521
- package/cli/agents/deep-analyzer.js +6 -2
- package/cli/agents/git-history-scanner.js +170 -170
- package/cli/agents/html-reporter.js +40 -4
- package/cli/agents/index.js +84 -84
- package/cli/agents/injection-tester.js +500 -500
- package/cli/agents/llm-redteam.js +251 -251
- package/cli/agents/mobile-scanner.js +231 -231
- package/cli/agents/orchestrator.js +322 -322
- package/cli/agents/pii-compliance-agent.js +301 -301
- package/cli/agents/scoring-engine.js +248 -248
- package/cli/agents/supabase-rls-agent.js +154 -154
- package/cli/agents/supply-chain-agent.js +650 -507
- package/cli/bin/ship-safe.js +452 -426
- package/cli/commands/agent.js +608 -608
- package/cli/commands/audit.js +986 -979
- package/cli/commands/baseline.js +193 -193
- package/cli/commands/ci.js +342 -342
- package/cli/commands/deps.js +516 -516
- package/cli/commands/doctor.js +159 -159
- package/cli/commands/fix.js +218 -218
- package/cli/commands/hooks.js +268 -0
- package/cli/commands/init.js +407 -407
- package/cli/commands/mcp.js +304 -304
- package/cli/commands/red-team.js +7 -1
- package/cli/commands/remediate.js +798 -798
- package/cli/commands/rotate.js +571 -571
- package/cli/commands/scan.js +569 -567
- package/cli/commands/score.js +449 -448
- package/cli/commands/watch.js +281 -281
- package/cli/hooks/patterns.js +313 -0
- package/cli/hooks/post-tool-use.js +140 -0
- package/cli/hooks/pre-tool-use.js +186 -0
- package/cli/index.js +73 -69
- package/cli/providers/llm-provider.js +397 -287
- package/cli/utils/autofix-rules.js +74 -74
- package/cli/utils/cache-manager.js +311 -311
- package/cli/utils/output.js +1 -0
- package/cli/utils/patterns.js +1121 -1121
- package/cli/utils/pdf-generator.js +94 -94
- package/package.json +69 -68
- package/cli/__tests__/agents.test.js +0 -1301
- package/configs/supabase/rls-templates.sql +0 -242
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PDF Generator
|
|
3
|
-
* ==============
|
|
4
|
-
*
|
|
5
|
-
* Zero-dependency PDF generation via Chrome/Chromium headless mode.
|
|
6
|
-
* Falls back to generating a print-optimized HTML file if Chrome is not found.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import fs from 'fs';
|
|
10
|
-
import path from 'path';
|
|
11
|
-
import { execFileSync } from 'child_process';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Well-known Chrome/Chromium paths by platform.
|
|
15
|
-
*/
|
|
16
|
-
function findChrome() {
|
|
17
|
-
const candidates = process.platform === 'win32'
|
|
18
|
-
? [
|
|
19
|
-
process.env.CHROME_PATH,
|
|
20
|
-
'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe',
|
|
21
|
-
'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe',
|
|
22
|
-
process.env.LOCALAPPDATA && path.join(process.env.LOCALAPPDATA, 'Google\\Chrome\\Application\\chrome.exe'),
|
|
23
|
-
]
|
|
24
|
-
: process.platform === 'darwin'
|
|
25
|
-
? [
|
|
26
|
-
process.env.CHROME_PATH,
|
|
27
|
-
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
|
|
28
|
-
'/Applications/Chromium.app/Contents/MacOS/Chromium',
|
|
29
|
-
]
|
|
30
|
-
: [
|
|
31
|
-
process.env.CHROME_PATH,
|
|
32
|
-
'/usr/bin/google-chrome',
|
|
33
|
-
'/usr/bin/google-chrome-stable',
|
|
34
|
-
'/usr/bin/chromium',
|
|
35
|
-
'/usr/bin/chromium-browser',
|
|
36
|
-
'/snap/bin/chromium',
|
|
37
|
-
];
|
|
38
|
-
|
|
39
|
-
for (const c of candidates) {
|
|
40
|
-
if (c && fs.existsSync(c)) return c;
|
|
41
|
-
}
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Check if Chrome is available.
|
|
47
|
-
*/
|
|
48
|
-
export function isChromeAvailable() {
|
|
49
|
-
return findChrome() !== null;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Generate PDF from an HTML file using Chrome headless.
|
|
54
|
-
* Returns the output path, or null if Chrome is not available.
|
|
55
|
-
*/
|
|
56
|
-
export function generatePDF(htmlPath, outputPath) {
|
|
57
|
-
const chrome = findChrome();
|
|
58
|
-
if (!chrome) return null;
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
const args = [
|
|
62
|
-
'--headless',
|
|
63
|
-
'--disable-gpu',
|
|
64
|
-
'--no-sandbox',
|
|
65
|
-
`--print-to-pdf=${outputPath}`,
|
|
66
|
-
'--print-to-pdf-no-header',
|
|
67
|
-
htmlPath,
|
|
68
|
-
];
|
|
69
|
-
execFileSync(chrome, args, { timeout: 30000, stdio: 'pipe' }); // ship-safe-ignore — execFileSync with fixed chrome binary path; no user input in command
|
|
70
|
-
return outputPath;
|
|
71
|
-
} catch {
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Generate a print-optimized HTML file as PDF fallback.
|
|
78
|
-
*/
|
|
79
|
-
export function generatePrintHTML(htmlPath, outputPath) {
|
|
80
|
-
let html = fs.readFileSync(htmlPath, 'utf-8');
|
|
81
|
-
// Add print-optimized styles
|
|
82
|
-
const printCSS = `
|
|
83
|
-
<style media="print">
|
|
84
|
-
body { background: #fff !important; color: #1e293b !important; }
|
|
85
|
-
.score-card, .stat, .summary-card, .toc { background: #f8fafc !important; border: 1px solid #e2e8f0 !important; }
|
|
86
|
-
table, th, td { border: 1px solid #e2e8f0 !important; }
|
|
87
|
-
code { background: #f1f5f9 !important; color: #0f172a !important; }
|
|
88
|
-
pre { background: #f1f5f9 !important; }
|
|
89
|
-
a { color: #0369a1 !important; }
|
|
90
|
-
</style>`;
|
|
91
|
-
html = html.replace('</head>', printCSS + '\n</head>');
|
|
92
|
-
fs.writeFileSync(outputPath, html);
|
|
93
|
-
return outputPath;
|
|
94
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* PDF Generator
|
|
3
|
+
* ==============
|
|
4
|
+
*
|
|
5
|
+
* Zero-dependency PDF generation via Chrome/Chromium headless mode.
|
|
6
|
+
* Falls back to generating a print-optimized HTML file if Chrome is not found.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import fs from 'fs';
|
|
10
|
+
import path from 'path';
|
|
11
|
+
import { execFileSync } from 'child_process';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Well-known Chrome/Chromium paths by platform.
|
|
15
|
+
*/
|
|
16
|
+
function findChrome() {
|
|
17
|
+
const candidates = process.platform === 'win32'
|
|
18
|
+
? [
|
|
19
|
+
process.env.CHROME_PATH,
|
|
20
|
+
'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe',
|
|
21
|
+
'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe',
|
|
22
|
+
process.env.LOCALAPPDATA && path.join(process.env.LOCALAPPDATA, 'Google\\Chrome\\Application\\chrome.exe'),
|
|
23
|
+
]
|
|
24
|
+
: process.platform === 'darwin'
|
|
25
|
+
? [
|
|
26
|
+
process.env.CHROME_PATH,
|
|
27
|
+
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
|
|
28
|
+
'/Applications/Chromium.app/Contents/MacOS/Chromium',
|
|
29
|
+
]
|
|
30
|
+
: [
|
|
31
|
+
process.env.CHROME_PATH,
|
|
32
|
+
'/usr/bin/google-chrome',
|
|
33
|
+
'/usr/bin/google-chrome-stable',
|
|
34
|
+
'/usr/bin/chromium',
|
|
35
|
+
'/usr/bin/chromium-browser',
|
|
36
|
+
'/snap/bin/chromium',
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
for (const c of candidates) {
|
|
40
|
+
if (c && fs.existsSync(c)) return c;
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Check if Chrome is available.
|
|
47
|
+
*/
|
|
48
|
+
export function isChromeAvailable() {
|
|
49
|
+
return findChrome() !== null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Generate PDF from an HTML file using Chrome headless.
|
|
54
|
+
* Returns the output path, or null if Chrome is not available.
|
|
55
|
+
*/
|
|
56
|
+
export function generatePDF(htmlPath, outputPath) {
|
|
57
|
+
const chrome = findChrome();
|
|
58
|
+
if (!chrome) return null;
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
const args = [
|
|
62
|
+
'--headless',
|
|
63
|
+
'--disable-gpu',
|
|
64
|
+
'--no-sandbox',
|
|
65
|
+
`--print-to-pdf=${outputPath}`,
|
|
66
|
+
'--print-to-pdf-no-header',
|
|
67
|
+
htmlPath,
|
|
68
|
+
];
|
|
69
|
+
execFileSync(chrome, args, { timeout: 30000, stdio: 'pipe' }); // ship-safe-ignore — execFileSync with fixed chrome binary path; no user input in command
|
|
70
|
+
return outputPath;
|
|
71
|
+
} catch {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Generate a print-optimized HTML file as PDF fallback.
|
|
78
|
+
*/
|
|
79
|
+
export function generatePrintHTML(htmlPath, outputPath) {
|
|
80
|
+
let html = fs.readFileSync(htmlPath, 'utf-8');
|
|
81
|
+
// Add print-optimized styles
|
|
82
|
+
const printCSS = `
|
|
83
|
+
<style media="print">
|
|
84
|
+
body { background: #fff !important; color: #1e293b !important; }
|
|
85
|
+
.score-card, .stat, .summary-card, .toc { background: #f8fafc !important; border: 1px solid #e2e8f0 !important; }
|
|
86
|
+
table, th, td { border: 1px solid #e2e8f0 !important; }
|
|
87
|
+
code { background: #f1f5f9 !important; color: #0f172a !important; }
|
|
88
|
+
pre { background: #f1f5f9 !important; }
|
|
89
|
+
a { color: #0369a1 !important; }
|
|
90
|
+
</style>`;
|
|
91
|
+
html = html.replace('</head>', printCSS + '\n</head>');
|
|
92
|
+
fs.writeFileSync(outputPath, html);
|
|
93
|
+
return outputPath;
|
|
94
|
+
}
|
package/package.json
CHANGED
|
@@ -1,68 +1,69 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "ship-safe",
|
|
3
|
-
"version": "6.
|
|
4
|
-
"description": "AI-powered multi-agent security platform. 18 agents scan 80+ attack classes with LLM-powered deep analysis. Red team your code before attackers do.",
|
|
5
|
-
"main": "cli/index.js",
|
|
6
|
-
"bin": {
|
|
7
|
-
"ship-safe": "cli/bin/ship-safe.js"
|
|
8
|
-
},
|
|
9
|
-
"type": "module",
|
|
10
|
-
"scripts": {
|
|
11
|
-
"test": "node --test cli/__tests__/*.test.js",
|
|
12
|
-
"lint": "eslint cli/",
|
|
13
|
-
"ship-safe": "node cli/bin/ship-safe.js"
|
|
14
|
-
},
|
|
15
|
-
"keywords": [
|
|
16
|
-
"security",
|
|
17
|
-
"secrets",
|
|
18
|
-
"scanner",
|
|
19
|
-
"sast",
|
|
20
|
-
"devsecops",
|
|
21
|
-
"red-team",
|
|
22
|
-
"penetration-testing",
|
|
23
|
-
"vulnerability-scanner",
|
|
24
|
-
"sbom",
|
|
25
|
-
"owasp",
|
|
26
|
-
"sql-injection",
|
|
27
|
-
"xss",
|
|
28
|
-
"ssrf",
|
|
29
|
-
"supply-chain",
|
|
30
|
-
"llm-security",
|
|
31
|
-
"prompt-injection",
|
|
32
|
-
"api-security",
|
|
33
|
-
"docker-security",
|
|
34
|
-
"kubernetes",
|
|
35
|
-
"cicd-security",
|
|
36
|
-
"mobile-security",
|
|
37
|
-
"jwt",
|
|
38
|
-
"cors",
|
|
39
|
-
"cli"
|
|
40
|
-
],
|
|
41
|
-
"author": "ship-safe contributors",
|
|
42
|
-
"license": "MIT",
|
|
43
|
-
"repository": {
|
|
44
|
-
"type": "git",
|
|
45
|
-
"url": "git+https://github.com/asamassekou10/ship-safe.git"
|
|
46
|
-
},
|
|
47
|
-
"bugs": {
|
|
48
|
-
"url": "https://github.com/asamassekou10/ship-safe/issues"
|
|
49
|
-
},
|
|
50
|
-
"homepage": "https://github.com/asamassekou10/ship-safe#readme",
|
|
51
|
-
"engines": {
|
|
52
|
-
"node": ">=18.0.0"
|
|
53
|
-
},
|
|
54
|
-
"files": [
|
|
55
|
-
"cli/",
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "ship-safe",
|
|
3
|
+
"version": "6.2.0",
|
|
4
|
+
"description": "AI-powered multi-agent security platform. 18 agents scan 80+ attack classes with LLM-powered deep analysis. Red team your code before attackers do.",
|
|
5
|
+
"main": "cli/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"ship-safe": "cli/bin/ship-safe.js"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"test": "node --test cli/__tests__/*.test.js",
|
|
12
|
+
"lint": "eslint cli/",
|
|
13
|
+
"ship-safe": "node cli/bin/ship-safe.js"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"security",
|
|
17
|
+
"secrets",
|
|
18
|
+
"scanner",
|
|
19
|
+
"sast",
|
|
20
|
+
"devsecops",
|
|
21
|
+
"red-team",
|
|
22
|
+
"penetration-testing",
|
|
23
|
+
"vulnerability-scanner",
|
|
24
|
+
"sbom",
|
|
25
|
+
"owasp",
|
|
26
|
+
"sql-injection",
|
|
27
|
+
"xss",
|
|
28
|
+
"ssrf",
|
|
29
|
+
"supply-chain",
|
|
30
|
+
"llm-security",
|
|
31
|
+
"prompt-injection",
|
|
32
|
+
"api-security",
|
|
33
|
+
"docker-security",
|
|
34
|
+
"kubernetes",
|
|
35
|
+
"cicd-security",
|
|
36
|
+
"mobile-security",
|
|
37
|
+
"jwt",
|
|
38
|
+
"cors",
|
|
39
|
+
"cli"
|
|
40
|
+
],
|
|
41
|
+
"author": "ship-safe contributors",
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "git+https://github.com/asamassekou10/ship-safe.git"
|
|
46
|
+
},
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/asamassekou10/ship-safe/issues"
|
|
49
|
+
},
|
|
50
|
+
"homepage": "https://github.com/asamassekou10/ship-safe#readme",
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=18.0.0"
|
|
53
|
+
},
|
|
54
|
+
"files": [
|
|
55
|
+
"cli/",
|
|
56
|
+
"!cli/__tests__/",
|
|
57
|
+
"checklists/",
|
|
58
|
+
"configs/",
|
|
59
|
+
"snippets/",
|
|
60
|
+
"ai-defense/"
|
|
61
|
+
],
|
|
62
|
+
"dependencies": {
|
|
63
|
+
"chalk": "^5.3.0",
|
|
64
|
+
"commander": "^12.1.0",
|
|
65
|
+
"fast-glob": "^3.3.3",
|
|
66
|
+
"ora": "^8.0.1",
|
|
67
|
+
"write-file-atomic": "^7.0.0"
|
|
68
|
+
}
|
|
69
|
+
}
|