ship-safe 3.1.0 → 4.0.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 (38) hide show
  1. package/README.md +200 -307
  2. package/cli/agents/api-fuzzer.js +224 -0
  3. package/cli/agents/auth-bypass-agent.js +326 -0
  4. package/cli/agents/base-agent.js +240 -0
  5. package/cli/agents/cicd-scanner.js +200 -0
  6. package/cli/agents/config-auditor.js +413 -0
  7. package/cli/agents/git-history-scanner.js +167 -0
  8. package/cli/agents/html-reporter.js +363 -0
  9. package/cli/agents/index.js +56 -0
  10. package/cli/agents/injection-tester.js +401 -0
  11. package/cli/agents/llm-redteam.js +251 -0
  12. package/cli/agents/mobile-scanner.js +225 -0
  13. package/cli/agents/orchestrator.js +152 -0
  14. package/cli/agents/policy-engine.js +149 -0
  15. package/cli/agents/recon-agent.js +196 -0
  16. package/cli/agents/sbom-generator.js +176 -0
  17. package/cli/agents/scoring-engine.js +207 -0
  18. package/cli/agents/ssrf-prober.js +130 -0
  19. package/cli/agents/supply-chain-agent.js +274 -0
  20. package/cli/bin/ship-safe.js +119 -2
  21. package/cli/commands/agent.js +606 -0
  22. package/cli/commands/audit.js +565 -0
  23. package/cli/commands/deps.js +447 -0
  24. package/cli/commands/fix.js +3 -3
  25. package/cli/commands/init.js +86 -3
  26. package/cli/commands/mcp.js +2 -2
  27. package/cli/commands/red-team.js +315 -0
  28. package/cli/commands/remediate.js +4 -4
  29. package/cli/commands/rotate.js +6 -6
  30. package/cli/commands/scan.js +64 -23
  31. package/cli/commands/score.js +446 -0
  32. package/cli/commands/watch.js +160 -0
  33. package/cli/index.js +40 -2
  34. package/cli/providers/llm-provider.js +288 -0
  35. package/cli/utils/entropy.js +6 -0
  36. package/cli/utils/output.js +42 -2
  37. package/cli/utils/patterns.js +393 -1
  38. package/package.json +19 -15
package/README.md CHANGED
@@ -1,434 +1,323 @@
1
1
  <p align="center">
2
2
  <img src=".github/assets/logo%20ship%20safe.png" alt="Ship Safe Logo" width="180" />
3
3
  </p>
4
- <p align="center"><strong>Don't let vibe coding leak your API keys.</strong></p>
4
+ <p align="center"><strong>AI-powered application security platform for developers.</strong></p>
5
5
 
6
6
  <p align="center">
7
7
  <a href="https://www.npmjs.com/package/ship-safe"><img src="https://badge.fury.io/js/ship-safe.svg" alt="npm version" /></a>
8
+ <a href="https://www.npmjs.com/package/ship-safe"><img src="https://img.shields.io/npm/dm/ship-safe.svg" alt="npm downloads" /></a>
9
+ <a href="https://github.com/asamassekou10/ship-safe/actions/workflows/ci.yml"><img src="https://github.com/asamassekou10/ship-safe/actions/workflows/ci.yml/badge.svg" alt="CI" /></a>
10
+ <a href="https://nodejs.org"><img src="https://img.shields.io/node/v/ship-safe" alt="Node.js version" /></a>
8
11
  <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT" /></a>
9
12
  </p>
10
13
 
11
14
  ---
12
15
 
13
- You're shipping fast. You're using AI to write code. You're one `git push` away from exposing your database credentials to the world.
16
+ 12 security agents. 50+ attack classes. One command.
14
17
 
15
- **Ship Safe** is a security toolkit for indie hackers and vibe coders who want to secure their MVP in 5 minutes, not 5 days.
18
+ **Ship Safe v4.0** is an AI-powered security platform that runs 12 specialized agents against your codebase — scanning for secrets, injection vulnerabilities, auth bypass, SSRF, supply chain attacks, Docker/Terraform misconfigs, CI/CD pipeline poisoning, LLM security issues, and more. It produces a prioritized remediation plan so you know exactly what to fix first.
16
19
 
