memorylink 2.0.2 → 2.1.1

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.
@@ -1,234 +1,332 @@
1
- # Remediation Guides
1
+ # 🔄 Secret Remediation Guide
2
2
 
3
- When MemoryLink detects a secret, follow these provider-specific remediation steps to secure your codebase.
3
+ **Version:** 2.0.2
4
+ **Last Updated:** January 2, 2026
4
5
 
5
- ## 🔄 General Remediation Process
6
+ When MemoryLink detects a secret, you should **rotate it immediately**. This guide provides direct links to rotate secrets for common providers.
6
7
 
7
- 1. **Identify** the secret type
8
- 2. **Revoke** the exposed secret immediately
9
- 3. **Generate** a new secret
10
- 4. **Update** your code/config
11
- 5. **Remove** from Git history
12
- 6. **Review** access logs
13
-
14
- ## 🔐 Provider-Specific Guides
8
+ ---
15
9
 
16
- ### GitHub
10
+ ## ⚠️ Important: Always Assume Compromise
17
11
 
18
- **Patterns Detected**: `ghp_...`, `gho_...`, `ghu_...`, `ghs_...`, `ghr_...`
19
-
20
- **Steps**:
21
- 1. Go to [GitHub Settings Developer settings Personal access tokens](https://github.com/settings/tokens)
22
- 2. Find the exposed token and click **"Revoke"**
23
- 3. Generate a new token if needed
24
- 4. Update your code/config with the new token
25
- 5. Remove the old token from Git history:
26
- ```bash
27
- # Using git filter-branch
28
- git filter-branch --force --index-filter \
29
- "git rm --cached --ignore-unmatch PATH_TO_FILE" \
30
- --prune-empty --tag-name-filter cat -- --all
31
-
32
- # Or use BFG Repo-Cleaner (recommended)
33
- bfg --replace-text passwords.txt
34
- ```
35
- 6. Review [GitHub audit log](https://github.com/settings/security-log) for unauthorized access
36
-
37
- **Reference**: [GitHub Personal Access Tokens Documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)
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`
38
17
 
39
18
  ---
40
19
 
20
+ ## ☁️ Cloud Providers
21
+
41
22
  ### AWS
42
23
 
43
- **Patterns Detected**: `AKIA...`, AWS secret keys, S3 credentials
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 |
44
51
 
45
- **Steps**:
46
- 1. Go to [AWS IAM Console → Users → Security credentials](https://console.aws.amazon.com/iam/home#/users)
47
- 2. Find the exposed access key and click **"Delete"**
48
- 3. Create a new access key if needed
49
- 4. Update your code/config with the new key
50
- 5. **Rotate the secret access key immediately**
51
- 6. Review [CloudTrail logs](https://console.aws.amazon.com/cloudtrail) for unauthorized access
52
- 7. Check S3 bucket access logs if applicable
52
+ ### DigitalOcean
53
53
 
54
- **Reference**: [AWS Access Keys Documentation](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html)
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) |
55
58
 
56
59
  ---
57
60
 
58
- ### OpenAI / Anthropic
61
+ ## 🤖 AI/ML Services
59
62
 
60
- **Patterns Detected**: `sk-...`, `sk-ant-...`
63
+ ### OpenAI
61
64
 
62
- **Steps**:
63
- 1. Go to [OpenAI Dashboard → API keys](https://platform.openai.com/api-keys) or [Anthropic Console](https://console.anthropic.com/)
64
- 2. Find the exposed key and click **"Revoke"** or **"Delete"**
65
- 3. Generate a new API key
66
- 4. Update your code/config with the new key
67
- 5. Monitor API usage for suspicious activity:
68
- - OpenAI: [Usage Dashboard](https://platform.openai.com/usage)
69
- - Anthropic: Check usage logs in console
65
+ | Secret Type | Rotation Link |
66
+ |-------------|---------------|
67
+ | **API Key** | [OpenAI Platform API Keys](https://platform.openai.com/api-keys) |
70
68
 
71
- **Reference**:
72
- - [OpenAI API Keys](https://platform.openai.com/api-keys)
73
- - [Anthropic API Keys](https://docs.anthropic.com/claude/docs/authentication)
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) |
74
92
 
75
93
  ---
76
94
 
77
- ### Database
78
-
79
- **Patterns Detected**: Database URLs, connection strings, passwords
80
-
81
- **Steps**:
82
- 1. **Change the database password immediately**
83
- 2. Update connection strings in your code/config
84
- 3. Review database access logs for unauthorized connections
85
- 4. Consider rotating all database credentials
86
- 5. Use environment variables or secret managers going forward:
87
- ```bash
88
- # Use environment variables
89
- export DB_PASSWORD="new_password"
90
-
91
- # Or use secret managers (AWS Secrets Manager, HashiCorp Vault, etc.)
92
- ```
93
- 6. Update `.env` files and ensure they're in `.gitignore`
94
-
95
- **Best Practices**:
96
- - Never commit `.env` files
97
- - Use secret managers in production
98
- - Rotate credentials regularly
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) |
99
123
 
100
124
  ---
101
125
 
102
- ### Generic API Keys
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) |
103
141
 
104
- **Patterns Detected**: Generic `api_key=...`, `API_KEY=...`, etc.
142
+ ### Slack
105
143
 
106
- **Steps**:
107
- 1. **Identify the API provider**
108
- 2. Log into the provider dashboard
109
- 3. Revoke the exposed API key
110
- 4. Generate a new API key
111
- 5. Update your code/config with the new key
112
- 6. Review API usage logs for unauthorized access
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) |
113
148
 
114
- **Common Providers**:
115
- - Stripe: [API Keys](https://dashboard.stripe.com/apikeys)
116
- - Twilio: [API Keys](https://console.twilio.com/)
117
- - SendGrid: [API Keys](https://app.sendgrid.com/settings/api_keys)
118
- - Mailgun: [API Keys](https://app.mailgun.com/app/account/security/api_keys)
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/) |
119
162
 
120
163
  ---
121
164
 
122
- ### Personal Data (PII)
165
+ ## 🗄️ Database Services
166
+
167
+ ### MongoDB Atlas
123
168
 
124
- **Patterns Detected**: SSN, Credit Cards, Email, Phone, etc.
169
+ | Secret Type | Rotation Link |
170
+ |-------------|---------------|
171
+ | **Connection String** | [MongoDB Atlas → Database Access](https://cloud.mongodb.com/) |
125
172
 
126
- **Steps**:
127
- 1. **Identify what type of personal data** this is
128
- 2. **Assess the risk**:
129
- - If it's your own data: Remove it
130
- - If it's customer data: **Notify affected parties** (GDPR/CCPA compliance)
131
- 3. **Remove the data** from code/config
132
- 4. **Remove from Git history** (critical for PII)
133
- 5. **Review access logs** for unauthorized access
134
- 6. **Consider legal requirements** (data breach notification)
173
+ **Steps:**
174
+ 1. Go to Database Access
175
+ 2. Edit user, set new password
176
+ 3. Update connection strings
135
177
 
136
- **Legal Considerations**:
137
- - GDPR (EU): 72-hour breach notification
138
- - CCPA (California): Consumer notification required
139
- - HIPAA (US Healthcare): Breach notification required
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/) |
140
196
 
141
197
  ---
142
198
 
143
- ## 🛠️ Git History Cleanup
199
+ ## 📧 Email/SMS Services
144
200
 
145
- ### Using git filter-branch
201
+ ### SendGrid
146
202
 
147
- ```bash
148
- # Remove file from all commits
149
- git filter-branch --force --index-filter \
150
- "git rm --cached --ignore-unmatch PATH_TO_FILE" \
151
- --prune-empty --tag-name-filter cat -- --all
203
+ | Secret Type | Rotation Link |
204
+ |-------------|---------------|
205
+ | **API Key** | [SendGrid → Settings → API Keys](https://app.sendgrid.com/settings/api_keys) |
152
206
 
153
- # Force push (WARNING: Rewrites history)
154
- git push origin --force --all
155
- ```
207
+ ### Mailgun
156
208
 
157
- ### Using BFG Repo-Cleaner (Recommended)
209
+ | Secret Type | Rotation Link |
210
+ |-------------|---------------|
211
+ | **API Key** | [Mailgun → API Security](https://app.mailgun.com/app/account/security/api_keys) |
158
212
 
159
- ```bash
160
- # Install BFG
161
- brew install bfg # macOS
162
- # or download from https://rtyley.github.io/bfg-repo-cleaner/
213
+ ### Twilio
163
214
 
164
- # Create passwords file
165
- echo "OLD_SECRET" > passwords.txt
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/) |
166
219
 
167
- # Clean repository
168
- bfg --replace-text passwords.txt
220
+ ---
169
221
 
170
- # Clean up
171
- git reflog expire --expire=now --all
172
- git gc --prune=now --aggressive
173
- ```
222
+ ## 🌐 Deployment Platforms
174
223
 
175
- ### Using git-filter-repo (Modern Alternative)
224
+ ### Vercel
176
225
 
177
- ```bash
178
- # Install git-filter-repo
179
- pip install git-filter-repo
226
+ | Secret Type | Rotation Link |
227
+ |-------------|---------------|
228
+ | **Token** | [Vercel → Settings → Tokens](https://vercel.com/account/tokens) |
180
229
 
181
- # Remove secrets
182
- git filter-repo --invert-paths --path PATH_TO_FILE
183
- ```
230
+ ### Netlify
184
231
 
185
- ## Verification
232
+ | Secret Type | Rotation Link |
233
+ |-------------|---------------|
234
+ | **Personal Access Token** | [Netlify → User Settings → Applications](https://app.netlify.com/user/applications) |
186
235
 
187
- After remediation, verify the fix:
236
+ ### Heroku
188
237
 
189
- ```bash
190
- # Scan again
191
- ml scan
238
+ | Secret Type | Rotation Link |
239
+ |-------------|---------------|
240
+ | **API Key** | [Heroku → Account Settings](https://dashboard.heroku.com/account) |
192
241
 
193
- # Check gate
194
- ml gate --rule block-quarantined
242
+ ### Railway
195
243
 
196
- # Check Git history
197
- ml gate --rule block-quarantined --history
198
- ```
244
+ | Secret Type | Rotation Link |
245
+ |-------------|---------------|
246
+ | **Token** | [Railway → Account Settings → Tokens](https://railway.app/account/tokens) |
199
247
 
200
- ## 🚨 Emergency Response
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) |
201
291
 
202
- If a secret is exposed in a public repository:
292
+ ---
293
+
294
+ ## 📋 General Rotation Checklist
203
295
 
204
- 1. **Immediately revoke** the secret
205
- 2. **Generate new secret**
206
- 3. **Update all systems** using the old secret
207
- 4. **Review access logs** for unauthorized usage
208
- 5. **Consider rotating all related secrets**
209
- 6. **Clean Git history** (if repository is public)
210
- 7. **Monitor for abuse** (unauthorized API calls, etc.)
296
+ After rotating a secret:
211
297
 
212
- ## 📋 Remediation Checklist
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
+ ---
213
307
 
214
- - [ ] Secret revoked/rotated
215
- - [ ] New secret generated
216
- - [ ] Code/config updated
217
- - [ ] Git history cleaned (if public repo)
218
- - [ ] Access logs reviewed
219
- - [ ] Team notified (if applicable)
220
- - [ ] Legal/compliance notified (if PII)
221
- - [ ] Monitoring enabled for suspicious activity
222
- - [ ] Documentation updated
223
- - [ ] Prevention measures implemented
308
+ ## 🚨 Emergency Response
224
309
 
225
- ## 🔗 Additional Resources
310
+ If you believe a secret was exploited:
226
311
 
227
- - [GitHub: Removing sensitive data](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/removing-sensitive-data-from-a-repository)
228
- - [OWASP: Secret Management](https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html)
229
- - [NIST: Incident Response](https://www.nist.gov/cyberframework)
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
230
318
 
231
319
  ---
232
320
 
233
- **Remember**: Speed is critical when secrets are exposed. Revoke immediately, then investigate.
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
+ ---
234
331
 
332
+ *This guide is part of MemoryLink's security documentation. Always follow your organization's incident response procedures.*