claude-code-templates 1.22.0 → 1.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -0
- package/bin/create-claude-config.js +1 -0
- package/package.json +7 -2
- package/src/analytics-web/chats_mobile.html +17 -16
- package/src/console-bridge.js +3 -3
- package/src/index.js +183 -9
- package/src/security-audit.js +164 -0
- package/src/validation/ARCHITECTURE.md +309 -0
- package/src/validation/BaseValidator.js +152 -0
- package/src/validation/README.md +543 -0
- package/src/validation/ValidationOrchestrator.js +305 -0
- package/src/validation/validators/IntegrityValidator.js +338 -0
- package/src/validation/validators/ProvenanceValidator.js +399 -0
- package/src/validation/validators/ReferenceValidator.js +373 -0
- package/src/validation/validators/SemanticValidator.js +449 -0
- package/src/validation/validators/StructuralValidator.js +376 -0
|
@@ -0,0 +1,543 @@
|
|
|
1
|
+
# Security Validation System
|
|
2
|
+
|
|
3
|
+
Comprehensive security validation for Claude Code Templates components based on industry standards (npm 2025, PyPI, GitHub Package Registry, SLSA Framework).
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Overview](#overview)
|
|
8
|
+
- [Quick Start](#quick-start)
|
|
9
|
+
- [Validation Tiers](#validation-tiers)
|
|
10
|
+
- [CLI Usage](#cli-usage)
|
|
11
|
+
- [CI/CD Integration](#cicd-integration)
|
|
12
|
+
- [Architecture](#architecture)
|
|
13
|
+
- [Error Codes](#error-codes)
|
|
14
|
+
- [Best Practices](#best-practices)
|
|
15
|
+
|
|
16
|
+
## Overview
|
|
17
|
+
|
|
18
|
+
The Security Validation System ensures that all components in the repository are safe, trustworthy, and meet quality standards before distribution. It validates components across 5 tiers:
|
|
19
|
+
|
|
20
|
+
1. **Structural Validation** - YAML frontmatter, file format, encoding
|
|
21
|
+
2. **Integrity Validation** - SHA256 hashing, tamper detection
|
|
22
|
+
3. **Semantic Validation** - Prompt injection, jailbreaks, malicious patterns
|
|
23
|
+
4. **Reference Validation** - URLs, external links, SSRF prevention
|
|
24
|
+
5. **Provenance Validation** - Author metadata, repository info, Git history
|
|
25
|
+
|
|
26
|
+
### Key Features
|
|
27
|
+
|
|
28
|
+
- ✅ **372+ components validated** - Agents, commands, settings, hooks
|
|
29
|
+
- 🔒 **10+ security patterns detected** - Jailbreaks, prompt injection, XSS
|
|
30
|
+
- 📊 **Trust scoring (0-100)** - Overall security score per component
|
|
31
|
+
- 🔗 **Hash tracking** - SHA256 hashes for tamper detection
|
|
32
|
+
- ⚡ **Fast validation** - Completes in ~20 seconds for 372 components
|
|
33
|
+
- 🤖 **GitHub Actions integration** - Automatic PR validation
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
### Run Security Audit Locally
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# From repository root
|
|
41
|
+
cd cli-tool
|
|
42
|
+
npm run security-audit
|
|
43
|
+
|
|
44
|
+
# With verbose output
|
|
45
|
+
npm run security-audit:verbose
|
|
46
|
+
|
|
47
|
+
# Generate JSON report
|
|
48
|
+
npm run security-audit:json
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Example Output
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
🔒 Claude Code Templates - Security Audit
|
|
55
|
+
|
|
56
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
57
|
+
📁 Scanning components directory...
|
|
58
|
+
Found 372 components
|
|
59
|
+
|
|
60
|
+
🔍 Running security validation...
|
|
61
|
+
|
|
62
|
+
📊 Validation Summary:
|
|
63
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
64
|
+
Total components: 372
|
|
65
|
+
✅ Passed: 123
|
|
66
|
+
❌ Failed: 249
|
|
67
|
+
⚠️ Warnings: 938
|
|
68
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Validation Tiers
|
|
72
|
+
|
|
73
|
+
### 1. Structural Validation
|
|
74
|
+
|
|
75
|
+
Validates component structure, format, and metadata.
|
|
76
|
+
|
|
77
|
+
**Checks:**
|
|
78
|
+
- ✅ Valid YAML frontmatter
|
|
79
|
+
- ✅ Required fields present (name, description, tools)
|
|
80
|
+
- ✅ File size limits (< 100KB)
|
|
81
|
+
- ✅ UTF-8 encoding
|
|
82
|
+
- ✅ Valid tool names (Read, Write, Edit, Bash, Glob, Grep, *)
|
|
83
|
+
- ✅ Valid model names (sonnet, opus, haiku)
|
|
84
|
+
- ✅ Section count (< 20 sections)
|
|
85
|
+
|
|
86
|
+
**Error Codes:** `STRUCT_E001` - `STRUCT_E010`
|
|
87
|
+
**Warning Codes:** `STRUCT_W001` - `STRUCT_W011`
|
|
88
|
+
|
|
89
|
+
### 2. Integrity Validation
|
|
90
|
+
|
|
91
|
+
Ensures components haven't been tampered with.
|
|
92
|
+
|
|
93
|
+
**Checks:**
|
|
94
|
+
- ✅ Generate SHA256 hash
|
|
95
|
+
- ✅ Track hash in registry (`.claude/security/component-hashes.json`)
|
|
96
|
+
- ✅ Detect content changes
|
|
97
|
+
- ✅ Validate semantic versioning
|
|
98
|
+
|
|
99
|
+
**Error Codes:** `INT_E001` - `INT_E003`
|
|
100
|
+
**Info Codes:** `INT_I001` - `INT_I005`
|
|
101
|
+
|
|
102
|
+
### 3. Semantic Validation
|
|
103
|
+
|
|
104
|
+
Detects malicious content and prompt injection attempts.
|
|
105
|
+
|
|
106
|
+
**Dangerous Patterns Detected:**
|
|
107
|
+
|
|
108
|
+
- 🚫 **Prompt Injection:**
|
|
109
|
+
- "ignore previous instructions"
|
|
110
|
+
- "ignore all previous instructions"
|
|
111
|
+
- "disregard all prior directives"
|
|
112
|
+
|
|
113
|
+
- 🚫 **Jailbreaks:**
|
|
114
|
+
- "you are now a..."
|
|
115
|
+
- "system prompt"
|
|
116
|
+
- "developer instructions"
|
|
117
|
+
|
|
118
|
+
- 🚫 **Code Execution:**
|
|
119
|
+
- "execute the following code"
|
|
120
|
+
- "run this command"
|
|
121
|
+
|
|
122
|
+
- 🚫 **Credential Harvesting:**
|
|
123
|
+
- "fetch...token/key/password"
|
|
124
|
+
- Hardcoded API keys, passwords
|
|
125
|
+
|
|
126
|
+
- 🚫 **XSS & Injection:**
|
|
127
|
+
- `<script>`, `<iframe>`
|
|
128
|
+
- `javascript:`, `data:`
|
|
129
|
+
- Event handlers (onclick, onerror)
|
|
130
|
+
|
|
131
|
+
- 🚫 **Dangerous Commands:**
|
|
132
|
+
- `rm -rf /`
|
|
133
|
+
- Fork bombs: `:(){ :|:& };:`
|
|
134
|
+
- `dd if=/dev/zero of=/dev/sda`
|
|
135
|
+
|
|
136
|
+
**Error Codes:** `SEM_E001` - `SEM_E008`
|
|
137
|
+
**Warning Codes:** `SEM_W001` - `SEM_W004`
|
|
138
|
+
|
|
139
|
+
### 4. Reference Validation
|
|
140
|
+
|
|
141
|
+
Validates external URLs and prevents SSRF attacks.
|
|
142
|
+
|
|
143
|
+
**Checks:**
|
|
144
|
+
- ✅ Extract all URLs from markdown
|
|
145
|
+
- ✅ Block dangerous protocols (file://, javascript:, data:)
|
|
146
|
+
- ✅ Detect private IP addresses (127.0.0.1, 10.x.x.x, 192.168.x.x)
|
|
147
|
+
- ✅ Flag suspicious TLDs (.tk, .ml, .ga, .zip)
|
|
148
|
+
- ✅ HTTPS enforcement (optional strict mode)
|
|
149
|
+
|
|
150
|
+
**Error Codes:** `REF_E001` - `REF_E005`
|
|
151
|
+
**Warning Codes:** `REF_W001` - `REF_W003`
|
|
152
|
+
|
|
153
|
+
### 5. Provenance Validation
|
|
154
|
+
|
|
155
|
+
Validates component authorship and origin.
|
|
156
|
+
|
|
157
|
+
**Checks:**
|
|
158
|
+
- ✅ Author metadata in frontmatter
|
|
159
|
+
- ✅ Repository information
|
|
160
|
+
- ✅ Version tracking
|
|
161
|
+
- ✅ Git commit SHA, author, date
|
|
162
|
+
- ✅ Repository platform validation (github.com, gitlab.com)
|
|
163
|
+
|
|
164
|
+
**Error Codes:** `PROV_E001` - `PROV_E003`
|
|
165
|
+
**Warning Codes:** `PROV_W001` - `PROV_W003`
|
|
166
|
+
|
|
167
|
+
## CLI Usage
|
|
168
|
+
|
|
169
|
+
### Basic Commands
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# Run validation on all components
|
|
173
|
+
npm run security-audit
|
|
174
|
+
|
|
175
|
+
# Verbose output with detailed errors
|
|
176
|
+
npm run security-audit:verbose
|
|
177
|
+
|
|
178
|
+
# Generate JSON report
|
|
179
|
+
npm run security-audit:json
|
|
180
|
+
|
|
181
|
+
# CI mode (fails on errors)
|
|
182
|
+
npm run security-audit:ci
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Direct Execution
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
# From cli-tool directory
|
|
189
|
+
node src/security-audit.js [options]
|
|
190
|
+
|
|
191
|
+
# Options:
|
|
192
|
+
# --ci Exit with code 1 on errors (for CI/CD)
|
|
193
|
+
# --verbose, -v Show detailed validation results
|
|
194
|
+
# --json Output results as JSON
|
|
195
|
+
# --output=FILE Save JSON report to file
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Examples
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
# Local development - show all details
|
|
202
|
+
npm run security-audit:verbose
|
|
203
|
+
|
|
204
|
+
# Generate report for review
|
|
205
|
+
npm run security-audit:json > my-report.json
|
|
206
|
+
|
|
207
|
+
# CI/CD pipeline - fail on errors
|
|
208
|
+
npm run security-audit:ci
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## CI/CD Integration
|
|
212
|
+
|
|
213
|
+
### GitHub Actions Workflow
|
|
214
|
+
|
|
215
|
+
The repository includes a GitHub Actions workflow that automatically validates components on:
|
|
216
|
+
- ✅ Pull requests modifying components
|
|
217
|
+
- ✅ Pushes to main branch
|
|
218
|
+
|
|
219
|
+
**File:** `.github/workflows/component-security-validation.yml`
|
|
220
|
+
|
|
221
|
+
```yaml
|
|
222
|
+
name: Component Security Validation
|
|
223
|
+
|
|
224
|
+
on:
|
|
225
|
+
pull_request:
|
|
226
|
+
paths:
|
|
227
|
+
- 'cli-tool/components/**'
|
|
228
|
+
push:
|
|
229
|
+
branches:
|
|
230
|
+
- main
|
|
231
|
+
paths:
|
|
232
|
+
- 'cli-tool/components/**'
|
|
233
|
+
|
|
234
|
+
jobs:
|
|
235
|
+
validate:
|
|
236
|
+
runs-on: ubuntu-latest
|
|
237
|
+
steps:
|
|
238
|
+
- uses: actions/checkout@v4
|
|
239
|
+
- uses: actions/setup-node@v4
|
|
240
|
+
with:
|
|
241
|
+
node-version: '20'
|
|
242
|
+
|
|
243
|
+
- name: Install dependencies
|
|
244
|
+
working-directory: cli-tool
|
|
245
|
+
run: npm install
|
|
246
|
+
|
|
247
|
+
- name: Run security validation
|
|
248
|
+
working-directory: cli-tool
|
|
249
|
+
run: npm run security-audit:ci
|
|
250
|
+
|
|
251
|
+
- name: Upload security report
|
|
252
|
+
if: always()
|
|
253
|
+
uses: actions/upload-artifact@v4
|
|
254
|
+
with:
|
|
255
|
+
name: security-report
|
|
256
|
+
path: cli-tool/security-report.json
|
|
257
|
+
retention-days: 30
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### PR Comment Bot
|
|
261
|
+
|
|
262
|
+
The workflow automatically posts validation results as PR comments:
|
|
263
|
+
|
|
264
|
+
```markdown
|
|
265
|
+
## 🔒 Security Validation Results
|
|
266
|
+
|
|
267
|
+
**Status:** ❌ Failed
|
|
268
|
+
|
|
269
|
+
### Summary
|
|
270
|
+
- Total Components: 15
|
|
271
|
+
- Passed: 12
|
|
272
|
+
- Failed: 3
|
|
273
|
+
- Warnings: 8
|
|
274
|
+
|
|
275
|
+
### Failed Components
|
|
276
|
+
1. agents/security/penetration-tester.md
|
|
277
|
+
- Error: Dangerous command detected: `rm -rf /tmp`
|
|
278
|
+
- Score: 50/100
|
|
279
|
+
|
|
280
|
+
[View Full Report](artifacts/security-report.json)
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## Architecture
|
|
284
|
+
|
|
285
|
+
### Module Structure
|
|
286
|
+
|
|
287
|
+
```
|
|
288
|
+
cli-tool/src/validation/
|
|
289
|
+
├── ARCHITECTURE.md # Detailed architecture documentation
|
|
290
|
+
├── README.md # This file
|
|
291
|
+
├── BaseValidator.js # Abstract base class for validators
|
|
292
|
+
├── ValidationOrchestrator.js # Coordinates all validators
|
|
293
|
+
└── validators/
|
|
294
|
+
├── StructuralValidator.js
|
|
295
|
+
├── IntegrityValidator.js
|
|
296
|
+
├── SemanticValidator.js
|
|
297
|
+
├── ReferenceValidator.js
|
|
298
|
+
└── ProvenanceValidator.js
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### Validator Lifecycle
|
|
302
|
+
|
|
303
|
+
```
|
|
304
|
+
1. Component Scanning
|
|
305
|
+
↓
|
|
306
|
+
2. Content Reading
|
|
307
|
+
↓
|
|
308
|
+
3. Parallel Validation
|
|
309
|
+
├── StructuralValidator
|
|
310
|
+
├── IntegrityValidator
|
|
311
|
+
├── SemanticValidator
|
|
312
|
+
├── ReferenceValidator
|
|
313
|
+
└── ProvenanceValidator
|
|
314
|
+
↓
|
|
315
|
+
4. Result Aggregation
|
|
316
|
+
↓
|
|
317
|
+
5. Report Generation
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### Scoring Algorithm
|
|
321
|
+
|
|
322
|
+
```javascript
|
|
323
|
+
componentScore = (
|
|
324
|
+
structuralScore * 0.25 +
|
|
325
|
+
integrityScore * 0.20 +
|
|
326
|
+
semanticScore * 0.30 +
|
|
327
|
+
referencesScore * 0.15 +
|
|
328
|
+
provenanceScore * 0.10
|
|
329
|
+
)
|
|
330
|
+
|
|
331
|
+
validatorScore = max(0, 100 - (errors * 25) - (warnings * 5))
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
## Error Codes
|
|
335
|
+
|
|
336
|
+
### Structural (STRUCT_*)
|
|
337
|
+
|
|
338
|
+
| Code | Type | Message |
|
|
339
|
+
|------|------|---------|
|
|
340
|
+
| `STRUCT_E001` | Error | No YAML frontmatter found |
|
|
341
|
+
| `STRUCT_E002` | Error | Invalid YAML syntax |
|
|
342
|
+
| `STRUCT_E003` | Error | Missing required field: {field} |
|
|
343
|
+
| `STRUCT_E004` | Error | File too large (> 100KB) |
|
|
344
|
+
| `STRUCT_E010` | Error | Invalid UTF-8 encoding |
|
|
345
|
+
| `STRUCT_W006` | Warning | Unknown tools specified |
|
|
346
|
+
| `STRUCT_W011` | Warning | Too many sections (>20) |
|
|
347
|
+
|
|
348
|
+
### Integrity (INT_*)
|
|
349
|
+
|
|
350
|
+
| Code | Type | Message |
|
|
351
|
+
|------|------|---------|
|
|
352
|
+
| `INT_E001` | Error | Content changed since last validation |
|
|
353
|
+
| `INT_E002` | Error | Invalid semantic version format |
|
|
354
|
+
| `INT_I001` | Info | Generated SHA256 hash |
|
|
355
|
+
| `INT_I005` | Info | Component not in registry (new) |
|
|
356
|
+
|
|
357
|
+
### Semantic (SEM_*)
|
|
358
|
+
|
|
359
|
+
| Code | Type | Message |
|
|
360
|
+
|------|------|---------|
|
|
361
|
+
| `SEM_E001` | Error | Prompt injection detected: {pattern} |
|
|
362
|
+
| `SEM_E002` | Error | Jailbreak attempt detected: {pattern} |
|
|
363
|
+
| `SEM_E003` | Error | Code execution pattern detected |
|
|
364
|
+
| `SEM_E004` | Error | Credential harvesting detected |
|
|
365
|
+
| `SEM_E005` | Error | HTML injection detected: {tag} |
|
|
366
|
+
| `SEM_E006` | Error | Hardcoded credentials detected |
|
|
367
|
+
| `SEM_E007` | Error | Dangerous command detected: {command} |
|
|
368
|
+
|
|
369
|
+
### References (REF_*)
|
|
370
|
+
|
|
371
|
+
| Code | Type | Message |
|
|
372
|
+
|------|------|---------|
|
|
373
|
+
| `REF_E001` | Error | Dangerous protocol: {protocol} |
|
|
374
|
+
| `REF_E002` | Error | Private IP address detected |
|
|
375
|
+
| `REF_E003` | Error | SSRF attempt via private network |
|
|
376
|
+
| `REF_W001` | Warning | Suspicious TLD: {tld} |
|
|
377
|
+
| `REF_W002` | Warning | HTTP URL (should use HTTPS) |
|
|
378
|
+
|
|
379
|
+
### Provenance (PROV_*)
|
|
380
|
+
|
|
381
|
+
| Code | Type | Message |
|
|
382
|
+
|------|------|---------|
|
|
383
|
+
| `PROV_E001` | Error | Missing author information |
|
|
384
|
+
| `PROV_W001` | Warning | No repository information |
|
|
385
|
+
| `PROV_W002` | Warning | No version specified |
|
|
386
|
+
|
|
387
|
+
## Best Practices
|
|
388
|
+
|
|
389
|
+
### For Component Authors
|
|
390
|
+
|
|
391
|
+
1. **Include Complete Frontmatter:**
|
|
392
|
+
```yaml
|
|
393
|
+
---
|
|
394
|
+
name: my-agent
|
|
395
|
+
description: Clear description
|
|
396
|
+
author: Your Name
|
|
397
|
+
version: 1.0.0
|
|
398
|
+
repository: https://github.com/user/repo
|
|
399
|
+
tools:
|
|
400
|
+
- Read
|
|
401
|
+
- Write
|
|
402
|
+
model: sonnet
|
|
403
|
+
---
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
2. **Avoid Dangerous Patterns:**
|
|
407
|
+
- Don't include executable shell commands
|
|
408
|
+
- No hardcoded credentials or API keys
|
|
409
|
+
- Avoid instructing Claude to ignore security rules
|
|
410
|
+
- Use HTTPS URLs only
|
|
411
|
+
|
|
412
|
+
3. **Keep Components Concise:**
|
|
413
|
+
- File size < 50KB (max 100KB)
|
|
414
|
+
- Sections < 15 (max 20)
|
|
415
|
+
- Clear, focused instructions
|
|
416
|
+
|
|
417
|
+
4. **Test Before Submitting:**
|
|
418
|
+
```bash
|
|
419
|
+
npm run security-audit:verbose
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
### For Repository Maintainers
|
|
423
|
+
|
|
424
|
+
1. **Review PR Validation Results:**
|
|
425
|
+
- Check GitHub Actions status
|
|
426
|
+
- Review security scores
|
|
427
|
+
- Investigate failed components
|
|
428
|
+
|
|
429
|
+
2. **Monitor Hash Changes:**
|
|
430
|
+
- Unexpected hash changes indicate tampering
|
|
431
|
+
- Review `.claude/security/component-hashes.json`
|
|
432
|
+
|
|
433
|
+
3. **Update Validation Rules:**
|
|
434
|
+
- Add new dangerous patterns to SemanticValidator
|
|
435
|
+
- Adjust scoring thresholds if needed
|
|
436
|
+
- Keep validators up to date
|
|
437
|
+
|
|
438
|
+
4. **Regular Audits:**
|
|
439
|
+
```bash
|
|
440
|
+
npm run security-audit:json
|
|
441
|
+
# Review security-report.json
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
## Integration with Component Generation
|
|
445
|
+
|
|
446
|
+
The security validation system integrates with `generate_components_json.py`:
|
|
447
|
+
|
|
448
|
+
1. **Automatic Validation** - Runs before generating components.json
|
|
449
|
+
2. **Metadata Inclusion** - Security scores, hashes, validation status
|
|
450
|
+
3. **Download Statistics** - Combined with Supabase analytics
|
|
451
|
+
|
|
452
|
+
**Generated metadata:**
|
|
453
|
+
```json
|
|
454
|
+
{
|
|
455
|
+
"name": "frontend-developer",
|
|
456
|
+
"security": {
|
|
457
|
+
"validated": true,
|
|
458
|
+
"valid": true,
|
|
459
|
+
"score": 96,
|
|
460
|
+
"errorCount": 0,
|
|
461
|
+
"warningCount": 2,
|
|
462
|
+
"lastValidated": "2025-10-15T20:07:37.583Z",
|
|
463
|
+
"hash": "eb5f9f4978b71ba06f129c73f5573a58...",
|
|
464
|
+
"validators": {
|
|
465
|
+
"structural": true,
|
|
466
|
+
"integrity": true,
|
|
467
|
+
"semantic": true,
|
|
468
|
+
"references": true,
|
|
469
|
+
"provenance": true
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
## Troubleshooting
|
|
476
|
+
|
|
477
|
+
### Common Issues
|
|
478
|
+
|
|
479
|
+
**Issue:** Components directory not found
|
|
480
|
+
```bash
|
|
481
|
+
# Solution: Run from correct directory
|
|
482
|
+
cd cli-tool
|
|
483
|
+
npm run security-audit
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
**Issue:** Hash registry conflicts
|
|
487
|
+
```bash
|
|
488
|
+
# Solution: Clear and regenerate
|
|
489
|
+
rm -rf .claude/security/component-hashes.json
|
|
490
|
+
npm run security-audit
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
**Issue:** False positives in semantic validation
|
|
494
|
+
```bash
|
|
495
|
+
# Solution: Review SemanticValidator.js patterns
|
|
496
|
+
# Adjust regex patterns if needed
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
### Performance Optimization
|
|
500
|
+
|
|
501
|
+
- Validation of 372 components: ~20 seconds
|
|
502
|
+
- Parallel validation with async/await
|
|
503
|
+
- Cached hash registry for faster checks
|
|
504
|
+
- JSON report generation optimized
|
|
505
|
+
|
|
506
|
+
## Contributing
|
|
507
|
+
|
|
508
|
+
### Adding New Validators
|
|
509
|
+
|
|
510
|
+
1. Extend `BaseValidator` class
|
|
511
|
+
2. Implement `validate(component)` method
|
|
512
|
+
3. Add to `ValidationOrchestrator`
|
|
513
|
+
4. Write comprehensive tests
|
|
514
|
+
|
|
515
|
+
```javascript
|
|
516
|
+
class CustomValidator extends BaseValidator {
|
|
517
|
+
async validate(component) {
|
|
518
|
+
// Your validation logic
|
|
519
|
+
if (issue) {
|
|
520
|
+
this.addError('CUSTOM_E001', 'Description', metadata);
|
|
521
|
+
}
|
|
522
|
+
return this.getResults();
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
### Updating Error Codes
|
|
528
|
+
|
|
529
|
+
1. Document in `ARCHITECTURE.md`
|
|
530
|
+
2. Add to error code tables above
|
|
531
|
+
3. Include in test coverage
|
|
532
|
+
4. Update this README
|
|
533
|
+
|
|
534
|
+
## Resources
|
|
535
|
+
|
|
536
|
+
- [ARCHITECTURE.md](./ARCHITECTURE.md) - Detailed architecture
|
|
537
|
+
- [SLSA Framework](https://slsa.dev/) - Supply chain security
|
|
538
|
+
- [npm 2025 Security](https://docs.npmjs.com/security) - Package security
|
|
539
|
+
- [OWASP Top 10](https://owasp.org/www-project-top-ten/) - Security risks
|
|
540
|
+
|
|
541
|
+
## License
|
|
542
|
+
|
|
543
|
+
MIT - See repository LICENSE file
|