17
20
  ---
18
21
 
19
22
  ## Quick Start
20
23
 
21
24
  ```bash
22
- # Scan for leaked secrets (no install required!)
23
- npx ship-safe scan .
24
-
25
- # Auto-generate .env.example from found secrets
26
- npx ship-safe fix
25
+ # Full security audit secrets + 12 agents + deps + remediation plan
26
+ npx ship-safe audit .
27
27
 
28
- # Block git push if secrets are found
29
- npx ship-safe guard
28
+ # Red team scan only (12 agents, 50+ attack classes)
29
+ npx ship-safe red-team .
30
30
 
31
- # Run the launch-day security checklist
32
- npx ship-safe checklist
31
+ # Quick secret scan
32
+ npx ship-safe scan .
33
33
 
34
- # Add security configs to your project
35
- npx ship-safe init
34
+ # Security health score (0-100)
35
+ npx ship-safe score .
36
36
  ```
37
37
 
38
- That's it. Five commands to secure your MVP.
39
-
40
38
  ![ship-safe terminal demo](.github/assets/ship%20safe%20terminal.jpg)
41
39
 
42
- ### Let AI Do It For You
43
-
44
- Copy this prompt to your AI coding assistant:
45
-
46
- ```
47
- Run "npx ship-safe scan ." on my project and fix any secrets you find.
48
- Then run "npx ship-safe init" to add security configs.
49
- Explain what you're doing as you go.
50
- ```
51
-
52
- [More AI prompts for specific frameworks](./AI_SECURITY_PROMPT.md)
53
-
54
40
  ---
55
41
 
56
- ## Why This Exists
57
-
58
- Vibe coding is powerful. You can build a SaaS in a weekend. But speed creates blind spots:
42
+ ## The `audit` Command
59
43
 
60
- - AI-generated code often hardcodes secrets
61
- - Default configs ship with debug mode enabled
62
- - "I'll fix it later" becomes "I got hacked"
44
+ One command that runs everything and generates a full report:
63
45
 
64
- This repo is your co-pilot for security. Copy, paste, ship safely.
46
+ ```bash
47
+ npx ship-safe audit .
48
+ ```
65
49
 
66
- ---
50
+ ```
51
+ ════════════════════════════════════════════════════════════
52
+ Ship Safe v4.0 — Full Security Audit
53
+ ════════════════════════════════════════════════════════════
67
54
 
68
- ## CLI Commands
55
+ [Phase 1/4] Scanning for secrets... ✔ 49 found
56
+ [Phase 2/4] Running 12 security agents... ✔ 103 findings
57
+ [Phase 3/4] Auditing dependencies... ✔ 44 CVEs
58
+ [Phase 4/4] Computing security score... ✔ 25/100 F
69
59
 
70
- ### `npx ship-safe scan [path]`
60
+ Remediation Plan
61
+ ════════════════════════════════════════════════════════
71
62
 
72
- Scans your codebase for leaked secrets: API keys, passwords, private keys, database URLs.
63
+ 🔴 CRITICAL fix immediately
64
+ ────────────────────────────────────────────────────────
65
+ 1. [SECRETS] Rotate Stripe Live Secret Key
66
+ .env:67 → Move to environment variable or secrets manager
73
67
 
74
- ```bash
75
- # Scan current directory
76
- npx ship-safe scan .
68
+ 2. [INJECTION] Unsafe pickle.loads()
69
+ backend/ai_processor.py:64 Use JSON for untrusted data
77
70
 
78
- # Scan a specific folder
79
- npx ship-safe scan ./src
71
+ 🟠 HIGH fix before deploy
72
+ ────────────────────────────────────────────────────────
73
+ 3. [XSS] dangerouslySetInnerHTML without sanitization
74
+ frontend/src/utils/blogContentRenderer.jsx:50 → Add DOMPurify
80
75
 
81
- # Get JSON output (for CI pipelines)
82
- npx ship-safe scan . --json
76
+ ... 149 more items in the full report
83
77
 
