cto-ai-cli 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DOCS.md +151 -0
- package/README.md +124 -15
- package/dist/action/index.js +23 -1
- package/dist/api/dashboard.js +23 -1
- package/dist/api/dashboard.js.map +1 -1
- package/dist/api/server.js +23 -1
- package/dist/api/server.js.map +1 -1
- package/dist/cli/score.js +341 -2
- package/dist/cli/v2/index.js +23 -1
- package/dist/cli/v2/index.js.map +1 -1
- package/dist/engine/index.js +23 -1
- package/dist/engine/index.js.map +1 -1
- package/dist/govern/index.d.ts +25 -2
- package/dist/govern/index.js +155 -1
- package/dist/govern/index.js.map +1 -1
- package/dist/interact/index.js +23 -1
- package/dist/interact/index.js.map +1 -1
- package/dist/mcp/v2.js +23 -1
- package/dist/mcp/v2.js.map +1 -1
- package/package.json +1 -1
package/DOCS.md
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
## Table of Contents
|
|
6
6
|
|
|
7
7
|
- [CLI Commands](#cli-commands)
|
|
8
|
+
- [Security Audit](#security-audit---audit)
|
|
8
9
|
- [MCP Server](#mcp-server)
|
|
9
10
|
- [API Server](#api-server)
|
|
10
11
|
- [Programmatic API](#programmatic-api)
|
|
@@ -83,6 +84,156 @@ cto2 policy validate
|
|
|
83
84
|
cto2 policy init
|
|
84
85
|
```
|
|
85
86
|
|
|
87
|
+
### `npx cto-ai-cli` (zero-install CLI)
|
|
88
|
+
|
|
89
|
+
The default binary. All flags work with zero install via `npx`.
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
npx cto-ai-cli # Score your project
|
|
93
|
+
npx cto-ai-cli ./path # Score a specific project
|
|
94
|
+
npx cto-ai-cli --fix # Auto-generate .cto/context.md, config.json, .cteignore
|
|
95
|
+
npx cto-ai-cli --context "your task" # Task-specific context with file contents
|
|
96
|
+
npx cto-ai-cli --audit # Security audit: detect secrets & PII
|
|
97
|
+
npx cto-ai-cli --report # Shareable markdown report + shields.io badge
|
|
98
|
+
npx cto-ai-cli --compare # Compare your score vs popular open source projects
|
|
99
|
+
npx cto-ai-cli --benchmark # CTO vs naive vs random comparison
|
|
100
|
+
npx cto-ai-cli --json # Machine-readable JSON output
|
|
101
|
+
npx cto-ai-cli --help # Show all options
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Flags can be combined: `npx cto-ai-cli --fix --audit --report --compare`
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Security Audit (`--audit`)
|
|
109
|
+
|
|
110
|
+
Full-project secret and PII detection. Scans all source files for hardcoded credentials, tokens, keys, passwords, connection strings, and personally identifiable information.
|
|
111
|
+
|
|
112
|
+
### Usage
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
npx cto-ai-cli --audit # Full audit with terminal output
|
|
116
|
+
npx cto-ai-cli --audit --fix # Audit + auto-generate context files
|
|
117
|
+
CI=true npx cto-ai-cli --audit # CI mode: exit code 1 on critical/high findings
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Detection engine
|
|
121
|
+
|
|
122
|
+
CTO uses a **dual-strategy** detection approach:
|
|
123
|
+
|
|
124
|
+
**1. Pattern matching (30+ patterns)**
|
|
125
|
+
|
|
126
|
+
| Type | Pattern examples | Severity |
|
|
127
|
+
|------|-----------------|----------|
|
|
128
|
+
| `api-key` | OpenAI `sk-*`, Anthropic `sk-ant-*`, Stripe `sk_live_*`, Google `AIza*`, SendGrid `SG.*.*` | Critical |
|
|
129
|
+
| `aws-key` | `AKIA*` (Access Key ID), `aws_secret_access_key=*` | Critical |
|
|
130
|
+
| `token` | GitHub `ghp_*`/`gho_*`, GitLab `glpat-*`, Slack `xoxb-*`/`xoxp-*`, npm `npm_*`, JWT `eyJ*.*.*` | Critical/High |
|
|
131
|
+
| `private-key` | `-----BEGIN RSA PRIVATE KEY-----`, `-----BEGIN OPENSSH PRIVATE KEY-----` | Critical |
|
|
132
|
+
| `connection-string` | `mongodb://user:pass@host`, `postgres://`, `DATABASE_URL=` | Critical |
|
|
133
|
+
| `password` | `password=`, `DB_PASSWORD=`, `MYSQL_PASSWORD=` | High |
|
|
134
|
+
| `env-variable` | `SECRET_KEY=`, `PRIVATE_TOKEN=`, `ENCRYPTION_PASS=` | High |
|
|
135
|
+
| `pii` | Email addresses, possible SSNs | Medium |
|
|
136
|
+
|
|
137
|
+
**2. Shannon entropy analysis**
|
|
138
|
+
|
|
139
|
+
For strings that don't match a known pattern but look like secrets:
|
|
140
|
+
- Scans all quoted strings ≥40 characters
|
|
141
|
+
- Calculates Shannon entropy (randomness measure)
|
|
142
|
+
- Flags strings with entropy ≥5.0 bits (very random = likely a secret)
|
|
143
|
+
- Automatically skips: hex hashes, camelCase identifiers, base64 padding, integrity hashes, comments, test files
|
|
144
|
+
|
|
145
|
+
### Smart filtering (false positive reduction)
|
|
146
|
+
|
|
147
|
+
The scanner skips:
|
|
148
|
+
- **Placeholders**: `${API_KEY}`, `{{SECRET}}`, `YOUR_KEY_HERE`, `CHANGE_ME`, `example`, `TODO`, `dummy`, `sample`
|
|
149
|
+
- **Test files**: `*.test.ts`, `*.spec.ts`, `__tests__/*` (entropy analysis only — patterns still apply)
|
|
150
|
+
- **Declaration files**: `*.d.ts` (entropy analysis only)
|
|
151
|
+
- **Comments**: Lines starting with `//`, `#`, `*`
|
|
152
|
+
|
|
153
|
+
### Output artifacts
|
|
154
|
+
|
|
155
|
+
| File | Format | Purpose |
|
|
156
|
+
|------|--------|---------|
|
|
157
|
+
| `.cto/audit/YYYY-MM-DD.jsonl` | JSON Lines (append-only) | Audit log — one entry per run. Run daily to build history. |
|
|
158
|
+
| `.cto/audit/report.md` | Markdown | Full report with findings table — share with team or compliance. |
|
|
159
|
+
| `.cto/.env.example` | Text | Auto-generated `.env` template with all detected variable names. |
|
|
160
|
+
|
|
161
|
+
### Audit log format (`.jsonl`)
|
|
162
|
+
|
|
163
|
+
Each line is a JSON object:
|
|
164
|
+
|
|
165
|
+
```json
|
|
166
|
+
{
|
|
167
|
+
"timestamp": "2026-02-24T23:38:00.000Z",
|
|
168
|
+
"version": "3.2.0",
|
|
169
|
+
"summary": {
|
|
170
|
+
"filesScanned": 179,
|
|
171
|
+
"filesWithSecrets": 12,
|
|
172
|
+
"totalFindings": 51,
|
|
173
|
+
"bySeverity": { "critical": 34, "high": 5, "medium": 12, "low": 0 },
|
|
174
|
+
"byType": { "api-key": 21, "private-key": 5, "aws-key": 4, "token": 4, "connection-string": 3, "password": 2, "pii": 12 }
|
|
175
|
+
},
|
|
176
|
+
"findings": [
|
|
177
|
+
{ "type": "api-key", "file": "src/config/stripe.ts", "line": 8, "severity": "critical", "redacted": "sk_l********************yZ" }
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Programmatic API
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
import { auditProject, scanContentForSecrets, scanContentForHighEntropy } from 'cto-ai-cli/govern';
|
|
186
|
+
|
|
187
|
+
// Full project audit
|
|
188
|
+
const result = await auditProject('/path/to/project', filePaths, {
|
|
189
|
+
customPatterns: ['MY_INTERNAL_TOKEN=[a-z0-9]+'], // optional extra patterns
|
|
190
|
+
entropyThreshold: 5.0, // default: 5.0
|
|
191
|
+
includePII: true, // default: true
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
console.log(result.summary); // { totalFindings, bySeverity, byType, ... }
|
|
195
|
+
console.log(result.findings); // SecretFinding[]
|
|
196
|
+
console.log(result.recommendations); // string[]
|
|
197
|
+
|
|
198
|
+
// Scan a single string
|
|
199
|
+
const findings = scanContentForSecrets(code, 'file.ts');
|
|
200
|
+
|
|
201
|
+
// Entropy-only scan
|
|
202
|
+
const entropyFindings = scanContentForHighEntropy(code, 'file.ts', 5.0);
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### CI/CD integration
|
|
206
|
+
|
|
207
|
+
When `CI=true` is set, `--audit` exits with code 1 if any critical or high-severity findings are detected. Use this in:
|
|
208
|
+
|
|
209
|
+
**GitHub Actions:**
|
|
210
|
+
```yaml
|
|
211
|
+
- name: CTO Security Audit
|
|
212
|
+
run: npx cto-ai-cli --audit
|
|
213
|
+
env:
|
|
214
|
+
CI: true
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**Pre-commit hook (`.husky/pre-commit`):**
|
|
218
|
+
```bash
|
|
219
|
+
CI=true npx cto-ai-cli --audit
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Recommendations engine
|
|
223
|
+
|
|
224
|
+
Based on findings, CTO generates actionable recommendations:
|
|
225
|
+
|
|
226
|
+
| Finding type | Recommendation |
|
|
227
|
+
|-------------|----------------|
|
|
228
|
+
| Any critical | "Rotate all detected credentials immediately" |
|
|
229
|
+
| `password` | "Move passwords to environment variables or a secrets manager" |
|
|
230
|
+
| `api-key` / `aws-key` | "Use environment variables. Never commit to source control" |
|
|
231
|
+
| `connection-string` | "Database connection strings should use environment variables" |
|
|
232
|
+
| `private-key` | "Private keys should NEVER be in source code. Use a key management service" |
|
|
233
|
+
| `pii` | "Review for GDPR/CCPA compliance. Consider data anonymization" |
|
|
234
|
+
| `high-entropy` | "High-entropy strings detected. Review manually" |
|
|
235
|
+
| Any finding | "Add .gitignore entry for .env files" + "Run --audit regularly or add to CI" |
|
|
236
|
+
|
|
86
237
|
---
|
|
87
238
|
|
|
88
239
|
## MCP Server
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
> **Early access** — This is a test version. We'd love your feedback.
|
|
4
4
|
|
|
5
5
|
[](LICENSE)
|
|
6
|
-
[](#)
|
|
7
7
|
|
|
8
8
|
## Try it now (zero install)
|
|
9
9
|
|
|
@@ -77,10 +77,15 @@ Without type definitions, the AI invents interfaces — wrong property names, wr
|
|
|
77
77
|
### Option 1: Quick score (no install)
|
|
78
78
|
|
|
79
79
|
```bash
|
|
80
|
-
npx cto-ai-cli
|
|
81
|
-
npx cto-ai-cli ./my-project
|
|
82
|
-
npx cto-ai-cli --
|
|
83
|
-
npx cto-ai-cli --
|
|
80
|
+
npx cto-ai-cli # Score your project
|
|
81
|
+
npx cto-ai-cli ./my-project # Score a specific project
|
|
82
|
+
npx cto-ai-cli --fix # Auto-generate optimized context files
|
|
83
|
+
npx cto-ai-cli --context "your task" # Task-specific context for AI prompts
|
|
84
|
+
npx cto-ai-cli --audit # Security audit: detect secrets & PII
|
|
85
|
+
npx cto-ai-cli --report # Shareable report + README badge
|
|
86
|
+
npx cto-ai-cli --compare # Compare your score vs popular projects
|
|
87
|
+
npx cto-ai-cli --benchmark # CTO vs naive vs random comparison
|
|
88
|
+
npx cto-ai-cli --json # Machine-readable output (for CI)
|
|
84
89
|
```
|
|
85
90
|
|
|
86
91
|
### Option 2: Full install
|
|
@@ -197,17 +202,119 @@ Without these files, the AI has to guess the shape of `AnalyzedFile`, `ContextSe
|
|
|
197
202
|
|
|
198
203
|
---
|
|
199
204
|
|
|
205
|
+
## 🔒 Security Audit — detect secrets before AI sees them
|
|
206
|
+
|
|
207
|
+
Every time you send code to an AI, there's a risk: **API keys, tokens, passwords, and PII hiding in your codebase.**
|
|
208
|
+
|
|
209
|
+
CTO now scans your entire project for secrets — before they end up in an AI prompt.
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
npx cto-ai-cli --audit
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
🔍 Running security audit...
|
|
217
|
+
|
|
218
|
+
╔══════════════════════════════════════════════════╗
|
|
219
|
+
║ ║
|
|
220
|
+
║ 🔴 Security Audit: CRITICAL ISSUES FOUND ║
|
|
221
|
+
║ ║
|
|
222
|
+
║ Files scanned: 179 ║
|
|
223
|
+
║ Files affected: 12 ║
|
|
224
|
+
║ Total findings: 51 ║
|
|
225
|
+
║ ║
|
|
226
|
+
╠══════════════════════════════════════════════════╣
|
|
227
|
+
║ ║
|
|
228
|
+
║ 🔴 Critical: 34 ║
|
|
229
|
+
║ 🟠 High: 5 ║
|
|
230
|
+
║ 🟡 Medium: 12 ║
|
|
231
|
+
║ ║
|
|
232
|
+
╚══════════════════════════════════════════════════╝
|
|
233
|
+
|
|
234
|
+
Findings:
|
|
235
|
+
|
|
236
|
+
🔴 CRITICAL src/config/stripe.ts:8
|
|
237
|
+
api-key: sk_l********************yZ
|
|
238
|
+
🔴 CRITICAL src/config/database.ts:14
|
|
239
|
+
connection-string: post********************db
|
|
240
|
+
🟠 HIGH src/utils/email.ts:22
|
|
241
|
+
pii: admi**********om
|
|
242
|
+
|
|
243
|
+
Recommendations:
|
|
244
|
+
|
|
245
|
+
🚨 CRITICAL: Rotate all detected credentials immediately.
|
|
246
|
+
💡 Use environment variables for API keys.
|
|
247
|
+
💡 Add a .gitignore entry for .env files.
|
|
248
|
+
|
|
249
|
+
📁 Audit artifacts:
|
|
250
|
+
📋 .cto/audit/2026-02-24.jsonl Audit log (append-only)
|
|
251
|
+
📊 .cto/audit/report.md Full report
|
|
252
|
+
📝 .cto/.env.example Template for environment variables
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### What it detects
|
|
256
|
+
|
|
257
|
+
| Category | Examples | Severity |
|
|
258
|
+
|----------|----------|----------|
|
|
259
|
+
| **API Keys** | OpenAI, Anthropic, Stripe, Google, SendGrid, Azure | 🔴 Critical |
|
|
260
|
+
| **Cloud credentials** | AWS Access Keys, AWS Secrets | 🔴 Critical |
|
|
261
|
+
| **Tokens** | GitHub, GitLab, Slack, npm, JWT | 🔴 Critical |
|
|
262
|
+
| **Private keys** | RSA, SSH, EC private keys | 🔴 Critical |
|
|
263
|
+
| **Database** | Connection strings (Postgres, MongoDB, Redis, MySQL) | 🔴 Critical |
|
|
264
|
+
| **Passwords** | Hardcoded passwords, DB passwords | 🟠 High |
|
|
265
|
+
| **PII** | Email addresses, possible SSNs | 🟡 Medium |
|
|
266
|
+
| **High-entropy strings** | Random strings that look like secrets (Shannon entropy analysis) | 🟡 Medium |
|
|
267
|
+
|
|
268
|
+
### How it works
|
|
269
|
+
|
|
270
|
+
1. **30+ regex patterns** — battle-tested patterns for known secret formats (AWS, Stripe, Slack, GitHub, etc.)
|
|
271
|
+
2. **Shannon entropy analysis** — detects random-looking strings that may be secrets, even if they don't match a known pattern
|
|
272
|
+
3. **Smart filtering** — skips placeholders (`${API_KEY}`), test files, comments, and common false positives
|
|
273
|
+
4. **Auto-redaction** — secrets are NEVER shown in full. All output uses redacted values (`sk_l**********yZ`)
|
|
274
|
+
|
|
275
|
+
### What it generates
|
|
276
|
+
|
|
277
|
+
| File | Purpose |
|
|
278
|
+
|------|---------|
|
|
279
|
+
| `.cto/audit/YYYY-MM-DD.jsonl` | Append-only audit log (run it daily, keep history) |
|
|
280
|
+
| `.cto/audit/report.md` | Full markdown report — share with your team or compliance |
|
|
281
|
+
| `.cto/.env.example` | Auto-generated template with all detected env variable names |
|
|
282
|
+
|
|
283
|
+
### CI/CD integration
|
|
284
|
+
|
|
285
|
+
Set `CI=true` and the audit will **exit with code 1** if critical or high-severity secrets are found:
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
CI=true npx cto-ai-cli --audit
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Perfect for pre-commit hooks or CI pipelines — block PRs that contain secrets before they reach production or an AI prompt.
|
|
292
|
+
|
|
293
|
+
### Why this matters
|
|
294
|
+
|
|
295
|
+
Every day, developers accidentally send secrets to AI tools:
|
|
296
|
+
- Copilot autocompletes with your `.env` values in context
|
|
297
|
+
- You paste a file into ChatGPT that has a hardcoded API key
|
|
298
|
+
- Cursor reads your database config with connection strings
|
|
299
|
+
|
|
300
|
+
**CTO catches these before they leave your machine.** Zero external calls. Everything runs locally.
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
200
304
|
## What you can do with CTO
|
|
201
305
|
|
|
202
306
|
| Use case | How |
|
|
203
307
|
|----------|-----|
|
|
204
308
|
| **Score your project** | `npx cto-ai-cli` |
|
|
205
|
-
| **
|
|
206
|
-
| **
|
|
207
|
-
| **
|
|
309
|
+
| **Auto-optimize context** | `npx cto-ai-cli --fix` → generates `.cto/context.md` to paste into AI |
|
|
310
|
+
| **Task-specific context** | `npx cto-ai-cli --context "refactor auth"` → optimized for your task |
|
|
311
|
+
| **Security audit** | `npx cto-ai-cli --audit` → detect secrets & PII before AI sees them |
|
|
312
|
+
| **Shareable report** | `npx cto-ai-cli --report` → markdown report + README badge |
|
|
313
|
+
| **Compare vs open source** | `npx cto-ai-cli --compare` → your score vs Zod, Next.js, Express |
|
|
314
|
+
| **Compare strategies** | `npx cto-ai-cli --benchmark` → CTO vs naive vs random |
|
|
315
|
+
| **Get context for a task** | `cto2 interact "your task"` |
|
|
208
316
|
| **Use in your AI editor** | Add MCP server (see setup above) |
|
|
209
|
-
| **
|
|
210
|
-
| **Use as an API** | `cto2-api` starts an HTTP server |
|
|
317
|
+
| **Block secrets in CI** | `CI=true npx cto-ai-cli --audit` |
|
|
211
318
|
| **JSON output (scripting)** | `npx cto-ai-cli --json` |
|
|
212
319
|
|
|
213
320
|
---
|
|
@@ -226,10 +333,12 @@ This is an early test version. Here's what we know:
|
|
|
226
333
|
## What's next
|
|
227
334
|
|
|
228
335
|
We're working on:
|
|
229
|
-
- **
|
|
230
|
-
- **
|
|
231
|
-
- **
|
|
232
|
-
- **
|
|
336
|
+
- **Context Gateway** — proxy between your team and any AI, with automatic context optimization and cost tracking
|
|
337
|
+
- **Monorepo intelligence** — package-aware selection for large monorepos (60-80% more token savings)
|
|
338
|
+
- **CI Quality Gate** — GitHub Action that posts context score and secret audit on every PR
|
|
339
|
+
- **VS Code extension** — live score, risk indicators, and context suggestions inline
|
|
340
|
+
- **Learning mode** — CTO improves based on which AI suggestions you accept/reject
|
|
341
|
+
- **More language support** — deeper analysis for Python, Go, and Rust
|
|
233
342
|
- **Your feedback** — [open an issue](https://github.com/cto-ai/cto-ai-cli/issues) or reach out
|
|
234
343
|
|
|
235
344
|
---
|
|
@@ -241,7 +350,7 @@ git clone <repo-url>
|
|
|
241
350
|
cd cto
|
|
242
351
|
npm install
|
|
243
352
|
npm run build
|
|
244
|
-
npm test #
|
|
353
|
+
npm test # 449 tests
|
|
245
354
|
npm run typecheck # strict TypeScript
|
|
246
355
|
```
|
|
247
356
|
|
package/dist/action/index.js
CHANGED
|
@@ -24324,7 +24324,29 @@ var BUILTIN_PATTERNS = [
|
|
|
24324
24324
|
{ type: "connection-string", source: `(?:mongodb(?:\\+srv)?|postgres(?:ql)?|mysql|redis|amqp):\\/\\/[^\\s'"]+:[^\\s'"]+@[^\\s'"]+`, flags: "gi", severity: "critical", description: "Database Connection String" },
|
|
24325
24325
|
{ type: "connection-string", source: `(?:DATABASE_URL|REDIS_URL|MONGODB_URI)\\s*[:=]\\s*['"]?([^\\s'"]{10,})['"]?`, flags: "gi", severity: "high", description: "Database URL" },
|
|
24326
24326
|
// Environment variables with secrets
|
|
24327
|
-
{ type: "env-variable", source: `(?:SECRET|PRIVATE|ENCRYPTION)[_-]?(?:KEY|TOKEN|PASS)\\s*[:=]\\s*['"]?([^\\s'"]{8,})['"]?`, flags: "gi", severity: "high", description: "Secret Environment Variable" }
|
|
24327
|
+
{ type: "env-variable", source: `(?:SECRET|PRIVATE|ENCRYPTION)[_-]?(?:KEY|TOKEN|PASS)\\s*[:=]\\s*['"]?([^\\s'"]{8,})['"]?`, flags: "gi", severity: "high", description: "Secret Environment Variable" },
|
|
24328
|
+
// Stripe
|
|
24329
|
+
{ type: "api-key", source: "sk_live_[a-zA-Z0-9]{24,}", flags: "g", severity: "critical", description: "Stripe Live Secret Key" },
|
|
24330
|
+
{ type: "api-key", source: "pk_live_[a-zA-Z0-9]{24,}", flags: "g", severity: "high", description: "Stripe Live Publishable Key" },
|
|
24331
|
+
{ type: "api-key", source: "rk_live_[a-zA-Z0-9]{24,}", flags: "g", severity: "critical", description: "Stripe Restricted Key" },
|
|
24332
|
+
// Slack
|
|
24333
|
+
{ type: "token", source: "xoxb-[0-9]{10,}-[0-9]{10,}-[a-zA-Z0-9]{24,}", flags: "g", severity: "critical", description: "Slack Bot Token" },
|
|
24334
|
+
{ type: "token", source: "xoxp-[0-9]{10,}-[0-9]{10,}-[a-zA-Z0-9]{24,}", flags: "g", severity: "critical", description: "Slack User Token" },
|
|
24335
|
+
{ type: "api-key", source: "https://hooks\\.slack\\.com/services/T[a-zA-Z0-9_]+/B[a-zA-Z0-9_]+/[a-zA-Z0-9_]+", flags: "g", severity: "high", description: "Slack Webhook URL" },
|
|
24336
|
+
// Google
|
|
24337
|
+
{ type: "api-key", source: "AIza[0-9A-Za-z_-]{35}", flags: "g", severity: "high", description: "Google API Key" },
|
|
24338
|
+
{ type: "token", source: "ya29\\.[0-9A-Za-z_-]+", flags: "g", severity: "high", description: "Google OAuth Token" },
|
|
24339
|
+
// Azure
|
|
24340
|
+
{ type: "api-key", source: "(?:AccountKey|SharedAccessKey)\\s*=\\s*[a-zA-Z0-9+/=]{40,}", flags: "g", severity: "critical", description: "Azure Storage Key" },
|
|
24341
|
+
// Twilio
|
|
24342
|
+
{ type: "api-key", source: "AC[a-f0-9]{32}", flags: "g", severity: "high", description: "Twilio Account SID" },
|
|
24343
|
+
// SendGrid
|
|
24344
|
+
{ type: "api-key", source: "SG\\.[a-zA-Z0-9_-]{22}\\.[a-zA-Z0-9_-]{43}", flags: "g", severity: "critical", description: "SendGrid API Key" },
|
|
24345
|
+
// JWT
|
|
24346
|
+
{ type: "token", source: "eyJ[a-zA-Z0-9_-]{10,}\\.eyJ[a-zA-Z0-9_-]{10,}\\.[a-zA-Z0-9_-]{10,}", flags: "g", severity: "high", description: "JSON Web Token" },
|
|
24347
|
+
// PII
|
|
24348
|
+
{ type: "pii", source: "\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b", flags: "g", severity: "medium", description: "Email Address (PII)" },
|
|
24349
|
+
{ type: "pii", source: "\\b\\d{3}[-.]?\\d{2}[-.]?\\d{4}\\b", flags: "g", severity: "high", description: "Possible SSN (PII)" }
|
|
24328
24350
|
];
|
|
24329
24351
|
function buildPatterns(customPatterns = []) {
|
|
24330
24352
|
const patterns = BUILTIN_PATTERNS.map((def) => ({
|
package/dist/api/dashboard.js
CHANGED
|
@@ -829,7 +829,29 @@ var BUILTIN_PATTERNS = [
|
|
|
829
829
|
{ type: "connection-string", source: `(?:mongodb(?:\\+srv)?|postgres(?:ql)?|mysql|redis|amqp):\\/\\/[^\\s'"]+:[^\\s'"]+@[^\\s'"]+`, flags: "gi", severity: "critical", description: "Database Connection String" },
|
|
830
830
|
{ type: "connection-string", source: `(?:DATABASE_URL|REDIS_URL|MONGODB_URI)\\s*[:=]\\s*['"]?([^\\s'"]{10,})['"]?`, flags: "gi", severity: "high", description: "Database URL" },
|
|
831
831
|
// Environment variables with secrets
|
|
832
|
-
{ type: "env-variable", source: `(?:SECRET|PRIVATE|ENCRYPTION)[_-]?(?:KEY|TOKEN|PASS)\\s*[:=]\\s*['"]?([^\\s'"]{8,})['"]?`, flags: "gi", severity: "high", description: "Secret Environment Variable" }
|
|
832
|
+
{ type: "env-variable", source: `(?:SECRET|PRIVATE|ENCRYPTION)[_-]?(?:KEY|TOKEN|PASS)\\s*[:=]\\s*['"]?([^\\s'"]{8,})['"]?`, flags: "gi", severity: "high", description: "Secret Environment Variable" },
|
|
833
|
+
// Stripe
|
|
834
|
+
{ type: "api-key", source: "sk_live_[a-zA-Z0-9]{24,}", flags: "g", severity: "critical", description: "Stripe Live Secret Key" },
|
|
835
|
+
{ type: "api-key", source: "pk_live_[a-zA-Z0-9]{24,}", flags: "g", severity: "high", description: "Stripe Live Publishable Key" },
|
|
836
|
+
{ type: "api-key", source: "rk_live_[a-zA-Z0-9]{24,}", flags: "g", severity: "critical", description: "Stripe Restricted Key" },
|
|
837
|
+
// Slack
|
|
838
|
+
{ type: "token", source: "xoxb-[0-9]{10,}-[0-9]{10,}-[a-zA-Z0-9]{24,}", flags: "g", severity: "critical", description: "Slack Bot Token" },
|
|
839
|
+
{ type: "token", source: "xoxp-[0-9]{10,}-[0-9]{10,}-[a-zA-Z0-9]{24,}", flags: "g", severity: "critical", description: "Slack User Token" },
|
|
840
|
+
{ type: "api-key", source: "https://hooks\\.slack\\.com/services/T[a-zA-Z0-9_]+/B[a-zA-Z0-9_]+/[a-zA-Z0-9_]+", flags: "g", severity: "high", description: "Slack Webhook URL" },
|
|
841
|
+
// Google
|
|
842
|
+
{ type: "api-key", source: "AIza[0-9A-Za-z_-]{35}", flags: "g", severity: "high", description: "Google API Key" },
|
|
843
|
+
{ type: "token", source: "ya29\\.[0-9A-Za-z_-]+", flags: "g", severity: "high", description: "Google OAuth Token" },
|
|
844
|
+
// Azure
|
|
845
|
+
{ type: "api-key", source: "(?:AccountKey|SharedAccessKey)\\s*=\\s*[a-zA-Z0-9+/=]{40,}", flags: "g", severity: "critical", description: "Azure Storage Key" },
|
|
846
|
+
// Twilio
|
|
847
|
+
{ type: "api-key", source: "AC[a-f0-9]{32}", flags: "g", severity: "high", description: "Twilio Account SID" },
|
|
848
|
+
// SendGrid
|
|
849
|
+
{ type: "api-key", source: "SG\\.[a-zA-Z0-9_-]{22}\\.[a-zA-Z0-9_-]{43}", flags: "g", severity: "critical", description: "SendGrid API Key" },
|
|
850
|
+
// JWT
|
|
851
|
+
{ type: "token", source: "eyJ[a-zA-Z0-9_-]{10,}\\.eyJ[a-zA-Z0-9_-]{10,}\\.[a-zA-Z0-9_-]{10,}", flags: "g", severity: "high", description: "JSON Web Token" },
|
|
852
|
+
// PII
|
|
853
|
+
{ type: "pii", source: "\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b", flags: "g", severity: "medium", description: "Email Address (PII)" },
|
|
854
|
+
{ type: "pii", source: "\\b\\d{3}[-.]?\\d{2}[-.]?\\d{4}\\b", flags: "g", severity: "high", description: "Possible SSN (PII)" }
|
|
833
855
|
];
|
|
834
856
|
function buildPatterns(customPatterns = []) {
|
|
835
857
|
const patterns = BUILTIN_PATTERNS.map((def) => ({
|