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.
Files changed (48) hide show
  1. package/README.md +735 -594
  2. package/cli/agents/api-fuzzer.js +345 -345
  3. package/cli/agents/auth-bypass-agent.js +348 -348
  4. package/cli/agents/base-agent.js +272 -272
  5. package/cli/agents/cicd-scanner.js +236 -201
  6. package/cli/agents/config-auditor.js +521 -521
  7. package/cli/agents/deep-analyzer.js +6 -2
  8. package/cli/agents/git-history-scanner.js +170 -170
  9. package/cli/agents/html-reporter.js +40 -4
  10. package/cli/agents/index.js +84 -84
  11. package/cli/agents/injection-tester.js +500 -500
  12. package/cli/agents/llm-redteam.js +251 -251
  13. package/cli/agents/mobile-scanner.js +231 -231
  14. package/cli/agents/orchestrator.js +322 -322
  15. package/cli/agents/pii-compliance-agent.js +301 -301
  16. package/cli/agents/scoring-engine.js +248 -248
  17. package/cli/agents/supabase-rls-agent.js +154 -154
  18. package/cli/agents/supply-chain-agent.js +650 -507
  19. package/cli/bin/ship-safe.js +452 -426
  20. package/cli/commands/agent.js +608 -608
  21. package/cli/commands/audit.js +986 -979
  22. package/cli/commands/baseline.js +193 -193
  23. package/cli/commands/ci.js +342 -342
  24. package/cli/commands/deps.js +516 -516
  25. package/cli/commands/doctor.js +159 -159
  26. package/cli/commands/fix.js +218 -218
  27. package/cli/commands/hooks.js +268 -0
  28. package/cli/commands/init.js +407 -407
  29. package/cli/commands/mcp.js +304 -304
  30. package/cli/commands/red-team.js +7 -1
  31. package/cli/commands/remediate.js +798 -798
  32. package/cli/commands/rotate.js +571 -571
  33. package/cli/commands/scan.js +569 -567
  34. package/cli/commands/score.js +449 -448
  35. package/cli/commands/watch.js +281 -281
  36. package/cli/hooks/patterns.js +313 -0
  37. package/cli/hooks/post-tool-use.js +140 -0
  38. package/cli/hooks/pre-tool-use.js +186 -0
  39. package/cli/index.js +73 -69
  40. package/cli/providers/llm-provider.js +397 -287
  41. package/cli/utils/autofix-rules.js +74 -74
  42. package/cli/utils/cache-manager.js +311 -311
  43. package/cli/utils/output.js +1 -0
  44. package/cli/utils/patterns.js +1121 -1121
  45. package/cli/utils/pdf-generator.js +94 -94
  46. package/package.json +69 -68
  47. package/cli/__tests__/agents.test.js +0 -1301
  48. package/configs/supabase/rls-templates.sql +0 -242
