ship-safe 4.1.0 → 4.3.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 +65 -16
- package/cli/__tests__/agents.test.js +722 -0
- package/cli/agents/api-fuzzer.js +345 -224
- package/cli/agents/auth-bypass-agent.js +348 -326
- package/cli/agents/base-agent.js +262 -253
- package/cli/agents/cicd-scanner.js +201 -200
- package/cli/agents/config-auditor.js +529 -413
- package/cli/agents/git-history-scanner.js +170 -167
- package/cli/agents/html-reporter.js +370 -363
- package/cli/agents/index.js +59 -56
- package/cli/agents/injection-tester.js +455 -401
- package/cli/agents/llm-redteam.js +251 -251
- package/cli/agents/mobile-scanner.js +225 -225
- package/cli/agents/orchestrator.js +263 -157
- package/cli/agents/scoring-engine.js +225 -207
- package/cli/agents/supabase-rls-agent.js +148 -0
- package/cli/agents/supply-chain-agent.js +356 -274
- package/cli/bin/ship-safe.js +29 -1
- package/cli/commands/audit.js +875 -620
- package/cli/commands/baseline.js +192 -0
- package/cli/commands/doctor.js +149 -0
- package/cli/commands/remediate.js +7 -3
- package/cli/index.js +60 -53
- package/cli/providers/llm-provider.js +287 -288
- package/cli/utils/autofix-rules.js +74 -0
- package/cli/utils/cache-manager.js +311 -258
- package/cli/utils/pdf-generator.js +94 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -9,13 +9,14 @@
|
|
|
9
9
|
<a href="https://github.com/asamassekou10/ship-safe/actions/workflows/ci.yml"><img src="https://github.com/asamassekou10/ship-safe/actions/workflows/ci.yml/badge.svg" alt="CI" /></a>
|
|
10
10
|
<a href="https://nodejs.org"><img src="https://img.shields.io/node/v/ship-safe" alt="Node.js version" /></a>
|
|
11
11
|
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT" /></a>
|
|
12
|
+
<a href="https://github.com/asamassekou10/ship-safe/stargazers"><img src="https://img.shields.io/github/stars/asamassekou10/ship-safe?style=social" alt="GitHub stars" /></a>
|
|
12
13
|
</p>
|
|
13
14
|
|
|
14
15
|
---
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
13 security agents. 50+ attack classes. One command.
|
|
17
18
|
|
|
18
|
-
**Ship Safe v4.
|
|
19
|
+
**Ship Safe v4.3** is an AI-powered security platform that runs 13 specialized agents in parallel against your codebase — scanning for secrets, injection vulnerabilities, auth bypass, SSRF, supply chain attacks, Supabase RLS misconfigs, Docker/Terraform/Kubernetes misconfigs, CI/CD pipeline poisoning, LLM security issues, and more. Context-aware confidence tuning reduces false positives by up to 70%. Baseline support lets teams adopt incrementally — accept existing debt, focus on not making it worse.
|
|
19
20
|
|
|
20
21
|
---
|
|
21
22
|
|
|
@@ -33,6 +34,13 @@ npx ship-safe scan .
|
|
|
33
34
|
|
|
34
35
|
# Security health score (0-100)
|
|
35
36
|
npx ship-safe score .
|
|
37
|
+
|
|
38
|
+
# Accept current findings, only report regressions
|
|
39
|
+
npx ship-safe baseline .
|
|
40
|
+
npx ship-safe audit . --baseline
|
|
41
|
+
|
|
42
|
+
# Environment diagnostics
|
|
43
|
+
npx ship-safe doctor
|
|
36
44
|
```
|
|
37
45
|
|
|
38
46
|

|
|
@@ -49,11 +57,11 @@ npx ship-safe audit .
|
|
|
49
57
|
|
|
50
58
|
```
|
|
51
59
|
════════════════════════════════════════════════════════════
|
|
52
|
-
Ship Safe v4.
|
|
60
|
+
Ship Safe v4.3 — Full Security Audit
|
|
53
61
|
════════════════════════════════════════════════════════════
|
|
54
62
|
|
|
55
63
|
[Phase 1/4] Scanning for secrets... ✔ 49 found
|
|
56
|
-
[Phase 2/4] Running
|
|
64
|
+
[Phase 2/4] Running 13 security agents... ✔ 103 findings
|
|
57
65
|
[Phase 3/4] Auditing dependencies... ✔ 44 CVEs
|
|
58
66
|
[Phase 4/4] Computing security score... ✔ 25/100 F
|
|
59
67
|
|
|
@@ -80,36 +88,44 @@ npx ship-safe audit .
|
|
|
80
88
|
|
|
81
89
|
**What it runs:**
|
|
82
90
|
1. **Secret scan** — 50+ patterns with entropy scoring (API keys, passwords, tokens)
|
|
83
|
-
2. **
|
|
91
|
+
2. **13 security agents** — run in parallel with per-agent timeouts (injection, auth, SSRF, supply chain, config, Supabase RLS, LLM, mobile, git history, CI/CD, API)
|
|
84
92
|
3. **Dependency audit** — npm/pip/bundler CVE scanning
|
|
85
|
-
4. **Score computation** —
|
|
86
|
-
5. **
|
|
87
|
-
6. **
|
|
93
|
+
4. **Score computation** — confidence-weighted scoring across 8 categories (0-100, A-F)
|
|
94
|
+
5. **Context-aware confidence tuning** — downgrades findings in test files, docs, and comments
|
|
95
|
+
6. **Remediation plan** — prioritized fix list grouped by severity
|
|
96
|
+
7. **HTML report** — standalone dark-themed report with code context
|
|
88
97
|
|
|
89
98
|
**Flags:**
|
|
90
99
|
- `--json` — structured JSON output (clean for piping)
|
|
91
100
|
- `--sarif` — SARIF format for GitHub Code Scanning
|
|
101
|
+
- `--csv` — CSV export for spreadsheets
|
|
102
|
+
- `--md` — Markdown report
|
|
92
103
|
- `--html [file]` — custom HTML report path (default: `ship-safe-report.html`)
|
|
104
|
+
- `--compare` — show per-category score delta vs. last scan
|
|
105
|
+
- `--timeout <ms>` — per-agent timeout (default: 30s)
|
|
93
106
|
- `--no-deps` — skip dependency audit
|
|
94
107
|
- `--no-ai` — skip AI classification
|
|
95
108
|
- `--no-cache` — force full rescan (ignore cached results)
|
|
109
|
+
- `--baseline` — only show findings not in the baseline
|
|
110
|
+
- `--pdf [file]` — generate PDF report (requires Chrome/Chromium)
|
|
96
111
|
|
|
97
112
|
---
|
|
98
113
|
|
|
99
|
-
##
|
|
114
|
+
## 13 Security Agents
|
|
100
115
|
|
|
101
116
|
| Agent | Category | What It Detects |
|
|
102
117
|
|-------|----------|-----------------|
|
|
103
|
-
| **InjectionTester** | Code Vulns | SQL/NoSQL injection, command injection, code injection (eval), XSS, path traversal, XXE, ReDoS, prototype pollution |
|
|
104
|
-
| **AuthBypassAgent** | Auth | JWT vulnerabilities (alg:none, weak secrets), cookie security, CSRF, OAuth misconfig, BOLA/IDOR, weak crypto, timing attacks, TLS bypass |
|
|
118
|
+
| **InjectionTester** | Code Vulns | SQL/NoSQL injection, command injection, code injection (eval), XSS, path traversal, XXE, ReDoS, prototype pollution, Python f-string SQL injection, Python subprocess shell injection |
|
|
119
|
+
| **AuthBypassAgent** | Auth | JWT vulnerabilities (alg:none, weak secrets), cookie security, CSRF, OAuth misconfig, BOLA/IDOR, weak crypto, timing attacks, TLS bypass, Django `DEBUG = True`, Flask hardcoded secret keys |
|
|
105
120
|
| **SSRFProber** | SSRF | User input in fetch/axios, cloud metadata endpoints, internal IPs, redirect following |
|
|
106
|
-
| **SupplyChainAudit** | Supply Chain | Typosquatting (Levenshtein distance), git/URL dependencies, wildcard versions, suspicious install scripts |
|
|
107
|
-
| **ConfigAuditor** | Config | Dockerfile (running as root, :latest tags), Terraform (public S3, open SG), Kubernetes (privileged containers), CORS, CSP, Firebase, Nginx |
|
|
121
|
+
| **SupplyChainAudit** | Supply Chain | Typosquatting (Levenshtein distance), git/URL dependencies, wildcard versions, suspicious install scripts, dependency confusion, scoped packages without registry pinning |
|
|
122
|
+
| **ConfigAuditor** | Config | Dockerfile (running as root, :latest tags), Terraform (public S3/RDS, open SG, CloudFront HTTP, Lambda admin, S3 no versioning), Kubernetes (privileged containers, `:latest` tags, missing NetworkPolicy), CORS, CSP, Firebase, Nginx |
|
|
123
|
+
| **SupabaseRLSAgent** | Auth | Supabase Row Level Security — `service_role` key in client code, `CREATE TABLE` without RLS, anon key inserts, unprotected storage operations |
|
|
108
124
|
| **LLMRedTeam** | AI/LLM | OWASP LLM Top 10 — prompt injection, excessive agency, system prompt leakage, unbounded consumption, RAG poisoning |
|
|
109
125
|
| **MobileScanner** | Mobile | OWASP Mobile Top 10 2024 — insecure storage, WebView JS injection, HTTP endpoints, excessive permissions, debug mode |
|
|
110
126
|
| **GitHistoryScanner** | Secrets | Leaked secrets in git commit history (checks if still active in working tree) |
|
|
111
127
|
| **CICDScanner** | CI/CD | OWASP CI/CD Top 10 — pipeline poisoning, unpinned actions, secret logging, self-hosted runners, script injection |
|
|
112
|
-
| **APIFuzzer** | API | Routes without auth, missing input validation, mass assignment, unrestricted file upload, GraphQL introspection, debug endpoints |
|
|
128
|
+
| **APIFuzzer** | API | Routes without auth, missing input validation, mass assignment, unrestricted file upload, GraphQL introspection, debug endpoints, missing rate limiting, OpenAPI spec security issues |
|
|
113
129
|
| **ReconAgent** | Recon | Attack surface discovery — frameworks, languages, auth patterns, databases, cloud providers, IaC, CI/CD pipelines |
|
|
114
130
|
| **ScoringEngine** | Scoring | 8-category weighted scoring with trend tracking |
|
|
115
131
|
|
|
@@ -123,7 +139,7 @@ npx ship-safe audit .
|
|
|
123
139
|
# Full audit with remediation plan + HTML report
|
|
124
140
|
npx ship-safe audit .
|
|
125
141
|
|
|
126
|
-
# Red team:
|
|
142
|
+
# Red team: 13 agents, 50+ attack classes
|
|
127
143
|
npx ship-safe red-team .
|
|
128
144
|
npx ship-safe red-team . --agents injection,auth # Run specific agents
|
|
129
145
|
npx ship-safe red-team . --html report.html # HTML report
|
|
@@ -150,11 +166,35 @@ npx ship-safe agent .
|
|
|
150
166
|
|
|
151
167
|
# Auto-fix hardcoded secrets: rewrite code + write .env
|
|
152
168
|
npx ship-safe remediate .
|
|
169
|
+
npx ship-safe remediate . --all # Also fix agent findings (TLS, debug, XSS, etc.)
|
|
153
170
|
|
|
154
171
|
# Revoke exposed keys — opens provider dashboards
|
|
155
172
|
npx ship-safe rotate .
|
|
156
173
|
```
|
|
157
174
|
|
|
175
|
+
### Baseline Management
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
# Accept current findings as baseline
|
|
179
|
+
npx ship-safe baseline .
|
|
180
|
+
|
|
181
|
+
# Audit showing only new findings since baseline
|
|
182
|
+
npx ship-safe audit . --baseline
|
|
183
|
+
|
|
184
|
+
# Show what changed since baseline
|
|
185
|
+
npx ship-safe baseline --diff
|
|
186
|
+
|
|
187
|
+
# Remove baseline
|
|
188
|
+
npx ship-safe baseline --clear
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Diagnostics
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
# Environment check — Node.js, git, npm, API keys, cache, version
|
|
195
|
+
npx ship-safe doctor
|
|
196
|
+
```
|
|
197
|
+
|
|
158
198
|
### Infrastructure Commands
|
|
159
199
|
|
|
160
200
|
```bash
|
|
@@ -214,6 +254,10 @@ Ship Safe caches file hashes and findings in `.ship-safe/context.json`. On subse
|
|
|
214
254
|
|
|
215
255
|
The cache is stored in `.ship-safe/` which is automatically excluded from scans.
|
|
216
256
|
|
|
257
|
+
### LLM Response Caching
|
|
258
|
+
|
|
259
|
+
When using AI classification (`--no-ai` to disable), results are cached in `.ship-safe/llm-cache.json` with a 7-day TTL. Repeated scans reuse cached classifications — reducing API costs significantly.
|
|
260
|
+
|
|
217
261
|
---
|
|
218
262
|
|
|
219
263
|
## Smart `.gitignore` Handling
|
|
@@ -247,7 +291,7 @@ Auto-detected from environment variables. No API key required for scanning — A
|
|
|
247
291
|
|
|
248
292
|
## Scoring System
|
|
249
293
|
|
|
250
|
-
Starts at 100. Each finding deducts points by severity and category.
|
|
294
|
+
Starts at 100. Each finding deducts points by severity and category, weighted by confidence level (high: 100%, medium: 60%, low: 30%) to reduce noise from heuristic patterns.
|
|
251
295
|
|
|
252
296
|
**8 Categories** (with weight caps):
|
|
253
297
|
|
|
@@ -306,6 +350,9 @@ jobs:
|
|
|
306
350
|
- name: Full security audit
|
|
307
351
|
run: npx ship-safe audit . --no-ai --json
|
|
308
352
|
|
|
353
|
+
- name: Score delta vs. last scan
|
|
354
|
+
run: npx ship-safe audit . --no-ai --compare
|
|
355
|
+
|
|
309
356
|
- name: Upload SARIF to GitHub Security tab
|
|
310
357
|
run: npx ship-safe audit . --no-ai --sarif > results.sarif
|
|
311
358
|
|
|
@@ -314,6 +361,8 @@ jobs:
|
|
|
314
361
|
sarif_file: results.sarif
|
|
315
362
|
```
|
|
316
363
|
|
|
364
|
+
**Export formats:** `--json`, `--sarif`, `--csv`, `--md`, `--html`, `--pdf`
|
|
365
|
+
|
|
317
366
|
---
|
|
318
367
|
|
|
319
368
|
## Suppress False Positives
|