84
- # Verbose mode (show files being scanned)
85
- npx ship-safe scan . -v
78
+ 📊 Full report: ship-safe-report.html
86
79
  ```
87
80
 
88
- **Exit codes:** Returns `1` if secrets found (useful for CI), `0` if clean.
81
+ **What it runs:**
82
+ 1. **Secret scan** — 50+ patterns with entropy scoring (API keys, passwords, tokens)
83
+ 2. **12 security agents** — injection, auth, SSRF, supply chain, config, LLM, mobile, git history, CI/CD, API
84
+ 3. **Dependency audit** — npm/pip/bundler CVE scanning
85
+ 4. **Score computation** — 8-category weighted scoring (0-100, A-F)
86
+ 5. **Remediation plan** — prioritized fix list grouped by severity
87
+ 6. **HTML report** — standalone dark-themed report with table of contents
89
88
 
90
89
  **Flags:**
91
- - `--json` — structured JSON output for CI pipelines
90
+ - `--json` — structured JSON output (clean for piping)
92
91
  - `--sarif` — SARIF format for GitHub Code Scanning
93
- - `--include-tests` — also scan test/spec/fixture files (excluded by default)
94
- - `-v` — verbose mode
95
-
96
- **Suppress false positives:**
97
- ```bash
98
- const apiKey = 'example-key'; // ship-safe-ignore
99
- ```
100
- Or exclude paths with `.ship-safeignore` (gitignore syntax).
92
+ - `--html [file]` — custom HTML report path (default: `ship-safe-report.html`)
93
+ - `--no-deps` — skip dependency audit
94
+ - `--no-ai` — skip AI classification
101
95
 
102
- **Custom patterns** — create `.ship-safe.json` in your project root:
103
- ```json
104
- {
105
- "patterns": [
106
- {
107
- "name": "My Internal API Key",
108
- "pattern": "MYAPP_[A-Z0-9]{32}",
109
- "severity": "high",
110
- "description": "Internal key for myapp services."
111
- }
112
- ]
113
- }
114
- ```
96
+ ---
115
97
 
116
- **Detects 50+ secret patterns:**
117
- - **AI/ML:** OpenAI, Anthropic, Google AI, Cohere, Replicate, Hugging Face
118
- - **Auth:** Clerk, Auth0, Supabase Auth
119
- - **Cloud:** AWS, Google Cloud, Azure
120
- - **Database:** Supabase, PlanetScale, Neon, MongoDB, PostgreSQL, MySQL
121
- - **Payment:** Stripe, PayPal
122
- - **Messaging:** Twilio, SendGrid, Resend
123
- - **And more:** GitHub tokens, private keys, JWTs, generic secrets
98
+ ## 12 Security Agents
99
+
100
+ | Agent | Category | What It Detects |
101
+ |-------|----------|-----------------|
102
+ | **InjectionTester** | Code Vulns | SQL/NoSQL injection, command injection, code injection (eval), XSS, path traversal, XXE, ReDoS, prototype pollution |
103
+ | **AuthBypassAgent** | Auth | JWT vulnerabilities (alg:none, weak secrets), cookie security, CSRF, OAuth misconfig, BOLA/IDOR, weak crypto, timing attacks, TLS bypass |
104
+ | **SSRFProber** | SSRF | User input in fetch/axios, cloud metadata endpoints, internal IPs, redirect following |
105
+ | **SupplyChainAudit** | Supply Chain | Typosquatting (Levenshtein distance), git/URL dependencies, wildcard versions, suspicious install scripts |
106
+ | **ConfigAuditor** | Config | Dockerfile (running as root, :latest tags), Terraform (public S3, open SG), Kubernetes (privileged containers), CORS, CSP, Firebase, Nginx |
107
+ | **LLMRedTeam** | AI/LLM | OWASP LLM Top 10 — prompt injection, excessive agency, system prompt leakage, unbounded consumption, RAG poisoning |
108
+ | **MobileScanner** | Mobile | OWASP Mobile Top 10 2024 — insecure storage, WebView JS injection, HTTP endpoints, excessive permissions, debug mode |
109
+ | **GitHistoryScanner** | Secrets | Leaked secrets in git commit history (checks if still active in working tree) |
110
+ | **CICDScanner** | CI/CD | OWASP CI/CD Top 10 — pipeline poisoning, unpinned actions, secret logging, self-hosted runners, script injection |
111
+ | **APIFuzzer** | API | Routes without auth, missing input validation, mass assignment, unrestricted file upload, GraphQL introspection, debug endpoints |
112
+ | **ReconAgent** | Recon | Attack surface discovery — frameworks, languages, auth patterns, databases, cloud providers, IaC, CI/CD pipelines |
113
+ | **ScoringEngine** | Scoring | 8-category weighted scoring with trend tracking |
124
114
 
125
115
  ---
126
116
 
127
- ### `npx ship-safe checklist`
117
+ ## All Commands
128
118
 
129
- Interactive 10-point security checklist for launch day.
119
+ ### Core Audit Commands
130
120
 
131
121
  ```bash