package/README.md CHANGED
@@ -1,594 +1,735 @@
1
- <p align="center">
2
- <img src=".github/assets/logo%20ship%20safe.png" alt="Ship Safe Logo" width="180" />
3
- </p>
4
- <p align="center"><strong>AI-powered application security platform for developers.</strong></p>
5
- <p align="center"><a href="https://shipsafecli.com">shipsafecli.com</a></p>
6
-
7
- <p align="center">
8
- <a href="https://www.npmjs.com/package/ship-safe"><img src="https://badge.fury.io/js/ship-safe.svg" alt="npm version" /></a>
9
- <a href="https://www.npmjs.com/package/ship-safe"><img src="https://img.shields.io/npm/dm/ship-safe.svg" alt="npm downloads" /></a>
10
- <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>
11
- <a href="https://nodejs.org"><img src="https://img.shields.io/node/v/ship-safe" alt="Node.js version" /></a>
12
- <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT" /></a>
13
- <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>
14
- </p>
15
-
16
- ---
17
-
18
- 18 security agents. 80+ attack classes. One command.
19
-
20
- **Ship Safe v6.1** is an AI-powered security platform that runs 18 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/agentic AI security, MCP server misuse, RAG poisoning, PII compliance, vibe coding patterns, exception handling, AI agent config security, and more. OWASP 2025 scoring with EPSS exploit probability. LLM-powered deep analysis verifies exploitability of critical findings. Secrets verification probes provider APIs to check if leaked keys are still active. Compliance mapping to SOC 2, ISO 27001, and NIST AI RMF. Built-in threat intelligence feed with offline-first IOC matching. CI integration with GitHub PR comments, threshold gating, and SARIF output.
21
-
22
- ---
23
-
24
- ## Quick Start
25
-
26
- ```bash
27
- # Full security audit — secrets + 18 agents + deps + remediation plan
28
- npx ship-safe audit .
29
-
30
- # LLM-powered deep analysis (Anthropic, OpenAI, Google, Ollama)
31
- npx ship-safe audit . --deep
32
-
33
- # Red team scan only (18 agents, 80+ attack classes)
34
- npx ship-safe red-team .
35
-
36
- # Scan only changed files (fast pre-commit & PR scanning)
37
- npx ship-safe diff
38
- npx ship-safe diff --staged
39
-
40
- # Fun emoji security grade with shareable badge
41
- npx ship-safe vibe-check .
42
-
43
- # Compare your score against industry averages
44
- npx ship-safe benchmark .
45
-
46
- # Quick secret scan
47
- npx ship-safe scan .
48
-
49
- # Security health score (0-100)
50
- npx ship-safe score .
51
-
52
- # CI/CD pipeline mode — compact output, exit codes, PR comments
53
- npx ship-safe ci .
54
- npx ship-safe ci . --github-pr
55
-
56
- # Accept current findings, only report regressions
57
- npx ship-safe baseline .
58
- npx ship-safe audit . --baseline
59
-
60
- # Check if leaked secrets are still active
61
- npx ship-safe audit . --verify
62
-
63
- # Environment diagnostics
64
- npx ship-safe doctor
65
- ```
66
-
67
- ![ship-safe terminal demo](.github/assets/ship%20safe%20terminal.jpg)
68
-
69
- ---
70
-
71
- ## The `audit` Command
72
-
73
- One command that runs everything and generates a full report:
74
-
75
- ```bash
76
- npx ship-safe audit .
77
- ```
78
-
79
- ```
80
- ════════════════════════════════════════════════════════════
81
- Ship Safe v6.0 — Full Security Audit
82
- ════════════════════════════════════════════════════════════
83
-
84
- [Phase 1/4] Scanning for secrets... ✔ 49 found
85
- [Phase 2/4] Running 18 security agents... ✔ 103 findings
86
- [Phase 3/4] Auditing dependencies... ✔ 44 CVEs
87
- [Phase 4/4] Computing security score... ✔ 25/100 F
88
-
89
- Remediation Plan
90
- ════════════════════════════════════════════════════════
91
-
92
- 🔴 CRITICAL — fix immediately
93
- ────────────────────────────────────────────────────────
94
- 1. [SECRETS] Rotate Stripe Live Secret Key
95
- .env:67 Move to environment variable or secrets manager
96
-
97
- 2. [INJECTION] Unsafe pickle.loads()
98
- backend/ai_processor.py:64 → Use JSON for untrusted data
99
-
100
- 🟠 HIGH — fix before deploy
101
- ────────────────────────────────────────────────────────
102
- 3. [XSS] dangerouslySetInnerHTML without sanitization
103
- frontend/src/utils/blogContentRenderer.jsx:50 Add DOMPurify
104
-
105
- ... 149 more items in the full report
106
-
107
- 📊 Full report: ship-safe-report.html
108
- ```
109
-
110
- **What it runs:**
111
- 1. **Secret scan** 50+ patterns with entropy scoring (API keys, passwords, tokens)
112
- 2. **18 security agents** — run in parallel with per-agent timeouts and framework-aware filtering (injection, auth, SSRF, supply chain, config, Supabase RLS, LLM, MCP, agentic AI, RAG, PII, vibe coding, exception handling, agent config, mobile, git history, CI/CD, API)
113
- 3. **Dependency audit** — npm/pip/bundler CVE scanning with EPSS exploit probability scores
114
- 4. **Secrets verification** probes provider APIs (GitHub, Stripe, OpenAI, etc.) to check if leaked keys are still active
115
- 5. **Deep analysis** — LLM-powered taint analysis verifies exploitability of critical/high findings (optional)
116
- 6. **Score computation** — OWASP 2025 weighted scoring across 8 categories (0-100, A-F)
117
- 7. **Context-aware confidence tuning** — downgrades findings in test files, docs, and comments
118
- 8. **Compliance mapping** — maps findings to SOC 2 Type II, ISO 27001:2022, and NIST AI Risk Management Framework controls
119
- 9. **Remediation plan** — prioritized fix list grouped by severity
120
- 10. **Interactive HTML report** — standalone dark-themed report with severity filtering, search, collapsible findings, compliance summary, and click-to-copy ignore annotations
121
-
122
- **Flags:**
123
- - `--json`structured JSON output (clean for piping)
124
- - `--sarif`SARIF format for GitHub Code Scanning
125
- - `--csv`CSV export for spreadsheets
126
- - `--md`Markdown report
127
- - `--html [file]`custom HTML report path (default: `ship-safe-report.html`)
128
- - `--compare`show per-category score delta vs. last scan
129
- - `--timeout <ms>`per-agent timeout (default: 30s)
130
- - `--no-deps` — skip dependency audit
131
- - `--no-ai` — skip AI classification
132
- - `--no-cache` — force full rescan (ignore cached results)
133
- - `--baseline` — only show findings not in the baseline
134
- - `--pdf [file]` — generate PDF report (requires Chrome/Chromium)
135
- - `--deep` — LLM-powered taint analysis for critical/high findings
136
- - `--local` — use local Ollama model for deep analysis
137
- - `--model <model>` LLM model to use for deep/AI analysis
138
- - `--budget <cents>` — max spend in cents for deep analysis (default: 50)
139
- - `--verify` — check if leaked secrets are still active (probes provider APIs)
140
-
141
- ---
142
-
143
- ## 18 Security Agents
144
-
145
- | Agent | Category | What It Detects |
146
- |-------|----------|-----------------|
147
- | **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 |
148
- | **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 |
149
- | **SSRFProber** | SSRF | User input in fetch/axios, cloud metadata endpoints, internal IPs, redirect following |
150
- | **SupplyChainAudit** | Supply Chain | Typosquatting (Levenshtein distance), git/URL dependencies, wildcard versions, suspicious install scripts, dependency confusion, lockfile integrity |
151
- | **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 |
152
- | **SupabaseRLSAgent** | Auth | Supabase Row Level Security — `service_role` key in client code, `CREATE TABLE` without RLS, anon key inserts, unprotected storage operations |
153
- | **LLMRedTeam** | AI/LLM | OWASP LLM Top 10 — prompt injection, excessive agency, system prompt leakage, unbounded consumption, RAG poisoning |
154
- | **MCPSecurityAgent** | AI/LLM | MCP server security — unvalidated tool inputs, missing auth, excessive permissions, tool poisoning, typosquatting detection, over-permissioned tools, shadow config discovery |
155
- | **AgenticSecurityAgent** | AI/LLM | OWASP Agentic AI Top 10 — agent hijacking, privilege escalation, unsafe code execution, memory poisoning |
156
- | **RAGSecurityAgent** | AI/LLM | RAG pipeline security — unvalidated embeddings, context injection, document poisoning, vector DB access control |
157
- | **PIIComplianceAgent** | Compliance | PII detection — SSNs, credit cards, emails, phone numbers in source code, logs, and configs |
158
- | **VibeCodingAgent** | Code Vulns | AI-generated code patterns no input validation, empty catch blocks, hardcoded secrets, disabled security features, TODO-auth patterns |
159
- | **ExceptionHandlerAgent** | Code Vulns | OWASP A10:2025 empty catch blocks, unhandled promise rejections, missing React error boundaries, leaked stack traces, generic catch-all without rethrow |
160
- | **AgentConfigScanner** | AI/LLM | AI agent config security — prompt injection in .cursorrules/CLAUDE.md/AGENTS.md/.windsurfrules, malicious Claude Code hooks (CVE-2026), OpenClaw public binding & malicious skills, encoded/obfuscated payloads, data exfiltration instructions, agent memory poisoning |
161
- | **MobileScanner** | Mobile | OWASP Mobile Top 10 2024 insecure storage, WebView JS injection, HTTP endpoints, excessive permissions, debug mode |
162
- | **GitHistoryScanner** | Secrets | Leaked secrets in git commit history (checks if still active in working tree) |
163
- | **CICDScanner** | CI/CD | OWASP CI/CD Top 10pipeline poisoning, unpinned actions, secret logging, self-hosted runners, script injection |
164
- | **APIFuzzer** | API | Routes without auth, missing input validation, mass assignment, unrestricted file upload, GraphQL introspection, debug endpoints, missing rate limiting, OpenAPI spec security issues |
165
- | **ReconAgent** | Recon | Attack surface discoveryframeworks, languages, auth patterns, databases, cloud providers, IaC, CI/CD pipelines |
166
-
167
- **Post-processors:** ScoringEngine (8-category weighted scoring), VerifierAgent (secrets liveness verification), DeepAnalyzer (LLM-powered taint analysis)
168
-
169
- ---
170
-
171
- ## All Commands
172
-
173
- ### Core Audit Commands
174
-
175
- ```bash
176
- # Full audit with remediation plan + HTML report
177
- npx ship-safe audit .
178
-
179
- # Red team: 18 agents, 80+ attack classes
180
- npx ship-safe red-team .
181
- npx ship-safe red-team . --agents injection,auth # Run specific agents
182
- npx ship-safe red-team . --html report.html # HTML report
183
- npx ship-safe red-team . --json # JSON output
184
-
185
- # Secret scanner (pattern matching + entropy)
186
- npx ship-safe scan .
187
- npx ship-safe scan . --json # JSON for CI
188
- npx ship-safe scan . --sarif # SARIF for GitHub
189
-
190
- # Security health score (0-100, A-F)
191
- npx ship-safe score .
192
-
193
- # Dependency CVE audit
194
- npx ship-safe deps .
195
- npx ship-safe deps . --fix # Auto-fix vulnerabilities
196
- ```
197
-
198
- ### AI-Powered Commands
199
-
200
- ```bash
201
- # AI audit: scan + classify with Claude + auto-fix secrets
202
- npx ship-safe agent .
203
-
204
- # Auto-fix hardcoded secrets: rewrite code + write .env
205
- npx ship-safe remediate .
206
- npx ship-safe remediate . --all # Also fix agent findings (TLS, debug, XSS, etc.)
207
-
208
- # Revoke exposed keys — opens provider dashboards
209
- npx ship-safe rotate .
210
- ```
211
-
212
- ### Baseline Management
213
-
214
- ```bash
215
- # Accept current findings as baseline
216
- npx ship-safe baseline .
217
-
218
- # Audit showing only new findings since baseline
219
- npx ship-safe audit . --baseline
220
-
221
- # Show what changed since baseline
222
- npx ship-safe baseline --diff
223
-
224
- # Remove baseline
225
- npx ship-safe baseline --clear
226
- ```
227
-
228
- ### Diff Scanning
229
-
230
- ```bash
231
- # Scan only changed files (fast pre-commit & PR scanning)
232
- npx ship-safe diff # All uncommitted changes
233
- npx ship-safe diff --staged # Only staged changes
234
- npx ship-safe diff HEAD~3 # Changes in last 3 commits
235
- npx ship-safe diff --json # JSON output
236
- ```
237
-
238
- ### Vibe Check & Benchmark
239
-
240
- ```bash
241
- # Fun emoji security grade
242
- npx ship-safe vibe-check .
243
- npx ship-safe vibe-check . --badge # Generate shields.io README badge
244
-
245
- # Compare your score against industry averages (OWASP, Synopsys, Snyk)
246
- npx ship-safe benchmark .
247
- npx ship-safe benchmark . --json # JSON output
248
- ```
249
-
250
- ### CI/CD Pipeline
251
-
252
- ```bash
253
- # CI mode — compact output, exit codes, threshold gating
254
- npx ship-safe ci .
255
- npx ship-safe ci . --threshold 80 # Custom passing score
256
- npx ship-safe ci . --fail-on critical # Fail on severity
257
- npx ship-safe ci . --sarif out.sarif # SARIF for GitHub
258
- npx ship-safe ci . --github-pr # Post results as PR comment
259
- ```
260
-
261
- ### Deep Analysis & Verification
262
-
263
- ```bash
264
- # LLM-powered deep analysis (Anthropic/OpenAI/Google/Ollama)
265
- npx ship-safe audit . --deep
266
- npx ship-safe audit . --deep --local # Use local Ollama
267
- npx ship-safe audit . --deep --budget 50 # Cap spend at 50 cents
268
-
269
- # Check if leaked secrets are still active
270
- npx ship-safe audit . --verify
271
- ```
272
-
273
- ### Diagnostics
274
-
275
- ```bash
276
- # Environment check — Node.js, git, npm, API keys, cache, version
277
- npx ship-safe doctor
278
- ```
279
-
280
- ### OpenClaw Security
281
-
282
- ```bash
283
- # Focused OpenClaw security scan
284
- npx ship-safe openclaw .
285
-
286
- # Auto-harden OpenClaw configs (0.0.0.0→127.0.0.1, add auth, ws→wss)
287
- npx ship-safe openclaw . --fix
288
-
289
- # Red team: simulate ClawJacked, prompt injection, data exfil attacks
290
- npx ship-safe openclaw . --red-team
291
-
292
- # CI preflight — exit non-zero on critical findings
293
- npx ship-safe openclaw . --preflight
294
-
295
- # Scan a skill before installing it
296
- npx ship-safe scan-skill https://clawhub.io/skills/some-skill
297
- npx ship-safe scan-skill ./local-skill.json
298
- npx ship-safe scan-skill --all # Scan all skills from openclaw.json
299
-
300
- # Generate hardened OpenClaw config
301
- npx ship-safe init --openclaw
302
-
303
- # Generate Agent Bill of Materials (CycloneDX 1.5)
304
- npx ship-safe abom .
305
- ```
306
-
307
- ### Threat Intelligence
308
-
309
- ```bash
310
- # Update threat intel feed (ClawHavoc IOCs, malicious skills, config signatures)
311
- npx ship-safe update-intel
312
-
313
- # Ships with offline-first seed data no internet required for scanning
314
- ```
315
-
316
- ### Defensive Hooks
317
-
318
- ```bash
319
- # Install Claude Code defensive hooks (blocks curl|bash, exfil domains, rm -rf /)
320
- npx ship-safe guard --generate-hooks
321
-
322
- # Watch agent config files for drift (.cursorrules, CLAUDE.md, openclaw.json)
323
- npx ship-safe watch . --configs
324
- ```
325
-
326
- ### Infrastructure Commands
327
-
328
- ```bash
329
- # Continuous monitoring (watch files for changes)
330
- npx ship-safe watch .
331
-
332
- # Generate CycloneDX SBOM
333
- npx ship-safe sbom .
334
-
335
- # Policy-as-code (enforce minimum score, fail on severity)
336
- npx ship-safe policy init
337
-
338
- # Block git push if secrets found
339
- npx ship-safe guard
340
-
341
- # Initialize security configs (.gitignore, headers)
342
- npx ship-safe init
343
-
344
- # Launch-day security checklist
345
- npx ship-safe checklist
346
-
347
- # MCP server for AI editors (Claude Desktop, Cursor, etc.)
348
- npx ship-safe mcp
349
- ```
350
-
351
- ---
352
-
353
- ## Claude Code Plugin
354
-
355
- Use Ship Safe directly inside Claude Code — no CLI needed:
356
-
357
- ```bash
358
- claude plugin add github:asamassekou10/ship-safe
359
- ```
360
-
361
- | Command | Description |
362
- |---------|-------------|
363
- | `/ship-safe` | Full security audit — 18 agents, remediation plan, auto-fix |
364
- | `/ship-safe-scan` | Quick scan for leaked secrets |
365
- | `/ship-safe-score` | Security health score (0-100) |
366
- | `/ship-safe-deep` | LLM-powered deep taint analysis |
367
- | `/ship-safe-ci` | CI/CD pipeline setup guide |
368
-
369
- Claude interprets the results, explains findings in plain language, and can fix issues directly in your codebase.
370
-
371
- ---
372
-
373
- ## Incremental Scanning
374
-
375
- Ship Safe caches file hashes and findings in `.ship-safe/context.json`. On subsequent runs, only changed files are re-scanned — unchanged files reuse cached results.
376
-
377
- ```
378
- [Phase 1/4] Secrets: 41 found (0 changed, 313 cached)
379
- ```
380
-
381
- - **~40% faster** on repeated scans
382
- - **Auto-invalidation** cache expires after 24 hours or when ship-safe updates
383
- - **`--no-cache`** — force a full rescan anytime
384
-
385
- The cache is stored in `.ship-safe/` which is automatically excluded from scans.
386
-
387
- ### LLM Response Caching
388
-
389
- 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.
390
-
391
- ---
392
-
393
- ## Smart `.gitignore` Handling
394
-
395
- Ship Safe respects your `.gitignore` for build output, caches, and vendor directories — but **always scans security-sensitive files** even if gitignored:
396
-
397
- | Skipped (gitignore respected) | Always scanned (gitignore overridden) |
398
- |-------------------------------|---------------------------------------|
399
- | `node_modules/`, `dist/`, `build/` | `.env`, `.env.local`, `.env.production` |
400
- | `*.log`, `*.pkl`, vendor dirs | `*.pem`, `*.key`, `*.p12` |
401
- | Cache directories, IDE files | `credentials.json`, `*.secret` |
402
-
403
- Why? Files like `.env` are gitignored *because* they contain secrets — which is exactly what a security scanner should catch.
404
-
405
- ---
406
-
407
- ## Multi-LLM Support
408
-
409
- Ship Safe supports multiple AI providers for classification:
410
-
411
- | Provider | Env Variable | Model |
412
- |----------|-------------|-------|
413
- | **Anthropic** | `ANTHROPIC_API_KEY` | claude-haiku-4-5 |
414
- | **OpenAI** | `OPENAI_API_KEY` | gpt-4o-mini |
415
- | **Google** | `GOOGLE_AI_API_KEY` | gemini-2.0-flash |
416
- | **Ollama** | `OLLAMA_HOST` | Local models |
417
-
418
- Auto-detected from environment variables. No API key required for scanning — AI is optional.
419
-
420
- ---
421
-
422
- ## Scoring System
423
-
424
- 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.
425
-
426
- **8 Categories** (with weight caps):
427
-
428
- | Category | Weight | Critical | High | Medium | Cap |
429
- |----------|--------|----------|------|--------|-----|
430
- | Secrets | 15% | -25 | -15 | -5 | -15 |
431
- | Code Vulnerabilities | 15% | -20 | -10 | -3 | -15 |
432
- | Dependencies | 13% | -20 | -10 | -5 | -13 |
433
- | Auth & Access Control | 15% | -20 | -10 | -3 | -15 |
434
- | Configuration | 8% | -15 | -8 | -3 | -8 |
435
- | Supply Chain | 12% | -15 | -8 | -3 | -12 |
436
- | API Security | 10% | -15 | -8 | -3 | -10 |
437
- | AI/LLM Security | 12% | -15 | -8 | -3 | -12 |
438
-
439
- *Weights aligned with OWASP Top 10 2025 risk rankings.*
440
-
441
- **Grades:** A (90-100), B (75-89), C (60-74), D (40-59), F (0-39)
442
-
443
- **Exit codes:** `0` for A/B (>= 75), `1` for C/D/F — use in CI to fail builds.
444
-
445
- ---
446
-
447
- ## Policy-as-Code
448
-
449
- Create `.ship-safe.policy.json` to enforce team-wide security standards:
450
-
451
- ```bash
452
- npx ship-safe policy init
453
- ```
454
-
455
- ```json
456
- {
457
- "minimumScore": 70,
458
- "failOn": "critical",
459
- "requiredScans": ["secrets", "injection", "deps", "auth"],
460
- "ignoreRules": [],
461
- "customSeverityOverrides": {},
462
- "maxAge": { "criticalCVE": "7d", "highCVE": "30d", "mediumCVE": "90d" }
463
- }
464
- ```
465
-
466
- ---
467
-
468
- ## CI/CD Integration
469
-
470
- The dedicated `ci` command is optimized for pipelines — compact output, exit codes, threshold-based gating:
471
-
472
- ```bash
473
- # Basic CI fail if score < 75
474
- npx ship-safe ci .
475
-
476
- # Strict — fail on any critical finding
477
- npx ship-safe ci . --fail-on critical
478
-
479
- # Custom threshold + SARIF for GitHub Security tab
480
- npx ship-safe ci . --threshold 80 --sarif results.sarif
481
-
482
- # Only check new findings (not in baseline)
483
- npx ship-safe ci . --baseline
484
- ```
485
-
486
- **GitHub Actions example:**
487
-
488
- ```yaml
489
- # .github/workflows/security.yml
490
- name: Security Audit
491
-
492
- on: [push, pull_request]
493
-
494
- jobs:
495
- security:
496
- runs-on: ubuntu-latest
497
- steps:
498
- - uses: actions/checkout@v4
499
-
500
- - name: Security gate
501
- run: npx ship-safe ci . --threshold 75 --sarif results.sarif --github-pr
502
-
503
- - uses: github/codeql-action/upload-sarif@v3
504
- if: always()
505
- with:
506
- sarif_file: results.sarif
507
- ```
508
-
509
- **Export formats:** `--json`, `--sarif`, `--csv`, `--md`, `--html`, `--pdf`
510
-
511
- ---
512
-
513
- ## Suppress False Positives
514
-
515
- **Inline:** Add `# ship-safe-ignore` comment on a line:
516
- ```python
517
- password = get_password() # ship-safe-ignore
518
- ```
519
-
520
- **File-level:** Create `.ship-safeignore` (gitignore syntax):
521
- ```gitignore
522
- # Exclude test fixtures
523
- tests/fixtures/
524
- *.test.js
525
-
526
- # Exclude documentation with code examples
527
- docs/
528
- ```
529
-
530
- ---
531
-
532
- ## OWASP Coverage
533
-
534
- | Standard | Coverage |
535
- |----------|----------|
536
- | **OWASP Top 10 Web 2025** | A01-A10: Broken Access Control, Cryptographic Failures, Injection, Insecure Design, Security Misconfiguration, Vulnerable Components, Auth Failures, Data Integrity, Logging Failures, SSRF |
537
- | **OWASP Top 10 Mobile 2024** | M1-M10: Improper Credential Usage, Inadequate Supply Chain, Insecure Auth, Insufficient Validation, Insecure Communication, Inadequate Privacy, Binary Protections, Security Misconfiguration, Insecure Data Storage, Insufficient Cryptography |
538
- | **OWASP LLM Top 10 2025** | LLM01-LLM10: Prompt Injection, Sensitive Info Disclosure, Supply Chain, Data Poisoning, Improper Output Handling, Excessive Agency, System Prompt Leakage, Vector/Embedding Weaknesses, Misinformation, Unbounded Consumption |
539
- | **OWASP CI/CD Top 10** | CICD-SEC-1 to 10: Insufficient Flow Control, Identity Management, Dependency Chain Abuse, Poisoned Pipeline Execution, Insufficient PBAC, Credential Hygiene, Insecure System Config, Ungoverned Usage, Improper Artifact Integrity, Insufficient Logging |
540
- | **OWASP Agentic AI Top 10** | ASI01-ASI10: Agent Hijacking, Tool Misuse, Privilege Escalation, Unsafe Code Execution, Memory Poisoning, Identity Spoofing, Excessive Autonomy, Logging Gaps, Supply Chain Attacks, Cascading Hallucination |
541
-
542
- ---
543
-
544
- ## What's Inside
545
-
546
- ### [`/configs`](./configs)
547
- Drop-in security configs for Next.js, Supabase, and Firebase.
548
-
549
- ### [`/snippets`](./snippets)
550
- Copy-paste security patterns: rate limiting, JWT, CORS, input validation.
551
-
552
- ### [`/ai-defense`](./ai-defense)
553
- LLM security: prompt injection detection, cost protection, system prompt hardening.
554
-
555
- ### [`/checklists`](./checklists)
556
- Manual security audits: launch-day checklist, framework-specific guides.
557
-
558
- ---
559
-
560
- ## Contributing
561
-
562
- 1. Fork the repo
563
- 2. Add your security pattern, agent, or config
564
- 3. Include comments explaining *why* it matters
565
- 4. Open a PR
566
-
567
- See [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.
568
-
569
- ---
570
-
571
- ## Security Standards Reference
572
-
573
- - [OWASP Top 10 Web 2025](https://owasp.org/Top10/)
574
- - [OWASP Top 10 Mobile 2024](https://owasp.org/www-project-mobile-top-10/)
575
- - [OWASP LLM Top 10 2025](https://genai.owasp.org/llm-top-10/)
576
- - [OWASP API Security Top 10 2023](https://owasp.org/API-Security/)
577
- - [OWASP CI/CD Top 10](https://owasp.org/www-project-top-10-ci-cd-security-risks/)
578
- - [OWASP Agentic AI Top 10](https://owasp.org/www-project-agentic-ai-top-10/)
579
-
580
- ---
581
-
582
- ## License
583
-
584
- MIT - Use it, share it, secure your stuff.
585
-
586
- ---
587
-
588
- ## Star History
589
-
590
- [![Star History Chart](https://api.star-history.com/svg?repos=asamassekou10/ship-safe&type=Date)](https://star-history.com/#asamassekou10/ship-safe&Date)
591
-
592
- ---
593
-
594
- **Ship fast. Ship safe.** — [shipsafecli.com](https://shipsafecli.com)
1
+ <p align="center">
2
+ <img src=".github/assets/logo%20ship%20safe.png" alt="Ship Safe Logo" width="180" />
3
+ </p>
4
+ <p align="center"><strong>AI-powered application security platform for developers.</strong></p>
5
+ <p align="center"><a href="https://shipsafecli.com">shipsafecli.com</a></p>
6
+
7
+ <p align="center">
8
+ <a href="https://www.npmjs.com/package/ship-safe"><img src="https://badge.fury.io/js/ship-safe.svg" alt="npm version" /></a>
9
+ <a href="https://www.npmjs.com/package/ship-safe"><img src="https://img.shields.io/npm/dm/ship-safe.svg" alt="npm downloads" /></a>
10
+ <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>
11
+ <a href="https://nodejs.org"><img src="https://img.shields.io/node/v/ship-safe" alt="Node.js version" /></a>
12
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT" /></a>
13
+ <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>
14
+ </p>
15
+
16
+ ---
17
+
18
+ 18 security agents. 80+ attack classes. One command.
19
+
20
+ **Ship Safe v6.2.0** is an AI-powered security platform that runs 18 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/agentic AI security, MCP server misuse, RAG poisoning, PII compliance, vibe coding patterns, exception handling, AI agent config security, and more. OWASP 2025 scoring with EPSS exploit probability. LLM-powered deep analysis verifies exploitability of critical findings. Secrets verification probes provider APIs to check if leaked keys are still active. Compliance mapping to SOC 2, ISO 27001, and NIST AI RMF. Built-in threat intelligence feed with offline-first IOC matching. CI integration with GitHub PR comments, threshold gating, and SARIF output.
21
+
22
+ **v6.2.0 highlights:** Real-time Claude Code hooks (`npx ship-safe hooks install`) block secrets before they land on disk. Universal LLM support — use Groq, Together AI, Mistral, DeepSeek, xAI, Perplexity, LM Studio, or any OpenAI-compatible endpoint for deep analysis. Supply chain IOC matching for known-compromised packages and CanisterWorm-style ICP blockchain C2 indicators.
23
+
24
+ [Documentation](https://shipsafecli.com/docs) | [Blog](https://shipsafecli.com/blog) | [Pricing](https://shipsafecli.com/pricing)
25
+
26
+ ---
27
+
28
+ ## Quick Start
29
+
30
+ ```bash
31
+ # Full security audit secrets + 18 agents + deps + remediation plan
32
+ npx ship-safe audit .
33
+
34
+ # LLM-powered deep analysis (Anthropic, OpenAI, Google, Ollama)
35
+ npx ship-safe audit . --deep
36
+
37
+ # Red team scan only (18 agents, 80+ attack classes)
38
+ npx ship-safe red-team .
39
+
40
+ # Scan only changed files (fast pre-commit & PR scanning)
41
+ npx ship-safe diff
42
+ npx ship-safe diff --staged
43
+
44
+ # Fun emoji security grade with shareable badge
45
+ npx ship-safe vibe-check .
46
+
47
+ # Compare your score against industry averages
48
+ npx ship-safe benchmark .
49
+
50
+ # Quick secret scan
51
+ npx ship-safe scan .
52
+
53
+ # Security health score (0-100)
54
+ npx ship-safe score .
55
+
56
+ # CI/CD pipeline mode — compact output, exit codes, PR comments
57
+ npx ship-safe ci .
58
+ npx ship-safe ci . --github-pr
59
+
60
+ # Accept current findings, only report regressions
61
+ npx ship-safe baseline .
62
+ npx ship-safe audit . --baseline
63
+
64
+ # Check if leaked secrets are still active
65
+ npx ship-safe audit . --verify
66
+
67
+ # Environment diagnostics
68
+ npx ship-safe doctor
69
+
70
+ # Install Claude Code hooks — real-time secret blocking + advisory scan
71
+ npx ship-safe hooks install
72
+ npx ship-safe hooks status
73
+ npx ship-safe hooks remove
74
+ ```
75
+
76
+ ![ship-safe terminal demo](.github/assets/ship%20safe%20terminal.jpg)
77
+
78
+ ---
79
+
80
+ ## The `audit` Command
81
+
82
+ One command that runs everything and generates a full report:
83
+
84
+ ```bash
85
+ npx ship-safe audit .
86
+ ```
87
+
88
+ ```
89
+ ════════════════════════════════════════════════════════════
90
+ Ship Safe v6.0 — Full Security Audit
91
+ ════════════════════════════════════════════════════════════
92
+
93
+ [Phase 1/4] Scanning for secrets... ✔ 49 found
94
+ [Phase 2/4] Running 18 security agents... ✔ 103 findings
95
+ [Phase 3/4] Auditing dependencies... ✔ 44 CVEs
96
+ [Phase 4/4] Computing security score... ✔ 25/100 F
97
+
98
+ Remediation Plan
99
+ ════════════════════════════════════════════════════════
100
+
101
+ 🔴 CRITICAL — fix immediately
102
+ ────────────────────────────────────────────────────────
103
+ 1. [SECRETS] Rotate Stripe Live Secret Key
104
+ .env:67 → Move to environment variable or secrets manager
105
+
106
+ 2. [INJECTION] Unsafe pickle.loads()
107
+ backend/ai_processor.py:64 Use JSON for untrusted data
108
+
109
+ 🟠 HIGH — fix before deploy
110
+ ────────────────────────────────────────────────────────
111
+ 3. [XSS] dangerouslySetInnerHTML without sanitization
112
+ frontend/src/utils/blogContentRenderer.jsx:50 Add DOMPurify
113
+
114
+ ... 149 more items in the full report
115
+
116
+ 📊 Full report: ship-safe-report.html
117
+ ```
118
+
119
+ **What it runs:**
120
+ 1. **Secret scan** — 50+ patterns with entropy scoring (API keys, passwords, tokens)
121
+ 2. **18 security agents** — run in parallel with per-agent timeouts and framework-aware filtering (injection, auth, SSRF, supply chain, config, Supabase RLS, LLM, MCP, agentic AI, RAG, PII, vibe coding, exception handling, agent config, mobile, git history, CI/CD, API)
122
+ 3. **Dependency audit** — npm/pip/bundler CVE scanning with EPSS exploit probability scores
123
+ 4. **Secrets verification** probes provider APIs (GitHub, Stripe, OpenAI, etc.) to check if leaked keys are still active
124
+ 5. **Deep analysis** LLM-powered taint analysis verifies exploitability of critical/high findings (optional)
125
+ 6. **Score computation** OWASP 2025 weighted scoring across 8 categories (0-100, A-F)
126
+ 7. **Context-aware confidence tuning** downgrades findings in test files, docs, and comments
127
+ 8. **Compliance mapping**maps findings to SOC 2 Type II, ISO 27001:2022, and NIST AI Risk Management Framework controls
128
+ 9. **Remediation plan** prioritized fix list grouped by severity
129
+ 10. **Interactive HTML report** standalone dark-themed report with severity filtering, search, collapsible findings, compliance summary, and click-to-copy ignore annotations
130
+
131
+ **Flags:**
132
+ - `--json` — structured JSON output (clean for piping)
133
+ - `--sarif` — SARIF format for GitHub Code Scanning
134
+ - `--csv` — CSV export for spreadsheets
135
+ - `--md` — Markdown report
136
+ - `--html [file]` — custom HTML report path (default: `ship-safe-report.html`)
137
+ - `--compare`show per-category score delta vs. last scan
138
+ - `--timeout <ms>` — per-agent timeout (default: 30s)
139
+ - `--no-deps` — skip dependency audit
140
+ - `--no-ai` — skip AI classification
141
+ - `--no-cache` — force full rescan (ignore cached results)
142
+ - `--baseline` — only show findings not in the baseline
143
+ - `--pdf [file]` — generate PDF report (requires Chrome/Chromium)
144
+ - `--deep` — LLM-powered taint analysis for critical/high findings
145
+ - `--local` use local Ollama model for deep analysis
146
+ - `--model <model>` — LLM model to use for deep/AI analysis
147
+ - `--provider <name>` LLM provider: groq, together, mistral, deepseek, xai, perplexity, lmstudio
148
+ - `--base-url <url>` custom OpenAI-compatible base URL (e.g. LM Studio, vLLM)
149
+ - `--budget <cents>` max spend in cents for deep analysis (default: 50)
150
+ - `--verify` check if leaked secrets are still active (probes provider APIs)
151
+
152
+ ---
153
+
154
+ ## 18 Security Agents
155
+
156
+ | Agent | Category | What It Detects |
157
+ |-------|----------|-----------------|
158
+ | **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 |
159
+ | **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 |
160
+ | **SSRFProber** | SSRF | User input in fetch/axios, cloud metadata endpoints, internal IPs, redirect following |
161
+ | **SupplyChainAudit** | Supply Chain | Typosquatting (Levenshtein distance), git/URL dependencies, wildcard versions, suspicious install scripts, dependency confusion, lockfile integrity |
162
+ | **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 |
163
+ | **SupabaseRLSAgent** | Auth | Supabase Row Level Security`service_role` key in client code, `CREATE TABLE` without RLS, anon key inserts, unprotected storage operations |
164
+ | **LLMRedTeam** | AI/LLM | OWASP LLM Top 10 prompt injection, excessive agency, system prompt leakage, unbounded consumption, RAG poisoning |
165
+ | **MCPSecurityAgent** | AI/LLM | MCP server securityunvalidated tool inputs, missing auth, excessive permissions, tool poisoning, typosquatting detection, over-permissioned tools, shadow config discovery |
166
+ | **AgenticSecurityAgent** | AI/LLM | OWASP Agentic AI Top 10 — agent hijacking, privilege escalation, unsafe code execution, memory poisoning |
167
+ | **RAGSecurityAgent** | AI/LLM | RAG pipeline security — unvalidated embeddings, context injection, document poisoning, vector DB access control |
168
+ | **PIIComplianceAgent** | Compliance | PII detection — SSNs, credit cards, emails, phone numbers in source code, logs, and configs |
169
+ | **VibeCodingAgent** | Code Vulns | AI-generated code patterns — no input validation, empty catch blocks, hardcoded secrets, disabled security features, TODO-auth patterns |
170
+ | **ExceptionHandlerAgent** | Code Vulns | OWASP A10:2025 — empty catch blocks, unhandled promise rejections, missing React error boundaries, leaked stack traces, generic catch-all without rethrow |
171
+ | **AgentConfigScanner** | AI/LLM | AI agent config security — prompt injection in .cursorrules/CLAUDE.md/AGENTS.md/.windsurfrules, malicious Claude Code hooks (CVE-2026), OpenClaw public binding & malicious skills, encoded/obfuscated payloads, data exfiltration instructions, agent memory poisoning |
172
+ | **MobileScanner** | Mobile | OWASP Mobile Top 10 2024 — insecure storage, WebView JS injection, HTTP endpoints, excessive permissions, debug mode |
173
+ | **GitHistoryScanner** | Secrets | Leaked secrets in git commit history (checks if still active in working tree) |
174
+ | **CICDScanner** | CI/CD | OWASP CI/CD Top 10 — pipeline poisoning, unpinned actions, secret logging, self-hosted runners, script injection |
175
+ | **APIFuzzer** | API | Routes without auth, missing input validation, mass assignment, unrestricted file upload, GraphQL introspection, debug endpoints, missing rate limiting, OpenAPI spec security issues |
176
+ | **ReconAgent** | Recon | Attack surface discovery — frameworks, languages, auth patterns, databases, cloud providers, IaC, CI/CD pipelines |
177
+
178
+ **Post-processors:** ScoringEngine (8-category weighted scoring), VerifierAgent (secrets liveness verification), DeepAnalyzer (LLM-powered taint analysis)
179
+
180
+ ---
181
+
182
+ ## All Commands
183
+
184
+ ### Core Audit Commands
185
+
186
+ ```bash
187
+ # Full audit with remediation plan + HTML report
188
+ npx ship-safe audit .
189
+
190
+ # Red team: 18 agents, 80+ attack classes
191
+ npx ship-safe red-team .
192
+ npx ship-safe red-team . --agents injection,auth # Run specific agents
193
+ npx ship-safe red-team . --html report.html # HTML report
194
+ npx ship-safe red-team . --json # JSON output
195
+
196
+ # Secret scanner (pattern matching + entropy)
197
+ npx ship-safe scan .
198
+ npx ship-safe scan . --json # JSON for CI
199
+ npx ship-safe scan . --sarif # SARIF for GitHub
200
+
201
+ # Security health score (0-100, A-F)
202
+ npx ship-safe score .
203
+
204
+ # Dependency CVE audit
205
+ npx ship-safe deps .
206
+ npx ship-safe deps . --fix # Auto-fix vulnerabilities
207
+ ```
208
+
209
+ ### AI-Powered Commands
210
+
211
+ ```bash
212
+ # AI audit: scan + classify with Claude + auto-fix secrets
213
+ npx ship-safe agent .
214
+
215
+ # Auto-fix hardcoded secrets: rewrite code + write .env
216
+ npx ship-safe remediate .
217
+ npx ship-safe remediate . --all # Also fix agent findings (TLS, debug, XSS, etc.)
218
+
219
+ # Revoke exposed keys — opens provider dashboards
220
+ npx ship-safe rotate .
221
+ ```
222
+
223
+ ### Baseline Management
224
+
225
+ ```bash
226
+ # Accept current findings as baseline
227
+ npx ship-safe baseline .
228
+
229
+ # Audit showing only new findings since baseline
230
+ npx ship-safe audit . --baseline
231
+
232
+ # Show what changed since baseline
233
+ npx ship-safe baseline --diff
234
+
235
+ # Remove baseline
236
+ npx ship-safe baseline --clear
237
+ ```
238
+
239
+ ### Diff Scanning
240
+
241
+ ```bash
242
+ # Scan only changed files (fast pre-commit & PR scanning)
243
+ npx ship-safe diff # All uncommitted changes
244
+ npx ship-safe diff --staged # Only staged changes
245
+ npx ship-safe diff HEAD~3 # Changes in last 3 commits
246
+ npx ship-safe diff --json # JSON output
247
+ ```
248
+
249
+ ### Vibe Check & Benchmark
250
+
251
+ ```bash
252
+ # Fun emoji security grade
253
+ npx ship-safe vibe-check .
254
+ npx ship-safe vibe-check . --badge # Generate shields.io README badge
255
+
256
+ # Compare your score against industry averages (OWASP, Synopsys, Snyk)
257
+ npx ship-safe benchmark .
258
+ npx ship-safe benchmark . --json # JSON output
259
+ ```
260
+
261
+ ### CI/CD Pipeline
262
+
263
+ ```bash
264
+ # CI mode compact output, exit codes, threshold gating
265
+ npx ship-safe ci .
266
+ npx ship-safe ci . --threshold 80 # Custom passing score
267
+ npx ship-safe ci . --fail-on critical # Fail on severity
268
+ npx ship-safe ci . --sarif out.sarif # SARIF for GitHub
269
+ npx ship-safe ci . --github-pr # Post results as PR comment
270
+ ```
271
+
272
+ ### Deep Analysis & Verification
273
+
274
+ ```bash
275
+ # LLM-powered deep analysis (Anthropic/OpenAI/Google/Ollama)
276
+ npx ship-safe audit . --deep
277
+ npx ship-safe audit . --deep --local # Use local Ollama
278
+ npx ship-safe audit . --deep --budget 50 # Cap spend at 50 cents
279
+
280
+ # Use any OpenAI-compatible provider for deep analysis
281
+ npx ship-safe audit . --deep --provider groq
282
+ npx ship-safe audit . --deep --provider together
283
+ npx ship-safe audit . --deep --provider mistral
284
+ npx ship-safe audit . --deep --provider deepseek
285
+ npx ship-safe audit . --deep --provider lmstudio # Local LM Studio
286
+ npx ship-safe audit . --deep --provider xai
287
+ npx ship-safe audit . --deep --provider perplexity
288
+ npx ship-safe audit . --deep --base-url http://localhost:1234/v1 --model my-model # Custom
289
+
290
+ # Check if leaked secrets are still active
291
+ npx ship-safe audit . --verify
292
+ ```
293
+
294
+ ### Diagnostics
295
+
296
+ ```bash
297
+ # Environment check — Node.js, git, npm, API keys, cache, version
298
+ npx ship-safe doctor
299
+ ```
300
+
301
+ ### OpenClaw Security
302
+
303
+ ```bash
304
+ # Focused OpenClaw security scan
305
+ npx ship-safe openclaw .
306
+
307
+ # Auto-harden OpenClaw configs (0.0.0.0→127.0.0.1, add auth, ws→wss)
308
+ npx ship-safe openclaw . --fix
309
+
310
+ # Red team: simulate ClawJacked, prompt injection, data exfil attacks
311
+ npx ship-safe openclaw . --red-team
312
+
313
+ # CI preflightexit non-zero on critical findings
314
+ npx ship-safe openclaw . --preflight
315
+
316
+ # Scan a skill before installing it
317
+ npx ship-safe scan-skill https://clawhub.io/skills/some-skill
318
+ npx ship-safe scan-skill ./local-skill.json
319
+ npx ship-safe scan-skill --all # Scan all skills from openclaw.json
320
+
321
+ # Generate hardened OpenClaw config
322
+ npx ship-safe init --openclaw
323
+
324
+ # Generate Agent Bill of Materials (CycloneDX 1.5)
325
+ npx ship-safe abom .
326
+ ```
327
+
328
+ ### Threat Intelligence
329
+
330
+ ```bash
331
+ # Update threat intel feed (ClawHavoc IOCs, malicious skills, config signatures)
332
+ npx ship-safe update-intel
333
+
334
+ # Ships with offline-first seed data — no internet required for scanning
335
+ ```
336
+
337
+ ### OpenClaw GitHub Action
338
+
339
+ Drop-in CI action that blocks PRs introducing agent config vulnerabilities:
340
+
341
+ ```yaml
342
+ # .github/workflows/openclaw-security.yml
343
+ name: OpenClaw Security Check
344
+
345
+ on: [pull_request]
346
+
347
+ permissions:
348
+ contents: read
349
+
350
+ jobs:
351
+ openclaw:
352
+ runs-on: ubuntu-latest
353
+ steps:
354
+ - uses: actions/checkout@v4
355
+
356
+ - uses: asamassekou10/ship-safe/.github/actions/openclaw-check@main
357
+ with:
358
+ fail-on-critical: 'true'
359
+ ```
360
+
361
+ **Inputs:**
362
+
363
+ | Input | Default | Description |
364
+ |-------|---------|-------------|
365
+ | `path` | `.` | Path to scan |
366
+ | `fail-on-critical` | `true` | Fail the check if critical findings are found |
367
+ | `node-version` | `20` | Node.js version to use |
368
+
369
+ **Outputs:**
370
+
371
+ | Output | Description |
372
+ |--------|-------------|
373
+ | `findings` | Total number of findings detected |
374
+ | `critical` | Number of critical findings |
375
+
376
+ Scans `openclaw.json`, `.cursorrules`, `CLAUDE.md`, Claude Code hooks, and MCP configs. Checks against the bundled threat intelligence database for known ClawHavoc IOCs.
377
+
378
+ ### Defensive Hooks
379
+
380
+ ```bash
381
+ # Install Claude Code defensive hooks (blocks curl|bash, exfil domains, rm -rf /)
382
+ npx ship-safe guard --generate-hooks
383
+
384
+ # Watch agent config files for drift (.cursorrules, CLAUDE.md, openclaw.json)
385
+ npx ship-safe watch . --configs
386
+ ```
387
+
388
+ ### Infrastructure Commands
389
+
390
+ ```bash
391
+ # Continuous monitoring (watch files for changes)
392
+ npx ship-safe watch .
393
+
394
+ # Generate CycloneDX SBOM
395
+ npx ship-safe sbom .
396
+
397
+ # Policy-as-code (enforce minimum score, fail on severity)
398
+ npx ship-safe policy init
399
+
400
+ # Block git push if secrets found
401
+ npx ship-safe guard
402
+
403
+ # Initialize security configs (.gitignore, headers)
404
+ npx ship-safe init
405
+
406
+ # Launch-day security checklist
407
+ npx ship-safe checklist
408
+
409
+ # MCP server for AI editors (Claude Desktop, Cursor, etc.)
410
+ npx ship-safe mcp
411
+ ```
412
+
413
+ ---
414
+
415
+ ## Claude Code Hooks
416
+
417
+ Install ship-safe as real-time Claude Code hooks — secrets are blocked **before** they ever touch disk:
418
+
419
+ ```bash
420
+ npx ship-safe hooks install
421
+ ```
422
+
423
+ Once installed, two hooks activate automatically on every Claude Code session:
424
+
425
+ | Hook | Trigger | Behaviour |
426
+ |------|---------|-----------|
427
+ | **PreToolUse** | Write / Edit / MultiEdit / Bash | Blocks the write if critical secrets are detected; blocks dangerous Bash patterns (curl\|bash, credential exfiltration, `rm -rf /`) |
428
+ | **PostToolUse** | Write / Edit / MultiEdit | Scans the saved file and injects advisory findings (high-severity patterns, DB URLs with credentials) directly into Claude's context — never blocks |
429
+
430
+ Hook scripts are copied to `~/.ship-safe/hooks/` at install time a stable, user-owned location that survives `npx` cache rotations.
431
+
432
+ ```bash
433
+ npx ship-safe hooks status # Check installation
434
+ npx ship-safe hooks remove # Uninstall
435
+ ```
436
+
437
+ ---
438
+
439
+ ## Claude Code Plugin
440
+
441
+ Use Ship Safe directly inside Claude Code no CLI needed:
442
+
443
+ ```bash
444
+ claude plugin add github:asamassekou10/ship-safe
445
+ ```
446
+
447
+ | Command | Description |
448
+ |---------|-------------|
449
+ | `/ship-safe` | Full security audit — 18 agents, remediation plan, auto-fix |
450
+ | `/ship-safe-scan` | Quick scan for leaked secrets |
451
+ | `/ship-safe-score` | Security health score (0-100) |
452
+ | `/ship-safe-deep` | LLM-powered deep taint analysis |
453
+ | `/ship-safe-ci` | CI/CD pipeline setup guide |
454
+ | `/ship-safe-hooks` | Install real-time Claude Code hooks (blocks secrets on write) |
455
+ | `/ship-safe-baseline` | Accept current findings as baseline; report only regressions |
456
+ | `/ship-safe-fix` | Auto-fix secrets and common vulnerabilities |
457
+ | `/ship-safe-red-team` | Run full red-team audit and open HTML report |
458
+
459
+ Claude interprets the results, explains findings in plain language, and can fix issues directly in your codebase.
460
+
461
+ ---
462
+
463
+ ## Incremental Scanning
464
+
465
+ Ship Safe caches file hashes and findings in `.ship-safe/context.json`. On subsequent runs, only changed files are re-scanned — unchanged files reuse cached results.
466
+
467
+ ```
468
+ [Phase 1/4] Secrets: 41 found (0 changed, 313 cached)
469
+ ```
470
+
471
+ - **~40% faster** on repeated scans
472
+ - **Auto-invalidation** — cache expires after 24 hours or when ship-safe updates
473
+ - **`--no-cache`**force a full rescan anytime
474
+
475
+ The cache is stored in `.ship-safe/` which is automatically excluded from scans.
476
+
477
+ ### LLM Response Caching
478
+
479
+ 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.
480
+
481
+ ---
482
+
483
+ ## Smart `.gitignore` Handling
484
+
485
+ Ship Safe respects your `.gitignore` for build output, caches, and vendor directories — but **always scans security-sensitive files** even if gitignored:
486
+
487
+ | Skipped (gitignore respected) | Always scanned (gitignore overridden) |
488
+ |-------------------------------|---------------------------------------|
489
+ | `node_modules/`, `dist/`, `build/` | `.env`, `.env.local`, `.env.production` |
490
+ | `*.log`, `*.pkl`, vendor dirs | `*.pem`, `*.key`, `*.p12` |
491
+ | Cache directories, IDE files | `credentials.json`, `*.secret` |
492
+
493
+ Why? Files like `.env` are gitignored *because* they contain secrets — which is exactly what a security scanner should catch.
494
+
495
+ ---
496
+
497
+ ## Multi-LLM Support
498
+
499
+ Ship Safe supports any AI provider for deep analysis and classification:
500
+
501
+ | Provider | Env Variable | Flag | Default Model |
502
+ |----------|-------------|------|---------------|
503
+ | **Anthropic** | `ANTHROPIC_API_KEY` | *(auto-detected)* | claude-haiku-4-5 |
504
+ | **OpenAI** | `OPENAI_API_KEY` | *(auto-detected)* | gpt-4o-mini |
505
+ | **Google** | `GOOGLE_AI_API_KEY` | *(auto-detected)* | gemini-2.0-flash |
506
+ | **Ollama** | `OLLAMA_HOST` | `--local` | Local models |
507
+ | **Groq** | `GROQ_API_KEY` | `--provider groq` | llama-3.3-70b-versatile |
508
+ | **Together AI** | `TOGETHER_API_KEY` | `--provider together` | meta-llama/Llama-3-70b-chat-hf |
509
+ | **Mistral** | `MISTRAL_API_KEY` | `--provider mistral` | mistral-small-latest |
510
+ | **DeepSeek** | `DEEPSEEK_API_KEY` | `--provider deepseek` | deepseek-chat |
511
+ | **xAI (Grok)** | `XAI_API_KEY` | `--provider xai` | grok-beta |
512
+ | **Perplexity** | `PERPLEXITY_API_KEY` | `--provider perplexity` | llama-3.1-sonar-small-128k-online |
513
+ | **LM Studio** | *(none)* | `--provider lmstudio` | Local server |
514
+ | **Custom** | *(any)* | `--base-url <url> --model <model>` | Any OpenAI-compatible |
515
+
516
+ Auto-detected from environment variables. Use `--provider <name>` to override. No API key required for scanning — AI is optional.
517
+
518
+ ---
519
+
520
+ ## Scoring System
521
+
522
+ 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.
523
+
524
+ **8 Categories** (with weight caps):
525
+
526
+ | Category | Weight | Critical | High | Medium | Cap |
527
+ |----------|--------|----------|------|--------|-----|
528
+ | Secrets | 15% | -25 | -15 | -5 | -15 |
529
+ | Code Vulnerabilities | 15% | -20 | -10 | -3 | -15 |
530
+ | Dependencies | 13% | -20 | -10 | -5 | -13 |
531
+ | Auth & Access Control | 15% | -20 | -10 | -3 | -15 |
532
+ | Configuration | 8% | -15 | -8 | -3 | -8 |
533
+ | Supply Chain | 12% | -15 | -8 | -3 | -12 |
534
+ | API Security | 10% | -15 | -8 | -3 | -10 |
535
+ | AI/LLM Security | 12% | -15 | -8 | -3 | -12 |
536
+
537
+ *Weights aligned with OWASP Top 10 2025 risk rankings.*
538
+
539
+ **Grades:** A (90-100), B (75-89), C (60-74), D (40-59), F (0-39)
540
+
541
+ **Exit codes:** `0` for A/B (>= 75), `1` for C/D/F — use in CI to fail builds.
542
+
543
+ ---
544
+
545
+ ## Policy-as-Code
546
+
547
+ Create `.ship-safe.policy.json` to enforce team-wide security standards:
548
+
549
+ ```bash
550
+ npx ship-safe policy init
551
+ ```
552
+
553
+ ```json
554
+ {
555
+ "minimumScore": 70,
556
+ "failOn": "critical",
557
+ "requiredScans": ["secrets", "injection", "deps", "auth"],
558
+ "ignoreRules": [],
559
+ "customSeverityOverrides": {},
560
+ "maxAge": { "criticalCVE": "7d", "highCVE": "30d", "mediumCVE": "90d" }
561
+ }
562
+ ```
563
+
564
+ ---
565
+
566
+ ## CI/CD Integration
567
+
568
+ The dedicated `ci` command is optimized for pipelines — compact output, exit codes, threshold-based gating:
569
+
570
+ ```bash
571
+ # Basic CI — fail if score < 75
572
+ npx ship-safe ci .
573
+
574
+ # Strict fail on any critical finding
575
+ npx ship-safe ci . --fail-on critical
576
+
577
+ # Custom threshold + SARIF for GitHub Security tab
578
+ npx ship-safe ci . --threshold 80 --sarif results.sarif
579
+
580
+ # Only check new findings (not in baseline)
581
+ npx ship-safe ci . --baseline
582
+ ```
583
+
584
+ **GitHub Actions example:**
585
+
586
+ ```yaml
587
+ # .github/workflows/security.yml
588
+ name: Security Audit
589
+
590
+ on: [push, pull_request]
591
+
592
+ jobs:
593
+ security:
594
+ runs-on: ubuntu-latest
595
+ steps:
596
+ - uses: actions/checkout@v4
597
+
598
+ - name: Security gate
599
+ run: npx ship-safe ci . --threshold 75 --sarif results.sarif --github-pr
600
+
601
+ - uses: github/codeql-action/upload-sarif@v3
602
+ if: always()
603
+ with:
604
+ sarif_file: results.sarif
605
+ ```
606
+
607
+ **Export formats:** `--json`, `--sarif`, `--csv`, `--md`, `--html`, `--pdf`
608
+
609
+ ---
610
+
611
+ ## Suppress False Positives
612
+
613
+ **Inline:** Add `# ship-safe-ignore` comment on a line:
614
+ ```python
615
+ password = get_password() # ship-safe-ignore
616
+ ```
617
+
618
+ **File-level:** Create `.ship-safeignore` (gitignore syntax):
619
+ ```gitignore
620
+ # Exclude test fixtures
621
+ tests/fixtures/
622
+ *.test.js
623
+
624
+ # Exclude documentation with code examples
625
+ docs/
626
+ ```
627
+
628
+ ---
629
+
630
+ ## OWASP Coverage
631
+
632
+ | Standard | Coverage |
633
+ |----------|----------|
634
+ | **OWASP Top 10 Web 2025** | A01-A10: Broken Access Control, Cryptographic Failures, Injection, Insecure Design, Security Misconfiguration, Vulnerable Components, Auth Failures, Data Integrity, Logging Failures, SSRF |
635
+ | **OWASP Top 10 Mobile 2024** | M1-M10: Improper Credential Usage, Inadequate Supply Chain, Insecure Auth, Insufficient Validation, Insecure Communication, Inadequate Privacy, Binary Protections, Security Misconfiguration, Insecure Data Storage, Insufficient Cryptography |
636
+ | **OWASP LLM Top 10 2025** | LLM01-LLM10: Prompt Injection, Sensitive Info Disclosure, Supply Chain, Data Poisoning, Improper Output Handling, Excessive Agency, System Prompt Leakage, Vector/Embedding Weaknesses, Misinformation, Unbounded Consumption |
637
+ | **OWASP CI/CD Top 10** | CICD-SEC-1 to 10: Insufficient Flow Control, Identity Management, Dependency Chain Abuse, Poisoned Pipeline Execution, Insufficient PBAC, Credential Hygiene, Insecure System Config, Ungoverned Usage, Improper Artifact Integrity, Insufficient Logging |
638
+ | **OWASP Agentic AI Top 10** | ASI01-ASI10: Agent Hijacking, Tool Misuse, Privilege Escalation, Unsafe Code Execution, Memory Poisoning, Identity Spoofing, Excessive Autonomy, Logging Gaps, Supply Chain Attacks, Cascading Hallucination |
639
+
640
+ ---
641
+
642
+ ## What's Inside
643
+
644
+ ### [`/configs`](./configs)
645
+ Drop-in security configs for Next.js, Supabase, and Firebase.
646
+
647
+ ### [`/snippets`](./snippets)
648
+ Copy-paste security patterns: rate limiting, JWT, CORS, input validation.
649
+
650
+ ### [`/ai-defense`](./ai-defense)
651
+ LLM security: prompt injection detection, cost protection, system prompt hardening.
652
+
653
+ ### [`/checklists`](./checklists)
654
+ Manual security audits: launch-day checklist, framework-specific guides.
655
+
656
+ ---
657
+
658
+ ## Add a Security Badge to Your README
659
+
660
+ Show the world your project is secure. After running `npx ship-safe audit .` or `npx ship-safe vibe-check . --badge`, add one of these to your README:
661
+
662
+ ```markdown
663
+ <!-- Replace GRADE and COLOR with your results -->
664
+ [![Ship Safe](https://img.shields.io/badge/Ship_Safe-A+-22c55e)](https://shipsafecli.com)
665
+ ```
666
+
667
+ | Grade | Badge |
668
+ |-------|-------|
669
+ | A+ | `[![Ship Safe](https://img.shields.io/badge/Ship_Safe-A+-22c55e)](https://shipsafecli.com)` |
670
+ | A | `[![Ship Safe](https://img.shields.io/badge/Ship_Safe-A-22c55e)](https://shipsafecli.com)` |
671
+ | B | `[![Ship Safe](https://img.shields.io/badge/Ship_Safe-B-06b6d4)](https://shipsafecli.com)` |
672
+ | C | `[![Ship Safe](https://img.shields.io/badge/Ship_Safe-C-eab308)](https://shipsafecli.com)` |
673
+ | D | `[![Ship Safe](https://img.shields.io/badge/Ship_Safe-D-ef4444)](https://shipsafecli.com)` |
674
+ | F | `[![Ship Safe](https://img.shields.io/badge/Ship_Safe-F-dc2626)](https://shipsafecli.com)` |
675
+
676
+ ---
677
+
678
+ ## Supply Chain Hardening
679
+
680
+ Ship Safe practices what it preaches. Our own supply chain is hardened against the [2026 Trivy/CanisterWorm attack chain](https://shipsafecli.com/blog/supply-chain-attacks-2026-how-we-hardened-ship-safe):
681
+
682
+ | Defense | What It Blocks |
683
+ |---------|---------------|
684
+ | All GitHub Actions pinned to full commit SHAs | Tag repointing (Trivy-style) |
685
+ | `permissions: contents: read` in CI | Excessive token scope |
686
+ | `npm ci --ignore-scripts` in all pipelines | CanisterWorm postinstall propagation |
687
+ | OIDC trusted publishing with provenance | Stolen npm token publishing |
688
+ | CODEOWNERS on `action.yml`, `.github/`, `package.json` | Unauthorized changes to critical paths |
689
+ | Strict `files` allowlist in package.json | Accidental inclusion of secrets/configs |
690
+ | Self-scanning with ship-safe in CI | Malicious code injection |
691
+ | 5 direct dependencies | Minimal transitive attack surface |
692
+
693
+ Verify provenance on any Ship Safe release:
694
+
695
+ ```bash
696
+ npm audit signatures
697
+ ```
698
+
699
+ ---
700
+
701
+ ## Contributing
702
+
703
+ 1. Fork the repo
704
+ 2. Add your security pattern, agent, or config
705
+ 3. Include comments explaining *why* it matters
706
+ 4. Open a PR
707
+
708
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.
709
+
710
+ ---
711
+
712
+ ## Security Standards Reference
713
+
714
+ - [OWASP Top 10 Web 2025](https://owasp.org/Top10/)
715
+ - [OWASP Top 10 Mobile 2024](https://owasp.org/www-project-mobile-top-10/)
716
+ - [OWASP LLM Top 10 2025](https://genai.owasp.org/llm-top-10/)
717
+ - [OWASP API Security Top 10 2023](https://owasp.org/API-Security/)
718
+ - [OWASP CI/CD Top 10](https://owasp.org/www-project-top-10-ci-cd-security-risks/)
719
+ - [OWASP Agentic AI Top 10](https://owasp.org/www-project-agentic-ai-top-10/)
720
+
721
+ ---
722
+
723
+ ## License
724
+
725
+ MIT - Use it, share it, secure your stuff.
726
+
727
+ ---
728
+
729
+ ## Star History
730
+
731
+ [![Star History Chart](https://api.star-history.com/svg?repos=asamassekou10/ship-safe&type=Date)](https://star-history.com/#asamassekou10/ship-safe&Date)
732
+
733
+ ---
734
+
735
+ **Ship fast. Ship safe.** — [shipsafecli.com](https://shipsafecli.com)