memorylink 2.1.0 → 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.
- package/CHANGELOG.md +10 -2
- package/README.md +66 -52
- package/dist/cli/commands/delete.d.ts +7 -0
- package/dist/cli/commands/delete.d.ts.map +1 -0
- package/dist/cli/commands/delete.js +106 -0
- package/dist/cli/commands/delete.js.map +1 -0
- package/dist/cli/commands/gate.d.ts +1 -1
- package/dist/cli/commands/gate.d.ts.map +1 -1
- package/dist/cli/commands/gate.js +14 -0
- package/dist/cli/commands/gate.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +17 -75
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/list.d.ts +7 -0
- package/dist/cli/commands/list.d.ts.map +1 -0
- package/dist/cli/commands/list.js +129 -0
- package/dist/cli/commands/list.js.map +1 -0
- package/dist/cli/commands/remember.d.ts +3 -0
- package/dist/cli/commands/remember.d.ts.map +1 -0
- package/dist/cli/commands/remember.js +61 -0
- package/dist/cli/commands/remember.js.map +1 -0
- package/dist/cli/commands/retrieve.d.ts +3 -0
- package/dist/cli/commands/retrieve.d.ts.map +1 -0
- package/dist/cli/commands/retrieve.js +32 -0
- package/dist/cli/commands/retrieve.js.map +1 -0
- package/dist/cli/commands/scaffold.d.ts +6 -0
- package/dist/cli/commands/scaffold.d.ts.map +1 -0
- package/dist/cli/commands/scaffold.js +132 -0
- package/dist/cli/commands/scaffold.js.map +1 -0
- package/dist/cli/index.js +10 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/core/memory/gates.d.ts +17 -0
- package/dist/core/memory/gates.d.ts.map +1 -0
- package/dist/core/memory/gates.js +75 -0
- package/dist/core/memory/gates.js.map +1 -0
- package/dist/core/memory/git.d.ts +9 -0
- package/dist/core/memory/git.d.ts.map +1 -0
- package/dist/core/memory/git.js +57 -0
- package/dist/core/memory/git.js.map +1 -0
- package/dist/core/memory/storage.d.ts +11 -0
- package/dist/core/memory/storage.d.ts.map +1 -0
- package/dist/core/memory/storage.js +63 -0
- package/dist/core/memory/storage.js.map +1 -0
- package/dist/core/memory/structure.d.ts +10 -0
- package/dist/core/memory/structure.d.ts.map +1 -0
- package/dist/core/memory/structure.js +51 -0
- package/dist/core/memory/structure.js.map +1 -0
- package/dist/core/types.d.ts +13 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/gate/rules/valid-syntax.d.ts +16 -0
- package/dist/gate/rules/valid-syntax.d.ts.map +1 -0
- package/dist/gate/rules/valid-syntax.js +76 -0
- package/dist/gate/rules/valid-syntax.js.map +1 -0
- package/dist/quarantine/patterns.js +2 -2
- package/dist/quarantine/patterns.js.map +1 -1
- package/dist/tools/pointer-generator.d.ts.map +1 -1
- package/dist/tools/pointer-generator.js +2 -2
- package/dist/tools/pointer-generator.js.map +1 -1
- package/docs/USER_GUIDE.md +181 -0
- package/package.json +3 -3
- package/docs/COMPARISONS.md +0 -229
- package/docs/FAQ.md +0 -230
- package/docs/GETTING_STARTED.md +0 -185
- package/docs/PATTERNS.md +0 -206
- package/docs/QUICK_REFERENCE.md +0 -209
- package/docs/REMEDIATION.md +0 -332
- package/docs/THREAT_MODEL.md +0 -279
- package/docs/TROUBLESHOOTING.md +0 -280
package/docs/REMEDIATION.md
DELETED
|
@@ -1,332 +0,0 @@
|
|
|
1
|
-
# 🔄 Secret Remediation Guide
|
|
2
|
-
|
|
3
|
-
**Version:** 2.0.2
|
|
4
|
-
**Last Updated:** January 2, 2026
|
|
5
|
-
|
|
6
|
-
When MemoryLink detects a secret, you should **rotate it immediately**. This guide provides direct links to rotate secrets for common providers.
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## ⚠️ Important: Always Assume Compromise
|
|
11
|
-
|
|
12
|
-
If a secret was detected, assume it may have been exposed:
|
|
13
|
-
1. **Rotate immediately** - Don't wait
|
|
14
|
-
2. **Check access logs** - Look for unauthorized use
|
|
15
|
-
3. **Update all locations** - Environment variables, CI secrets, etc.
|
|
16
|
-
4. **Review Git history** - Use `ml gate --history`
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## ☁️ Cloud Providers
|
|
21
|
-
|
|
22
|
-
### AWS
|
|
23
|
-
|
|
24
|
-
| Secret Type | Rotation Link |
|
|
25
|
-
|-------------|---------------|
|
|
26
|
-
| **Access Key ID / Secret** | [AWS IAM Console → Users → Security Credentials](https://console.aws.amazon.com/iam/home#/users) |
|
|
27
|
-
| **Session Token** | Expires automatically, rotate base credentials |
|
|
28
|
-
|
|
29
|
-
**Steps:**
|
|
30
|
-
1. Go to IAM → Users → Select user
|
|
31
|
-
2. Security credentials tab
|
|
32
|
-
3. Create new access key
|
|
33
|
-
4. Delete old access key
|
|
34
|
-
5. Update all applications
|
|
35
|
-
|
|
36
|
-
### Google Cloud (GCP)
|
|
37
|
-
|
|
38
|
-
| Secret Type | Rotation Link |
|
|
39
|
-
|-------------|---------------|
|
|
40
|
-
| **Service Account Key** | [GCP Console → IAM → Service Accounts](https://console.cloud.google.com/iam-admin/serviceaccounts) |
|
|
41
|
-
| **API Key** | [GCP Console → APIs → Credentials](https://console.cloud.google.com/apis/credentials) |
|
|
42
|
-
| **OAuth Client Secret** | [GCP Console → APIs → Credentials](https://console.cloud.google.com/apis/credentials) |
|
|
43
|
-
|
|
44
|
-
### Microsoft Azure
|
|
45
|
-
|
|
46
|
-
| Secret Type | Rotation Link |
|
|
47
|
-
|-------------|---------------|
|
|
48
|
-
| **Client Secret** | [Azure Portal → App Registrations](https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps) |
|
|
49
|
-
| **Storage Account Key** | [Azure Portal → Storage Accounts](https://portal.azure.com/#blade/HubsExtension/BrowseResource/resourceType/Microsoft.Storage%2FStorageAccounts) |
|
|
50
|
-
| **Connection String** | Regenerate from respective service |
|
|
51
|
-
|
|
52
|
-
### DigitalOcean
|
|
53
|
-
|
|
54
|
-
| Secret Type | Rotation Link |
|
|
55
|
-
|-------------|---------------|
|
|
56
|
-
| **Personal Access Token** | [DigitalOcean → API → Tokens](https://cloud.digitalocean.com/account/api/tokens) |
|
|
57
|
-
| **Spaces Access Key** | [DigitalOcean → API → Spaces Keys](https://cloud.digitalocean.com/account/api/tokens) |
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
## 🤖 AI/ML Services
|
|
62
|
-
|
|
63
|
-
### OpenAI
|
|
64
|
-
|
|
65
|
-
| Secret Type | Rotation Link |
|
|
66
|
-
|-------------|---------------|
|
|
67
|
-
| **API Key** | [OpenAI Platform → API Keys](https://platform.openai.com/api-keys) |
|
|
68
|
-
|
|
69
|
-
**Steps:**
|
|
70
|
-
1. Go to API Keys page
|
|
71
|
-
2. Click "Create new secret key"
|
|
72
|
-
3. Delete the old key
|
|
73
|
-
4. Update your applications
|
|
74
|
-
|
|
75
|
-
### Anthropic (Claude)
|
|
76
|
-
|
|
77
|
-
| Secret Type | Rotation Link |
|
|
78
|
-
|-------------|---------------|
|
|
79
|
-
| **API Key** | [Anthropic Console → API Keys](https://console.anthropic.com/settings/keys) |
|
|
80
|
-
|
|
81
|
-
### Hugging Face
|
|
82
|
-
|
|
83
|
-
| Secret Type | Rotation Link |
|
|
84
|
-
|-------------|---------------|
|
|
85
|
-
| **Access Token** | [Hugging Face → Settings → Access Tokens](https://huggingface.co/settings/tokens) |
|
|
86
|
-
|
|
87
|
-
### Cohere
|
|
88
|
-
|
|
89
|
-
| Secret Type | Rotation Link |
|
|
90
|
-
|-------------|---------------|
|
|
91
|
-
| **API Key** | [Cohere Dashboard → API Keys](https://dashboard.cohere.ai/api-keys) |
|
|
92
|
-
|
|
93
|
-
---
|
|
94
|
-
|
|
95
|
-
## 💳 Payment Providers
|
|
96
|
-
|
|
97
|
-
### Stripe
|
|
98
|
-
|
|
99
|
-
| Secret Type | Rotation Link |
|
|
100
|
-
|-------------|---------------|
|
|
101
|
-
| **Secret Key** | [Stripe Dashboard → Developers → API Keys](https://dashboard.stripe.com/apikeys) |
|
|
102
|
-
| **Webhook Secret** | [Stripe Dashboard → Developers → Webhooks](https://dashboard.stripe.com/webhooks) |
|
|
103
|
-
|
|
104
|
-
**Note:** Stripe keys start with `sk_live_` (production) or `sk_test_` (test). Rotate production keys immediately!
|
|
105
|
-
|
|
106
|
-
### PayPal
|
|
107
|
-
|
|
108
|
-
| Secret Type | Rotation Link |
|
|
109
|
-
|-------------|---------------|
|
|
110
|
-
| **Client ID / Secret** | [PayPal Developer → My Apps](https://developer.paypal.com/developer/applications/) |
|
|
111
|
-
|
|
112
|
-
### Razorpay 🇮🇳
|
|
113
|
-
|
|
114
|
-
| Secret Type | Rotation Link |
|
|
115
|
-
|-------------|---------------|
|
|
116
|
-
| **Key ID / Secret** | [Razorpay Dashboard → Settings → API Keys](https://dashboard.razorpay.com/app/keys) |
|
|
117
|
-
|
|
118
|
-
### Square
|
|
119
|
-
|
|
120
|
-
| Secret Type | Rotation Link |
|
|
121
|
-
|-------------|---------------|
|
|
122
|
-
| **Access Token** | [Square Developer Dashboard](https://developer.squareup.com/apps) |
|
|
123
|
-
|
|
124
|
-
---
|
|
125
|
-
|
|
126
|
-
## 🔐 Authentication Providers
|
|
127
|
-
|
|
128
|
-
### GitHub
|
|
129
|
-
|
|
130
|
-
| Secret Type | Rotation Link |
|
|
131
|
-
|-------------|---------------|
|
|
132
|
-
| **Personal Access Token** | [GitHub → Settings → Developer Settings → PAT](https://github.com/settings/tokens) |
|
|
133
|
-
| **OAuth App Secret** | [GitHub → Settings → Developer Settings → OAuth Apps](https://github.com/settings/developers) |
|
|
134
|
-
| **App Private Key** | [GitHub → Settings → Developer Settings → GitHub Apps](https://github.com/settings/apps) |
|
|
135
|
-
|
|
136
|
-
### GitLab
|
|
137
|
-
|
|
138
|
-
| Secret Type | Rotation Link |
|
|
139
|
-
|-------------|---------------|
|
|
140
|
-
| **Personal Access Token** | [GitLab → Preferences → Access Tokens](https://gitlab.com/-/profile/personal_access_tokens) |
|
|
141
|
-
|
|
142
|
-
### Slack
|
|
143
|
-
|
|
144
|
-
| Secret Type | Rotation Link |
|
|
145
|
-
|-------------|---------------|
|
|
146
|
-
| **Bot Token** | [Slack API → Your Apps](https://api.slack.com/apps) |
|
|
147
|
-
| **Webhook URL** | [Slack API → Your Apps → Incoming Webhooks](https://api.slack.com/apps) |
|
|
148
|
-
|
|
149
|
-
### Discord
|
|
150
|
-
|
|
151
|
-
| Secret Type | Rotation Link |
|
|
152
|
-
|-------------|---------------|
|
|
153
|
-
| **Bot Token** | [Discord Developer Portal](https://discord.com/developers/applications) |
|
|
154
|
-
| **Webhook URL** | Create new webhook in channel settings |
|
|
155
|
-
|
|
156
|
-
### Auth0
|
|
157
|
-
|
|
158
|
-
| Secret Type | Rotation Link |
|
|
159
|
-
|-------------|---------------|
|
|
160
|
-
| **Client Secret** | [Auth0 Dashboard → Applications](https://manage.auth0.com/) |
|
|
161
|
-
| **Management API Token** | [Auth0 Dashboard → APIs](https://manage.auth0.com/) |
|
|
162
|
-
|
|
163
|
-
---
|
|
164
|
-
|
|
165
|
-
## 🗄️ Database Services
|
|
166
|
-
|
|
167
|
-
### MongoDB Atlas
|
|
168
|
-
|
|
169
|
-
| Secret Type | Rotation Link |
|
|
170
|
-
|-------------|---------------|
|
|
171
|
-
| **Connection String** | [MongoDB Atlas → Database Access](https://cloud.mongodb.com/) |
|
|
172
|
-
|
|
173
|
-
**Steps:**
|
|
174
|
-
1. Go to Database Access
|
|
175
|
-
2. Edit user, set new password
|
|
176
|
-
3. Update connection strings
|
|
177
|
-
|
|
178
|
-
### Supabase
|
|
179
|
-
|
|
180
|
-
| Secret Type | Rotation Link |
|
|
181
|
-
|-------------|---------------|
|
|
182
|
-
| **Service Role Key** | [Supabase Dashboard → Settings → API](https://app.supabase.com/) |
|
|
183
|
-
| **Anon Key** | Public key, but rotate if needed |
|
|
184
|
-
|
|
185
|
-
### Firebase
|
|
186
|
-
|
|
187
|
-
| Secret Type | Rotation Link |
|
|
188
|
-
|-------------|---------------|
|
|
189
|
-
| **Service Account Key** | [Firebase Console → Project Settings → Service Accounts](https://console.firebase.google.com/) |
|
|
190
|
-
|
|
191
|
-
### Redis Labs
|
|
192
|
-
|
|
193
|
-
| Secret Type | Rotation Link |
|
|
194
|
-
|-------------|---------------|
|
|
195
|
-
| **Database Password** | [Redis Labs Console → Database → Configuration](https://app.redislabs.com/) |
|
|
196
|
-
|
|
197
|
-
---
|
|
198
|
-
|
|
199
|
-
## 📧 Email/SMS Services
|
|
200
|
-
|
|
201
|
-
### SendGrid
|
|
202
|
-
|
|
203
|
-
| Secret Type | Rotation Link |
|
|
204
|
-
|-------------|---------------|
|
|
205
|
-
| **API Key** | [SendGrid → Settings → API Keys](https://app.sendgrid.com/settings/api_keys) |
|
|
206
|
-
|
|
207
|
-
### Mailgun
|
|
208
|
-
|
|
209
|
-
| Secret Type | Rotation Link |
|
|
210
|
-
|-------------|---------------|
|
|
211
|
-
| **API Key** | [Mailgun → API Security](https://app.mailgun.com/app/account/security/api_keys) |
|
|
212
|
-
|
|
213
|
-
### Twilio
|
|
214
|
-
|
|
215
|
-
| Secret Type | Rotation Link |
|
|
216
|
-
|-------------|---------------|
|
|
217
|
-
| **Auth Token** | [Twilio Console → Account Info](https://console.twilio.com/) |
|
|
218
|
-
| **API Key** | [Twilio Console → API Keys](https://console.twilio.com/) |
|
|
219
|
-
|
|
220
|
-
---
|
|
221
|
-
|
|
222
|
-
## 🌐 Deployment Platforms
|
|
223
|
-
|
|
224
|
-
### Vercel
|
|
225
|
-
|
|
226
|
-
| Secret Type | Rotation Link |
|
|
227
|
-
|-------------|---------------|
|
|
228
|
-
| **Token** | [Vercel → Settings → Tokens](https://vercel.com/account/tokens) |
|
|
229
|
-
|
|
230
|
-
### Netlify
|
|
231
|
-
|
|
232
|
-
| Secret Type | Rotation Link |
|
|
233
|
-
|-------------|---------------|
|
|
234
|
-
| **Personal Access Token** | [Netlify → User Settings → Applications](https://app.netlify.com/user/applications) |
|
|
235
|
-
|
|
236
|
-
### Heroku
|
|
237
|
-
|
|
238
|
-
| Secret Type | Rotation Link |
|
|
239
|
-
|-------------|---------------|
|
|
240
|
-
| **API Key** | [Heroku → Account Settings](https://dashboard.heroku.com/account) |
|
|
241
|
-
|
|
242
|
-
### Railway
|
|
243
|
-
|
|
244
|
-
| Secret Type | Rotation Link |
|
|
245
|
-
|-------------|---------------|
|
|
246
|
-
| **Token** | [Railway → Account Settings → Tokens](https://railway.app/account/tokens) |
|
|
247
|
-
|
|
248
|
-
---
|
|
249
|
-
|
|
250
|
-
## 🇮🇳 India-Specific Services
|
|
251
|
-
|
|
252
|
-
### Paytm
|
|
253
|
-
|
|
254
|
-
| Secret Type | Rotation Link |
|
|
255
|
-
|-------------|---------------|
|
|
256
|
-
| **Merchant Key** | [Paytm Dashboard → API Keys](https://dashboard.paytm.com/next/apikeys) |
|
|
257
|
-
|
|
258
|
-
### PhonePe
|
|
259
|
-
|
|
260
|
-
| Secret Type | Rotation Link |
|
|
261
|
-
|-------------|---------------|
|
|
262
|
-
| **API Key** | Contact PhonePe Business Support |
|
|
263
|
-
|
|
264
|
-
### Cashfree
|
|
265
|
-
|
|
266
|
-
| Secret Type | Rotation Link |
|
|
267
|
-
|-------------|---------------|
|
|
268
|
-
| **App ID / Secret** | [Cashfree Dashboard → Credentials](https://merchant.cashfree.com/) |
|
|
269
|
-
|
|
270
|
-
---
|
|
271
|
-
|
|
272
|
-
## 🔧 Development Tools
|
|
273
|
-
|
|
274
|
-
### npm
|
|
275
|
-
|
|
276
|
-
| Secret Type | Rotation Link |
|
|
277
|
-
|-------------|---------------|
|
|
278
|
-
| **Auth Token** | [npm → Access Tokens](https://www.npmjs.com/settings/~/tokens) |
|
|
279
|
-
|
|
280
|
-
### Docker Hub
|
|
281
|
-
|
|
282
|
-
| Secret Type | Rotation Link |
|
|
283
|
-
|-------------|---------------|
|
|
284
|
-
| **Access Token** | [Docker Hub → Account Settings → Security](https://hub.docker.com/settings/security) |
|
|
285
|
-
|
|
286
|
-
### CircleCI
|
|
287
|
-
|
|
288
|
-
| Secret Type | Rotation Link |
|
|
289
|
-
|-------------|---------------|
|
|
290
|
-
| **API Token** | [CircleCI → User Settings → Personal API Tokens](https://app.circleci.com/settings/user/tokens) |
|
|
291
|
-
|
|
292
|
-
---
|
|
293
|
-
|
|
294
|
-
## 📋 General Rotation Checklist
|
|
295
|
-
|
|
296
|
-
After rotating a secret:
|
|
297
|
-
|
|
298
|
-
- [ ] **Update environment variables** (local `.env` files)
|
|
299
|
-
- [ ] **Update CI/CD secrets** (GitHub Actions, GitLab CI, etc.)
|
|
300
|
-
- [ ] **Update deployment platforms** (Vercel, Netlify, etc.)
|
|
301
|
-
- [ ] **Update configuration files** (ensure not committed!)
|
|
302
|
-
- [ ] **Test the application** (verify new key works)
|
|
303
|
-
- [ ] **Check audit logs** (look for unauthorized access)
|
|
304
|
-
- [ ] **Run `ml scan`** (verify no secrets remain)
|
|
305
|
-
|
|
306
|
-
---
|
|
307
|
-
|
|
308
|
-
## 🚨 Emergency Response
|
|
309
|
-
|
|
310
|
-
If you believe a secret was exploited:
|
|
311
|
-
|
|
312
|
-
1. **Rotate immediately** - Don't investigate first
|
|
313
|
-
2. **Check access logs** - Provider dashboards usually have this
|
|
314
|
-
3. **Revoke sessions** - Force re-authentication
|
|
315
|
-
4. **Enable MFA** - If not already enabled
|
|
316
|
-
5. **Contact provider** - Report potential breach
|
|
317
|
-
6. **Document incident** - For compliance
|
|
318
|
-
|
|
319
|
-
---
|
|
320
|
-
|
|
321
|
-
## 📞 Provider Security Contacts
|
|
322
|
-
|
|
323
|
-
| Provider | Security Contact |
|
|
324
|
-
|----------|------------------|
|
|
325
|
-
| AWS | [AWS Security](https://aws.amazon.com/security/vulnerability-reporting/) |
|
|
326
|
-
| Google | [Google Security](https://www.google.com/about/appsecurity/) |
|
|
327
|
-
| GitHub | [GitHub Security](https://github.com/security) |
|
|
328
|
-
| Stripe | [Stripe Security](https://stripe.com/docs/security) |
|
|
329
|
-
|
|
330
|
-
---
|
|
331
|
-
|
|
332
|
-
*This guide is part of MemoryLink's security documentation. Always follow your organization's incident response procedures.*
|
package/docs/THREAT_MODEL.md
DELETED
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
# 🔐 MemoryLink Threat Model
|
|
2
|
-
|
|
3
|
-
**Version:** 2.0.2
|
|
4
|
-
**Last Updated:** January 2, 2026
|
|
5
|
-
**Status:** Production
|
|
6
|
-
|
|
7
|
-
This document describes the security boundaries, threat model, and trust assumptions for MemoryLink.
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## 📋 Overview
|
|
12
|
-
|
|
13
|
-
MemoryLink is a **local-first** secret detection tool. It operates entirely on your machine with:
|
|
14
|
-
- No network calls
|
|
15
|
-
- No telemetry
|
|
16
|
-
- No cloud dependencies
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## 🎯 Security Goals
|
|
21
|
-
|
|
22
|
-
| Goal | Description | Status |
|
|
23
|
-
|------|-------------|--------|
|
|
24
|
-
| **Prevent Secret Leaks** | Block secrets from reaching Git remotes | ✅ Implemented |
|
|
25
|
-
| **Protect Detected Secrets** | Encrypt quarantined secrets at rest | ✅ Implemented |
|
|
26
|
-
| **Maintain Audit Trail** | Log all security events immutably | ✅ Implemented |
|
|
27
|
-
| **Zero Data Exfiltration** | No data leaves user's machine | ✅ Implemented |
|
|
28
|
-
| **Minimal Attack Surface** | No network, minimal dependencies | ✅ Implemented |
|
|
29
|
-
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
## 🏗️ Architecture Security
|
|
33
|
-
|
|
34
|
-
### Data Flow
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
┌──────────────────────────────────────────────────────────────────┐
|
|
38
|
-
│ USER'S MACHINE │
|
|
39
|
-
│ │
|
|
40
|
-
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
|
41
|
-
│ │ Your Code │────▶│ MemoryLink │────▶│ Git Repo │ │
|
|
42
|
-
│ │ (Scanned) │ │ (Scanner) │ │ (Clean) │ │
|
|
43
|
-
│ └─────────────┘ └──────┬──────┘ └─────────────┘ │
|
|
44
|
-
│ │ │
|
|
45
|
-
│ ┌────────▼────────┐ │
|
|
46
|
-
│ │ If Secrets │ │
|
|
47
|
-
│ │ Detected │ │
|
|
48
|
-
│ └────────┬────────┘ │
|
|
49
|
-
│ │ │
|
|
50
|
-
│ ┌───────────────────┼───────────────────┐ │
|
|
51
|
-
│ ▼ ▼ ▼ │
|
|
52
|
-
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
|
53
|
-
│ │ Quarantine │ │ Audit Trail │ │ Block │ │
|
|
54
|
-
│ │ (Encrypted) │ │ (Logs) │ │ Commit │ │
|
|
55
|
-
│ └─────────────┘ └─────────────┘ └─────────────┘ │
|
|
56
|
-
│ │
|
|
57
|
-
└──────────────────────────────────────────────────────────────────┘
|
|
58
|
-
│
|
|
59
|
-
▼
|
|
60
|
-
┌─────────────────┐
|
|
61
|
-
│ NETWORK NEVER │
|
|
62
|
-
│ ACCESSED │
|
|
63
|
-
└─────────────────┘
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### Trust Boundaries
|
|
67
|
-
|
|
68
|
-
| Zone | Trust Level | Data |
|
|
69
|
-
|------|-------------|------|
|
|
70
|
-
| **User's Home Dir** | High | `~/.memorylink/keys/` (encryption keys) |
|
|
71
|
-
| **Project Dir** | Medium | `.memorylink/` (project config, quarantine) |
|
|
72
|
-
| **Git Working Tree** | Low | Scanned for secrets |
|
|
73
|
-
| **Git Remote** | Untrusted | Should never receive secrets |
|
|
74
|
-
| **Network** | N/A | Never accessed |
|
|
75
|
-
|
|
76
|
-
---
|
|
77
|
-
|
|
78
|
-
## 🔑 Cryptographic Design
|
|
79
|
-
|
|
80
|
-
### Encryption
|
|
81
|
-
|
|
82
|
-
| Component | Algorithm | Key Size | Notes |
|
|
83
|
-
|-----------|-----------|----------|-------|
|
|
84
|
-
| **Quarantine Encryption** | AES-256-GCM | 256-bit | Authenticated encryption |
|
|
85
|
-
| **Key Derivation** | Random | 256-bit | Crypto-secure random |
|
|
86
|
-
| **IV Generation** | Random | 96-bit | Unique per encryption |
|
|
87
|
-
|
|
88
|
-
### Key Storage
|
|
89
|
-
|
|
90
|
-
```
|
|
91
|
-
~/.memorylink/
|
|
92
|
-
└── keys/
|
|
93
|
-
└── <project-hash>.key # 256-bit AES key
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
**Key Properties:**
|
|
97
|
-
- ✅ Stored outside project directory
|
|
98
|
-
- ✅ Never committed to Git
|
|
99
|
-
- ✅ One key per project (isolated)
|
|
100
|
-
- ⚠️ Should be 600 permissions (Unix) / User-only ACL (Windows)
|
|
101
|
-
|
|
102
|
-
### Key Rotation
|
|
103
|
-
|
|
104
|
-
Currently, keys are:
|
|
105
|
-
- Created on first `ml init`
|
|
106
|
-
- Never automatically rotated
|
|
107
|
-
- Manual rotation: Delete key file, re-run `ml init`
|
|
108
|
-
|
|
109
|
-
**Future (v2.1):** Automatic key rotation with `ml keys rotate`
|
|
110
|
-
|
|
111
|
-
---
|
|
112
|
-
|
|
113
|
-
## 🚨 Threat Analysis
|
|
114
|
-
|
|
115
|
-
### Threats Mitigated
|
|
116
|
-
|
|
117
|
-
| Threat | Mitigation | Effectiveness |
|
|
118
|
-
|--------|------------|---------------|
|
|
119
|
-
| **Accidental secret commit** | Pre-commit hook | ✅ High |
|
|
120
|
-
| **Accidental secret push** | Pre-push hook | ✅ High |
|
|
121
|
-
| **Secret in CI logs** | Masked output | ✅ High |
|
|
122
|
-
| **Quarantine file theft** | AES-256-GCM encryption | ✅ High |
|
|
123
|
-
| **Telemetry/tracking** | No network calls | ✅ Complete |
|
|
124
|
-
|
|
125
|
-
### Threats NOT Mitigated
|
|
126
|
-
|
|
127
|
-
| Threat | Why | Recommendation |
|
|
128
|
-
|--------|-----|----------------|
|
|
129
|
-
| **Malicious user disabling hooks** | User has full control | Use CI enforcement (`ml gate`) |
|
|
130
|
-
| **Key file theft** | If attacker has machine access | Use disk encryption (FileVault/BitLocker) |
|
|
131
|
-
| **Memory dump attacks** | Secrets in RAM during scan | Use secure OS, avoid shared machines |
|
|
132
|
-
| **Supply chain attacks** | npm dependency risks | Audit dependencies, use lockfile |
|
|
133
|
-
| **Secrets in Git history** | Already committed secrets | Use `ml gate --history` + `git filter-branch` |
|
|
134
|
-
|
|
135
|
-
### Out of Scope
|
|
136
|
-
|
|
137
|
-
These threats are explicitly NOT in MemoryLink's threat model:
|
|
138
|
-
|
|
139
|
-
1. **Malware on user's machine** - MemoryLink cannot protect against rootkits/keyloggers
|
|
140
|
-
2. **Physical access attacks** - Use full-disk encryption
|
|
141
|
-
3. **Social engineering** - User education required
|
|
142
|
-
4. **Zero-day vulnerabilities** - Keep MemoryLink updated
|
|
143
|
-
|
|
144
|
-
---
|
|
145
|
-
|
|
146
|
-
## 🛡️ Security Controls
|
|
147
|
-
|
|
148
|
-
### Input Validation
|
|
149
|
-
|
|
150
|
-
| Input | Validation | Risk |
|
|
151
|
-
|-------|------------|------|
|
|
152
|
-
| **File paths** | Normalized, no symlinks | Path traversal |
|
|
153
|
-
| **Regex patterns** | Pre-tested for ReDoS | Denial of service |
|
|
154
|
-
| **Config files** | JSON schema validation | Injection |
|
|
155
|
-
| **CLI arguments** | Type-checked | Command injection |
|
|
156
|
-
|
|
157
|
-
### File System Security
|
|
158
|
-
|
|
159
|
-
| Control | Implementation |
|
|
160
|
-
|---------|----------------|
|
|
161
|
-
| **Symlink handling** | Skipped by default |
|
|
162
|
-
| **Binary files** | Skipped (detected by magic bytes) |
|
|
163
|
-
| **Large files** | Size limit configurable |
|
|
164
|
-
| **Hidden files** | Scanned by default (configurable) |
|
|
165
|
-
|
|
166
|
-
### Git Integration Security
|
|
167
|
-
|
|
168
|
-
| Hook | Security Property |
|
|
169
|
-
|------|-------------------|
|
|
170
|
-
| **pre-commit** | Blocks staged files with secrets |
|
|
171
|
-
| **pre-push** | Full repo scan before push |
|
|
172
|
-
| **Bypass** | `--no-verify` (logged in audit) |
|
|
173
|
-
|
|
174
|
-
---
|
|
175
|
-
|
|
176
|
-
## 📊 Security Comparison
|
|
177
|
-
|
|
178
|
-
| Feature | MemoryLink | gitleaks | truffleHog | GitGuardian |
|
|
179
|
-
|---------|-----------|----------|------------|-------------|
|
|
180
|
-
| **Local-only** | ✅ | ✅ | ✅ | ❌ Cloud |
|
|
181
|
-
| **Zero telemetry** | ✅ | ✅ | ⚠️ Opt-out | ❌ Required |
|
|
182
|
-
| **Encrypted quarantine** | ✅ | ❌ | ❌ | ❌ |
|
|
183
|
-
| **Audit trail** | ✅ | ❌ | ❌ | ✅ Cloud |
|
|
184
|
-
| **Key isolation** | ✅ Home dir | N/A | N/A | N/A |
|
|
185
|
-
|
|
186
|
-
---
|
|
187
|
-
|
|
188
|
-
## 🔍 Security Verification
|
|
189
|
-
|
|
190
|
-
### Self-Check Command
|
|
191
|
-
|
|
192
|
-
```bash
|
|
193
|
-
ml self-check
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
Verifies:
|
|
197
|
-
- ✅ Installation integrity
|
|
198
|
-
- ✅ Git hooks installed
|
|
199
|
-
- ✅ Config file valid
|
|
200
|
-
- ✅ Key file exists and accessible
|
|
201
|
-
|
|
202
|
-
### Manual Verification
|
|
203
|
-
|
|
204
|
-
```bash
|
|
205
|
-
# Verify no network calls (run while scanning)
|
|
206
|
-
sudo lsof -i -P | grep memorylink
|
|
207
|
-
# Expected: No output (no network connections)
|
|
208
|
-
|
|
209
|
-
# Verify key permissions (Unix)
|
|
210
|
-
ls -la ~/.memorylink/keys/
|
|
211
|
-
# Expected: -rw------- (600)
|
|
212
|
-
|
|
213
|
-
# Verify quarantine encryption
|
|
214
|
-
file .memorylink/quarantined/*
|
|
215
|
-
# Expected: "data" (encrypted, not readable)
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
---
|
|
219
|
-
|
|
220
|
-
## 🚨 Incident Response
|
|
221
|
-
|
|
222
|
-
### If Secrets Were Committed
|
|
223
|
-
|
|
224
|
-
1. **Don't push** - If not pushed, secret is still local
|
|
225
|
-
2. **Remove from history**: `git filter-branch` or BFG Repo Cleaner
|
|
226
|
-
3. **Rotate the secret** - Consider it compromised
|
|
227
|
-
4. **Run `ml gate --history`** - Find all historical secrets
|
|
228
|
-
5. **Review audit logs** - `.memorylink/audit/`
|
|
229
|
-
|
|
230
|
-
### If Key File Compromised
|
|
231
|
-
|
|
232
|
-
1. **Delete the key**: `rm ~/.memorylink/keys/<project>.key`
|
|
233
|
-
2. **Re-initialize**: `ml init`
|
|
234
|
-
3. **Quarantined secrets** are now unreadable (acceptable loss)
|
|
235
|
-
4. **Audit logs** remain readable (not encrypted)
|
|
236
|
-
|
|
237
|
-
---
|
|
238
|
-
|
|
239
|
-
## 📋 Compliance Notes
|
|
240
|
-
|
|
241
|
-
### Relevant Standards
|
|
242
|
-
|
|
243
|
-
| Standard | Relevance | Status |
|
|
244
|
-
|----------|-----------|--------|
|
|
245
|
-
| **OWASP ASVS** | Secret management | Aligned |
|
|
246
|
-
| **OWASP ASI06** | AI security | Planned v3.0 |
|
|
247
|
-
| **PCI DSS** | Payment card data | Detects card patterns |
|
|
248
|
-
| **GDPR** | Personal data (India: Aadhaar) | Detects PII patterns |
|
|
249
|
-
|
|
250
|
-
### Audit Support
|
|
251
|
-
|
|
252
|
-
MemoryLink provides:
|
|
253
|
-
- ✅ Immutable audit logs (append-only)
|
|
254
|
-
- ✅ Timestamped events
|
|
255
|
-
- ✅ Detection fingerprints
|
|
256
|
-
- ✅ User action logging
|
|
257
|
-
|
|
258
|
-
---
|
|
259
|
-
|
|
260
|
-
## 📞 Security Contact
|
|
261
|
-
|
|
262
|
-
**Report security issues:** security@memorylink.dev (or GitHub Security Advisory)
|
|
263
|
-
|
|
264
|
-
**Response time:** 48 hours for initial response
|
|
265
|
-
|
|
266
|
-
**Disclosure policy:** Coordinated disclosure, 90-day window
|
|
267
|
-
|
|
268
|
-
---
|
|
269
|
-
|
|
270
|
-
## 📝 Revision History
|
|
271
|
-
|
|
272
|
-
| Version | Date | Changes |
|
|
273
|
-
|---------|------|---------|
|
|
274
|
-
| 1.0 | 2026-01-02 | Initial threat model |
|
|
275
|
-
|
|
276
|
-
---
|
|
277
|
-
|
|
278
|
-
*This document is part of MemoryLink's security documentation.*
|
|
279
|
-
|