132
- # Interactive mode (prompts for each item)
133
- npx ship-safe checklist
122
+ # Full audit with remediation plan + HTML report
123
+ npx ship-safe audit .
134
124
 
135
- # Print checklist without prompts
136
- npx ship-safe checklist --no-interactive
137
- ```
125
+ # Red team: 12 agents, 50+ attack classes
126
+ npx ship-safe red-team .
127
+ npx ship-safe red-team . --agents injection,auth # Run specific agents
128
+ npx ship-safe red-team . --html report.html # HTML report
129
+ npx ship-safe red-team . --json # JSON output
138
130
 
139
- Covers: exposed .git folders, debug mode, RLS policies, hardcoded keys, HTTPS, security headers, rate limiting, and more.
131
+ # Secret scanner (pattern matching + entropy)
132
+ npx ship-safe scan .
133
+ npx ship-safe scan . --json # JSON for CI
134
+ npx ship-safe scan . --sarif # SARIF for GitHub
140
135
 
141
- ---
136
+ # Security health score (0-100, A-F)
137
+ npx ship-safe score .
142
138
 
143
- ### `npx ship-safe init`
139
+ # Dependency CVE audit
140
+ npx ship-safe deps .
141
+ npx ship-safe deps . --fix # Auto-fix vulnerabilities
142
+ ```
144
143
 
145
- Initialize security configs in your project.
144
+ ### AI-Powered Commands
146
145
 
147
146
  ```bash
148
- # Add all security configs
149
- npx ship-safe init
150
-
151
- # Only add .gitignore patterns
152
- npx ship-safe init --gitignore
147
+ # AI audit: scan + classify with Claude + auto-fix secrets
148
+ npx ship-safe agent .
153
149
 
154
- # Only add security headers config
155
- npx ship-safe init --headers
150
+ # Auto-fix hardcoded secrets: rewrite code + write .env
151
+ npx ship-safe remediate .
156
152
 
157
- # Force overwrite existing files
158
- npx ship-safe init -f
153
+ # Revoke exposed keys — opens provider dashboards
154
+ npx ship-safe rotate .
159
155
  ```
160
156
 
161
- **What it copies:**
162
- - `.gitignore` - Patterns to prevent committing secrets
163
- - `security-headers.config.js` - Drop-in Next.js security headers
164
-
165
- ---
166
-
167
- ### `npx ship-safe fix`
168
-
169
- Scan for secrets and auto-generate a `.env.example` file.
157
+ ### Infrastructure Commands
170
158
 
171
159
  ```bash
172
- # Scan and generate .env.example
173
- npx ship-safe fix
174
-
175
- # Preview what would be generated without writing it
176
- npx ship-safe fix --dry-run
177
- ```
178
-
179
- ---
160
+ # Continuous monitoring (watch files for changes)
161
+ npx ship-safe watch .
180
162
 
181
- ### `npx ship-safe guard`
163
+ # Generate CycloneDX SBOM
164
+ npx ship-safe sbom .
182
165
 
