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