memorylink 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +50 -46
  2. package/dist/cli/commands/delete.d.ts +7 -0
  3. package/dist/cli/commands/delete.d.ts.map +1 -0
  4. package/dist/cli/commands/delete.js +106 -0
  5. package/dist/cli/commands/delete.js.map +1 -0
  6. package/dist/cli/commands/gate.d.ts +1 -1
  7. package/dist/cli/commands/gate.d.ts.map +1 -1
  8. package/dist/cli/commands/gate.js +14 -0
  9. package/dist/cli/commands/gate.js.map +1 -1
  10. package/dist/cli/commands/init.d.ts.map +1 -1
  11. package/dist/cli/commands/init.js +17 -75
  12. package/dist/cli/commands/init.js.map +1 -1
  13. package/dist/cli/commands/list.d.ts +7 -0
  14. package/dist/cli/commands/list.d.ts.map +1 -0
  15. package/dist/cli/commands/list.js +129 -0
  16. package/dist/cli/commands/list.js.map +1 -0
  17. package/dist/cli/commands/remember.d.ts +3 -0
  18. package/dist/cli/commands/remember.d.ts.map +1 -0
  19. package/dist/cli/commands/remember.js +61 -0
  20. package/dist/cli/commands/remember.js.map +1 -0
  21. package/dist/cli/commands/retrieve.d.ts +3 -0
  22. package/dist/cli/commands/retrieve.d.ts.map +1 -0
  23. package/dist/cli/commands/retrieve.js +32 -0
  24. package/dist/cli/commands/retrieve.js.map +1 -0
  25. package/dist/cli/commands/scaffold.d.ts +6 -0
  26. package/dist/cli/commands/scaffold.d.ts.map +1 -0
  27. package/dist/cli/commands/scaffold.js +132 -0
  28. package/dist/cli/commands/scaffold.js.map +1 -0
  29. package/dist/cli/index.js +10 -0
  30. package/dist/cli/index.js.map +1 -1
  31. package/dist/core/memory/gates.d.ts +17 -0
  32. package/dist/core/memory/gates.d.ts.map +1 -0
  33. package/dist/core/memory/gates.js +75 -0
  34. package/dist/core/memory/gates.js.map +1 -0
  35. package/dist/core/memory/git.d.ts +9 -0
  36. package/dist/core/memory/git.d.ts.map +1 -0
  37. package/dist/core/memory/git.js +57 -0
  38. package/dist/core/memory/git.js.map +1 -0
  39. package/dist/core/memory/storage.d.ts +11 -0
  40. package/dist/core/memory/storage.d.ts.map +1 -0
  41. package/dist/core/memory/storage.js +63 -0
  42. package/dist/core/memory/storage.js.map +1 -0
  43. package/dist/core/memory/structure.d.ts +10 -0
  44. package/dist/core/memory/structure.d.ts.map +1 -0
  45. package/dist/core/memory/structure.js +51 -0
  46. package/dist/core/memory/structure.js.map +1 -0
  47. package/dist/core/types.d.ts +13 -1
  48. package/dist/core/types.d.ts.map +1 -1
  49. package/dist/gate/rules/valid-syntax.d.ts +16 -0
  50. package/dist/gate/rules/valid-syntax.d.ts.map +1 -0
  51. package/dist/gate/rules/valid-syntax.js +76 -0
  52. package/dist/gate/rules/valid-syntax.js.map +1 -0
  53. package/dist/tools/pointer-generator.d.ts.map +1 -1
  54. package/dist/tools/pointer-generator.js +2 -2
  55. package/dist/tools/pointer-generator.js.map +1 -1
  56. package/docs/USER_GUIDE.md +181 -0
  57. package/package.json +2 -2
  58. package/docs/COMPARISONS.md +0 -229
  59. package/docs/FAQ.md +0 -230
  60. package/docs/GETTING_STARTED.md +0 -185
  61. package/docs/PATTERNS.md +0 -206
  62. package/docs/QUICK_REFERENCE.md +0 -209
  63. package/docs/REMEDIATION.md +0 -332
  64. package/docs/THREAT_MODEL.md +0 -279
  65. package/docs/TROUBLESHOOTING.md +0 -280