183
- Install a git hook that blocks pushes if secrets are found. Works with or without Husky.
166
+ # Policy-as-code (enforce minimum score, fail on severity)
167
+ npx ship-safe policy init
184
168
 
185
- ```bash
186
- # Install pre-push hook (runs scan before every git push)
169
+ # Block git push if secrets found
187
170
  npx ship-safe guard
188
171
 
189
- # Install pre-commit hook instead
190
- npx ship-safe guard --pre-commit
172
+ # Initialize security configs (.gitignore, headers)
173
+ npx ship-safe init
191
174
 
192
- # Remove installed hooks
193
- npx ship-safe guard remove
194
- ```
175
+ # Launch-day security checklist
176
+ npx ship-safe checklist
195
177
 
196
- **Suppress false positives:**
197
- - Add `# ship-safe-ignore` as a comment on a line to skip it
198
- - Create `.ship-safeignore` (gitignore syntax) to exclude paths
178
+ # MCP server for AI editors (Claude Desktop, Cursor, etc.)
179
+ npx ship-safe mcp
180
+ ```
199
181
 
200
182
  ---
201
183
 
202
- ### `npx ship-safe mcp`
203
-
204
- Start ship-safe as an MCP server so AI editors can call it directly.
184
+ ## Multi-LLM Support
205
185
 
206
- **Setup (Claude Desktop)** add to `claude_desktop_config.json`:
207
- ```json
208
- {
209
- "mcpServers": {
210
- "ship-safe": {
211
- "command": "npx",
212
- "args": ["ship-safe", "mcp"]
213
- }
214
- }
215
- }
216
- ```
186
+ Ship Safe supports multiple AI providers for classification:
217
187
 
218
- Works with Claude Desktop, Cursor, Windsurf, Zed, and any MCP-compatible editor.
188
+ | Provider | Env Variable | Model |
189
+ |----------|-------------|-------|
190
+ | **Anthropic** | `ANTHROPIC_API_KEY` | claude-haiku-4-5 |
191
+ | **OpenAI** | `OPENAI_API_KEY` | gpt-4o-mini |
192
+ | **Google** | `GOOGLE_AI_API_KEY` | gemini-2.0-flash |
193
+ | **Ollama** | `OLLAMA_HOST` | Local models |
219
194
 
220
- **Available tools:**
221
- - `scan_secrets` — scan a directory for leaked secrets
222
- - `get_checklist` — return the security checklist as structured data
223
- - `analyze_file` — analyze a single file for issues
195
+ Auto-detected from environment variables. No API key required for scanning — AI is optional.
224
196
 
225
197
  ---
226
198
 
227
- ## What's Inside
228
-
229
- ### [`/checklists`](./checklists)
230
- **Manual security audits you can do in 5 minutes.**
231
- - [Launch Day Checklist](./checklists/launch-day.md) - 10 things to check before you go live
232
-
233
- ### [`/configs`](./configs)
234
- **Secure defaults for popular stacks. Drop-in ready.**
235
-
236
- | Stack | Files |
237
- |-------|-------|
238
- | **Next.js** | [Security Headers](./configs/nextjs-security-headers.js) - CSP, X-Frame-Options, HSTS |
239
- | **Supabase** | [RLS Templates](./configs/supabase/rls-templates.sql) \| [Security Checklist](./configs/supabase/security-checklist.md) \| [Secure Client](./configs/supabase/secure-client.ts) |
240
- | **Firebase** | [Firestore Rules](./configs/firebase/firestore-rules.txt) \| [Storage Rules](./configs/firebase/storage-rules.txt) \| [Security Checklist](./configs/firebase/security-checklist.md) |
199
+ ## Scoring System
241
200
 
242
- ### [`/snippets`](./snippets)
243
- **Copy-paste code blocks for common security patterns.**
201
+ Starts at 100. Each finding deducts points by severity and category.
244
202
 
245
- | Category | Files |
246
- |----------|-------|
247
- | **Rate Limiting** | [Upstash Redis](./snippets/rate-limiting/upstash-ratelimit.ts) \| [Next.js Middleware](./snippets/rate-limiting/nextjs-middleware.ts) |
248
- | **Authentication** | [JWT Security Checklist](./snippets/auth/jwt-checklist.md) |
249
- | **API Security** | [CORS Config](./snippets/api-security/cors-config.ts) \| [Input Validation](./snippets/api-security/input-validation.ts) \| [API Checklist](./snippets/api-security/api-security-checklist.md) |
203
+ **8 Categories** (with weight caps):
250
204
 
251
- ### [`/ai-defense`](./ai-defense)
252
- **Protect your AI features from abuse and cost explosions.**
205
+ | Category | Weight | Critical | High | Medium | Cap |
206
+ |----------|--------|----------|------|--------|-----|
207
+ | Secrets | 15% | -25 | -15 | -5 | -15 |
208
+ | Code Vulnerabilities | 15% | -20 | -10 | -3 | -15 |
209
+ | Dependencies | 15% | -20 | -10 | -5 | -15 |
210
+ | Auth & Access Control | 15% | -20 | -10 | -3 | -15 |
211
+ | Configuration | 10% | -15 | -8 | -3 | -10 |
212
+ | Supply Chain | 10% | -15 | -8 | -3 | -10 |
213
+ | API Security | 10% | -15 | -8 | -3 | -10 |
214
+ | AI/LLM Security | 10% | -15 | -8 | -3 | -10 |
253
215
 
254
- | File | Description |
255
- |------|-------------|
256
- | [LLM Security Checklist](./ai-defense/llm-security-checklist.md) | Based on OWASP LLM Top 10 - prompt injection, data protection, scope control |
257
- | [Prompt Injection Patterns](./ai-defense/prompt-injection-patterns.js) | Regex patterns to detect 25+ injection attempts |
258
- | [Cost Protection Guide](./ai-defense/cost-protection.md) | Prevent $50k surprise bills - rate limits, budget caps, circuit breakers |
259
- | [System Prompt Armor](./ai-defense/system-prompt-armor.md) | Template for hardened system prompts |
216
+ **Grades:** A (90-100), B (75-89), C (60-74), D (40-59), F (0-39)
260
217
 
261
- ### [`/scripts`](./scripts)
262
- **Automated scanning tools. Run them in CI or locally.**
263
- - [Secret Scanner](./scripts/scan_secrets.py) - Python version of the secret scanner
218
+ **Exit codes:** `0` for A/B (>= 75), `1` for C/D/F — use in CI to fail builds.
264
219
 
265
220
  ---
266
221
 
267
- ## AI/LLM Security
268
-
269
- Building with AI? Don't let it bankrupt you or get hijacked.
270
-
271
- ### Quick Setup
272
-
273
- ```typescript
274
- import { containsInjectionAttempt } from './ai-defense/prompt-injection-patterns';
275
-
276
- async function handleChat(userInput: string) {
277
- // 1. Check for injection attempts
278
- const { detected } = containsInjectionAttempt(userInput);
279
- if (detected) {
280
- return "I can't process that request.";
281
- }
222
+ ## Policy-as-Code
282
223
 
283
- // 2. Rate limit per user
284
- const { success } = await ratelimit.limit(userId);
285
- if (!success) {
286
- return "Too many requests. Please slow down.";
287
- }
224
+ Create `.ship-safe.policy.json` to enforce team-wide security standards:
288
225
 
289
- // 3. Check budget before calling
290
- await checkUserBudget(userId, estimatedCost);
291
-
292
- // 4. Make the API call with token limits
293
- const response = await openai.chat.completions.create({
294
- model: 'gpt-4',
295
- messages,
296
- max_tokens: 500, // Hard cap
297
- });
226
+ ```bash
227
+ npx ship-safe policy init
228
+ ```
298
229
 
299
- return response;
230
+ ```json
231
+ {
232
+ "minimumScore": 70,
233
+ "failOn": "critical",
234
+ "requiredScans": ["secrets", "injection", "deps", "auth"],
235
+ "ignoreRules": [],
236
+ "customSeverityOverrides": {},
237
+ "maxAge": { "criticalCVE": "7d", "highCVE": "30d", "mediumCVE": "90d" }
300
238
  }
301
239
  ```
302
240
 
303
- ### Cost Protection Layers
304
-
305
- 1. **Token limits** - Cap input/output per request
306
- 2. **Rate limits** - Cap requests per user (10/min)
307
- 3. **Budget caps** - Daily ($1) and monthly ($10) per user
308
- 4. **Circuit breaker** - Disable AI when global budget hit
309
- 5. **Provider limits** - Set hard limits in OpenAI/Anthropic dashboard
310
-
311
- [Full cost protection guide →](./ai-defense/cost-protection.md)
312
-
313
241
  ---
314
242
 
315
- ## Database Security
243
+ ## CI/CD Integration
316
244
 
317
- ### Supabase RLS Templates
245
+ ```yaml
246
+ # .github/workflows/security.yml
247
+ name: Security Audit
318
248
 
319
- ```sql
320
- -- Users can only see their own data
321
- CREATE POLICY "Users own their data" ON items
322
- FOR ALL USING (auth.uid() = user_id);
249
+ on: [push, pull_request]
323
250
 
324
- -- Read-only public data
325
- CREATE POLICY "Public read access" ON public_items
326
- FOR SELECT USING (true);
327
- ```
251
+ jobs:
252
+ security:
253
+ runs-on: ubuntu-latest
254
+ steps:
255
+ - uses: actions/checkout@v4
328
256
 
329
- [6 more RLS patterns →](./configs/supabase/rls-templates.sql)
257
+ - name: Full security audit
258
+ run: npx ship-safe audit . --no-ai --json
330
259
 
331
- ### Firebase Security Rules
260
+ - name: Upload SARIF to GitHub Security tab
261
+ run: npx ship-safe audit . --no-ai --sarif > results.sarif
332
262
 
333
- ```javascript
334
- // Users can only access their own documents
335
- match /users/{userId} {
336
- allow read, write: if request.auth != null
337
- && request.auth.uid == userId;
338
- }
263
+ - uses: github/codeql-action/upload-sarif@v3
264
+ with:
265
+ sarif_file: results.sarif
339
266
  ```
340
267
 
341
- [Full Firestore rules template →](./configs/firebase/firestore-rules.txt)
342
-
343
268
  ---
344
269
 
345
- ## API Security
346
-
347
- ### CORS (Don't use `*` in production)
348
-
349
- ```typescript
350
- const ALLOWED_ORIGINS = [
351
- 'https://yourapp.com',
352
- 'https://www.yourapp.com',
353
- ];
270
+ ## Suppress False Positives
354
271
 
355
- // Only allow specific origins
356
- if (origin && ALLOWED_ORIGINS.includes(origin)) {
357
- headers['Access-Control-Allow-Origin'] = origin;
358
- }
272
+ **Inline:** Add `# ship-safe-ignore` comment on a line:
273
+ ```python
274
+ password = get_password() # ship-safe-ignore
359
275
  ```
360
276
 
361
- [CORS configs for Next.js, Express, Fastify, Hono →](./snippets/api-security/cors-config.ts)
362
-
363
- ### Input Validation (Zod)
277
+ **File-level:** Create `.ship-safeignore` (gitignore syntax):
278
+ ```gitignore
279
+ # Exclude test fixtures
280
+ tests/fixtures/
281
+ *.test.js
364
282
 
365
- ```typescript
366
- const createUserSchema = z.object({
367
- email: z.string().email().max(255),
368
- password: z.string().min(8).max(128),
369
- });
370
-
371
- const result = createUserSchema.safeParse(body);
372
- if (!result.success) {
373
- return Response.json({ error: result.error.issues }, { status: 400 });
374
- }
283
+ # Exclude documentation with code examples
284
+ docs/
375
285
  ```
376
286
 
377
- [Full validation patterns →](./snippets/api-security/input-validation.ts)
378
-
379
287
  ---
380
288
 
381
- ## CI/CD Integration
382
-
383
- Add to your GitHub Actions workflow:
384
-
385
- ```yaml
386
- # .github/workflows/security.yml
387
- name: Security Scan
388
-
389
- on: [push, pull_request]
390
-
391
- jobs:
392
- scan-secrets:
393
- runs-on: ubuntu-latest
394
- steps:
395
- - uses: actions/checkout@v4
396
- - name: Scan for secrets
397
- run: npx ship-safe scan . --json
398
- ```
289
+ ## OWASP Coverage
399
290
 
400
- The scan exits with code `1` if secrets are found, failing your build.
291
+ | Standard | Coverage |
292
+ |----------|----------|
293
+ | **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 |
294
+ | **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 |
295
+ | **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 |
296
+ | **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 |
401
297
 
402
298
  ---
403
299
 
404
- ## The 5-Minute Security Checklist
300
+ ## What's Inside
405
301
 
406
- 1. ✅ Run `npx ship-safe scan .` on your project
407
- 2. Run `npx ship-safe init` to add security configs
408
- 3. ✅ Add security headers to your Next.js config
409
- 4. ✅ Run `npx ship-safe checklist` before launching
410
- 5. ✅ If using AI features, implement [cost protection](./ai-defense/cost-protection.md)
411
- 6. ✅ If using Supabase, check the [RLS checklist](./configs/supabase/security-checklist.md)
412
- 7. ✅ If using Firebase, check the [Firebase checklist](./configs/firebase/security-checklist.md)
302
+ ### [`/configs`](./configs)
303
+ Drop-in security configs for Next.js, Supabase, and Firebase.
413
304
 
414
- ---
305
+ ### [`/snippets`](./snippets)
306
+ Copy-paste security patterns: rate limiting, JWT, CORS, input validation.
415
307
 
416
- ## Philosophy
308
+ ### [`/ai-defense`](./ai-defense)
309
+ LLM security: prompt injection detection, cost protection, system prompt hardening.
417
310
 
418
- - **Low friction** - If it takes more than 5 minutes, people won't do it
419
- - **Educational** - Every config has comments explaining *why*
420
- - **Modular** - Take what you need, ignore the rest
421
- - **Copy-paste friendly** - No complex setup, just grab and go
311
+ ### [`/checklists`](./checklists)
312
+ Manual security audits: launch-day checklist, framework-specific guides.
422
313
 
423
314
  ---
424
315
 
425
316
  ## Contributing
426
317
 
427
- Found a security pattern that saved your app? Share it!
428
-
429
318
  1. Fork the repo
430
- 2. Add your checklist, config, or script
431
- 3. Include educational comments explaining *why* it matters
319
+ 2. Add your security pattern, agent, or config
320
+ 3. Include comments explaining *why* it matters
432
321
  4. Open a PR
433
322
 
434
323
  See [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.
@@ -437,11 +326,11 @@ See [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.
437
326
 
438
327
  ## Security Standards Reference
439
328
 
440
- This toolkit is based on:
441
329
  - [OWASP Top 10 Web 2025](https://owasp.org/Top10/)
442
330
  - [OWASP Top 10 Mobile 2024](https://owasp.org/www-project-mobile-top-10/)
443
331
  - [OWASP LLM Top 10 2025](https://genai.owasp.org/llm-top-10/)
444
332
  - [OWASP API Security Top 10 2023](https://owasp.org/API-Security/)
333
+ - [OWASP CI/CD Top 10](https://owasp.org/www-project-top-10-ci-cd-security-risks/)
445
334
 
446
335
  ---
447
336
 
@@ -451,6 +340,10 @@ MIT - Use it, share it, secure your stuff.
451
340
 
452
341
  ---
453
342
 
454
- **Remember: Security isn't about being paranoid. It's about being prepared.**
343
+ ## Star History
344
+
345
+ [![Star History Chart](https://api.star-history.com/svg?repos=asamassekou10/ship-safe&type=Date)](https://star-history.com/#asamassekou10/ship-safe&Date)
346
+
347
+ ---
455
348
 
456
- Ship fast. Ship safe.
349
+ **Ship fast. Ship safe.**