package/docs/PATTERNS.md DELETED
@@ -1,206 +0,0 @@
1
- # MemoryLink Detection Patterns
2
-
3
- MemoryLink detects **69+ patterns** across multiple categories to protect your codebase from secrets, personal data, and security risks.
4
-
5
- ## 📊 Pattern Statistics
6
-
7
- - **Total Patterns**: 69+
8
- - **Blocking (ERROR)**: 55+ patterns
9
- - **Warning (WARN)**: 14+ patterns (browser/debug leaks)
10
-
11
- ## 🔐 API Keys & Tokens (28 patterns)
12
-
13
- ### Cloud Providers
14
- - **OpenAI/Anthropic API Key** (`sk-...`)
15
- - **Claude AI API Key** (`sk-ant-...`)
16
- - **AWS Access Key** (`AKIA...`)
17
- - **AWS Secret Key**
18
- - **Google API Key** (`AIza...`)
19
- - **Azure Key**
20
- - **GCP Service Account JSON**
21
-
22
- ### Developer Tools
23
- - **GitHub Token** (`ghp_...`)
24
- - **GitHub OAuth Token** (`gho_...`)
25
- - **Slack Token** (`xoxb-...`)
26
- - **Slack Webhook URL**
27
- - **Discord Token**
28
- - **JWT Token** (`eyJ...`)
29
-
30
- ### Payment & E-commerce
31
- - **Stripe API Key** (`sk_live_...`, `sk_test_...`)
32
- - **PayPal Client Secret**
33
- - **Square Access Token**
34
- - **Shopify API Key** (`shpat_...`)
35
-
36
- ### Communication & Services
37
- - **Twilio API Key**
38
- - **SendGrid API Key** (`SG....`)
39
- - **Mailgun API Key** (`key-...`)
40
- - **Heroku API Key** (UUID format)
41
-
42
- ### Generic Patterns
43
- - **Generic API Key** (`api_key=...`)
44
- - **Key-Value Secret** (catches ANY key name with secret-like value)
45
- - **Token** (authentication tokens)
46
- - **Private Key** (RSA, etc.)
47
-
48
- ## 💳 Personal Data (PII) (12 patterns)
49
-
50
- ### Financial
51
- - **Credit Card Number** (Visa, Mastercard, Amex, Discover)
52
- - **CVV/CVC Code**
53
- - **Bank Account Number**
54
- - **IBAN** (International Bank Account Number)
55
- - **UPI ID** (India)
56
-
57
- ### Government IDs
58
- - **SSN** (US Social Security Number)
59
- - **SIN** (Canadian Social Insurance Number)
60
- - **PAN Card** (India)
61
- - **Aadhaar Number** (India)
62
- - **Driver License**
63
- - **Passport Number**
64
-
65
- ### Contact Information
66
- - **Email Address**
67
- - **Phone Number**
68
- - **Email + Password** (credential leak)
69
-
70
- ## 🌐 Browser Data Leaks (6 patterns - WARN)
71
-
72
- These patterns detect secrets that could leak through browser storage or console:
73
-
74
- - **localStorage.setItem with token**
75
- - **sessionStorage.setItem with token**
76
- - **console.log with Authorization header**
77
- - **URL parameter ?token=**
78
- - **URL parameter ?key=**
79
- - **URL parameter ?auth=**
80
-
81
- **Severity**: WARN (warning only, doesn't block)
82
-
83
- ## 🐛 Debug Code Leaks (8 patterns - WARN)
84
-
85
- These patterns catch temporary debug code that could leak secrets:
86
-
87
- - **console.log with sensitive data**
88
- - **Logger with request/response data**
89
- - **print/echo with secret**
90
- - **TODO comment with secret**
91
- - **Stack trace in production code**
92
- - **Verbose error with sensitive data**
93
- - **Temporary logging**
94
- - **Development-only code**
95
-
96
- **Severity**: WARN (warning only, doesn't block)
97
-
98
- ## 🔧 Infrastructure & DevOps (15 patterns)
99
-
100
- ### CI/CD
101
- - **GitHub Actions Secret** (`${{ secrets.XXX }}`)
102
- - **GitLab CI Secret**
103
- - **Jenkins Credential**
104
- - **CircleCI Secret**
105
- - **CI Secret Dump** (printenv, env commands)
106
-
107
- ### Containers & Orchestration
108
- - **Docker Registry Credentials**
109
- - **Docker Compose Secret**
110
- - **Kubernetes Secret**
111
- - **Helm Chart Secret**
112
-
113
- ### Cloud Storage
114
- - **S3 Public Bucket**
115
- - **Azure Public Blob**
116
- - **GCP Public Bucket**
117
- - **Cloud Storage Credential**
118
-
119
- ### Infrastructure as Code
120
- - **Terraform Secret**
121
- - **Redis Credentials**
122
-
123
- ### Other Services
124
- - **SMTP Credentials**
125
- - **VPN Credentials**
126
- - **OAuth Client Secret**
127
-
128
- ## 🛡️ Memory Poisoning Protection (8 patterns)
129
-
130
- These patterns detect instruction-injection attacks (OWASP ASI06):
131
-
132
- - **Ignore Previous Rules**
133
- - **Ignore Security**
134
- - **Always Log Secrets**
135
- - **Exfiltrate Data**
136
- - **Bypass Security**
137
- - **Disable Checks**
138
- - **Skip Validation**
139
- - **Override Security**
140
-
141
- ## 📝 Log File Patterns (4 patterns)
142
-
143
- - **Error Log with Secret**
144
- - **Access Log with Secret**
145
- - **Debug Log with Secret**
146
- - **Stack Trace with Secret**
147
-
148
- ## 🔍 Dynamic Detection
149
-
150
- MemoryLink also includes **dynamic detection** that catches secrets even if they don't match predefined patterns:
151
-
152
- - **Key-Value Detection**: Catches any key name with secret-like values
153
- - **Standalone Secret Detection**: Detects secrets without key names
154
- - **High-Entropy Detection**: Identifies random-looking strings
155
- - **Format Detection**: Base64, Hex, UUID patterns
156
-
157
- ## ⚙️ Pattern Configuration
158
-
159
- You can customize patterns in `.memorylink/config.json`:
160
-
161
- ```json
162
- {
163
- "patterns": {
164
- "disabled": ["email"], // Disable specific patterns
165
- "custom": [ // Add custom patterns
166
- {
167
- "id": "my-custom-pattern",
168
- "name": "My Custom Pattern",
169
- "pattern": "YOUR_REGEX_HERE",
170
- "description": "Custom pattern description"
171
- }
172
- ]
173
- }
174
- }
175
- ```
176
-
177
- ## 📊 Pattern Categories Summary
178
-
179
- | Category | Count | Severity |
180
- |----------|-------|----------|
181
- | API Keys & Tokens | 28 | ERROR |
182
- | Personal Data (PII) | 12 | ERROR |
183
- | Browser Leaks | 6 | WARN |
184
- | Debug Leaks | 8 | WARN |
185
- | Infrastructure | 15 | ERROR |
186
- | Memory Poisoning | 8 | ERROR |
187
- | Log Files | 4 | ERROR |
188
- | **Total** | **69+** | - |
189
-
190
- ## 🎯 Best Practices
191
-
192
- 1. **Review WARN patterns**: Browser and debug patterns are warnings - review them but don't block on them
193
- 2. **Customize patterns**: Disable patterns that cause false positives in your codebase
194
- 3. **Use whitelist**: Add test keys to whitelist in `.memorylink/config.json`
195
- 4. **Regular scans**: Run `ml scan` regularly to catch new secrets
196
-
197
- ## 📖 Related Documentation
198
-
199
- - [GETTING_STARTED.md](./GETTING_STARTED.md) - Quick start guide
200
- - [REMEDIATION.md](./REMEDIATION.md) - How to fix detected secrets
201
- - [README.md](../README.md) - Full documentation
202
-
203
- ---
204
-
205
- **Last Updated**: Based on MemoryLink v1.0.0
206
-
@@ -1,209 +0,0 @@
1
- # MemoryLink Quick Reference
2
-
3
- ## 5-Minute Setup
4
- ```bash
5
- npm install -g memorylink
6
- cd your-project
7
- ml init
8
- # Done! Hooks installed, scanning active.
9
- ```
10
-
11
- ---
12
-
13
- ## Essential Commands
14
-
15
- | Command | What It Does |
16
- |---------|--------------|
17
- | `ml init` | Setup project + Git hooks |
18
- | `ml scan` | Scan project for secrets |
19
- | `ml gate` | Check before commit/push |
20
- | `ml mode` | View/change security mode |
21
- | `ml audit` | View security history |
22
-
23
- ---
24
-
25
- ## Mode Switching
26
-
27
- ```bash
28
- # View current mode
29
- ml mode
30
-
31
- # Set mode permanently
32
- ml mode active # Block on secrets
33
- ml mode inactive # Warn only (default)
34
-
35
- # One-time override
36
- ML_MODE=active git push # Block this push
37
- ML_MODE=inactive git push # Allow this push
38
- ```
39
-
40
- ---
41
-
42
- ## Scanning
43
-
44
- ```bash
45
- # Scan entire project
46
- ml scan
47
-
48
- # Scan specific file
49
- ml scan path/to/file.js
50
-
51
- # Scan with details
52
- ml scan --verbose
53
-
54
- # Scan only changed files
55
- ml gate --diff
56
- ```
57
-
58
- ---
59
-
60
- ## Handling False Positives
61
-
62
- ```javascript
63
- // Option 1: Inline ignore
64
- const testKey = "AKIAEXAMPLE"; // ml:ignore
65
-
66
- // Option 2: Block ignore
67
- // ml:ignore-start
68
- const testData = {...};
69
- // ml:ignore-end
70
- ```
71
-
72
- ```bash
73
- # Option 3: Command line
74
- ml ignore add --file path/to/file.js
75
- ml ignore add --pattern "api-key-2"
76
- ```
77
-
78
- ---
79
-
80
- ## Git Hooks
81
-
82
- ```bash
83
- # Install hooks
84
- ml hooks install
85
-
86
- # Uninstall hooks
87
- ml hooks uninstall
88
-
89
- # Bypass temporarily (use with caution!)
90
- git commit --no-verify
91
- git push --no-verify
92
- ```
93
-
94
- ---
95
-
96
- ## CI/CD Integration
97
-
98
- ```yaml
99
- # GitHub Actions
100
- - run: npm install -g memorylink
101
- - run: ml gate --enforce
102
-
103
- # Or with environment variable
104
- - run: ML_MODE=active ml gate
105
- ```
106
-
107
- ---
108
-
109
- ## Memory Commands
110
-
111
- ```bash
112
- # Store memory
113
- ml capture --topic "config" "Use React 18"
114
-
115
- # Query memories
116
- ml query --topic "config"
117
-
118
- # Promote evidence grade
119
- ml promote <memory-id> --to E2
120
- ```
121
-
122
- ---
123
-
124
- ## Audit & History
125
-
126
- ```bash
127
- # View audit log
128
- ml audit
129
-
130
- # Scan git history
131
- ml gate --history
132
-
133
- # View quarantined items
134
- ml release --list
135
- ```
136
-
137
- ---
138
-
139
- ## Diagnostics
140
-
141
- ```bash
142
- # Self-check
143
- ml self-check
144
-
145
- # View version
146
- ml --version
147
-
148
- # Debug mode
149
- DEBUG=memorylink ml scan
150
- ```
151
-
152
- ---
153
-
154
- ## Configuration
155
-
156
- ```json
157
- // .memorylink/config.json
158
- {
159
- "block_mode": false,
160
- "scan": {
161
- "exclude": ["dist/**", "*.min.js"]
162
- }
163
- }
164
- ```
165
-
166
- ---
167
-
168
- ## Exit Codes
169
-
170
- | Code | Meaning |
171
- |------|---------|
172
- | 0 | Success / No issues |
173
- | 1 | Secrets found (active mode) |
174
- | 2 | Configuration error |
175
-
176
- ---
177
-
178
- ## Environment Variables
179
-
180
- | Variable | Purpose |
181
- |----------|---------|
182
- | `ML_MODE` | Override mode (active/inactive) |
183
- | `CI` | Auto-detected, forces active mode |
184
- | `DEBUG` | Enable debug output |
185
-
186
- ---
187
-
188
- ## Quick Troubleshooting
189
-
190
- | Problem | Quick Fix |
191
- |---------|-----------|
192
- | Command not found | `npx memorylink` |
193
- | Hooks not running | `ml hooks install` |
194
- | False positive | `// ml:ignore` |
195
- | Database locked | `rm .memorylink/*.lock` |
196
- | Slow scans | Add excludes to config |
197
-
198
- ---
199
-
200
- ## Getting Help
201
-
202
- ```bash
203
- ml --help # All commands
204
- ml scan --help # Command help
205
- ml self-check # Diagnostics
206
- ```
207
-
208
- **Docs:** [TROUBLESHOOTING.md](./TROUBLESHOOTING.md) | [FAQ.md](./FAQ.md)
209
-