Commit a493da2
committed
fix: Address security and logic issues from bot review
🔒 Security Improvements:
- Remove weak default credentials, require explicit environment variables
- Fix Docker network connections to use service names instead of localhost
- Add environment variable validation with warnings for missing credentials
- Validate required vars: POSTGRES_USER, POSTGRES_PASSWORD, GITHUB_TOKEN, etc.
🐛 Logic Fixes:
- Implement proper change detection using file/profile hashes
- Replace always-true methods with real MD5-based change tracking
- Add robust JSON parsing with error handling for malformed output
- Include stderr in subprocess error messages for better debugging
🛠️ Error Handling:
- Add graceful handling of malformed JSON in docker-compose output
- Enhanced subprocess error reporting with detailed stderr
- Better connection string parsing for Docker environment variables
✨ User Experience:
- Add consistent -h, --help patterns with examples
- Improved CLI documentation and usage examples
- Better warning messages for configuration issues
🧪 Testing:
- Add 7 new test cases for security and error handling
- Test environment variable validation
- Test change detection functionality
- Test malformed JSON parsing
- Total: 28 tests passing (up from 21)
Addresses all security concerns and logic issues identified in bot review.
Maintains 100% backward compatibility while improving robustness.1 parent e135910 commit a493da2
File tree
3 files changed
+208
-12
lines changed- src/mcpm/commands
- target_operations
- tests
3 files changed
+208
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | | - | |
| 40 | + | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
107 | 114 | | |
108 | 115 | | |
109 | 116 | | |
| |||
129 | 136 | | |
130 | 137 | | |
131 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
132 | 150 | | |
133 | 151 | | |
134 | 152 | | |
| |||
163 | 181 | | |
164 | 182 | | |
165 | 183 | | |
| 184 | + | |
166 | 185 | | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
167 | 193 | | |
168 | 194 | | |
169 | 195 | | |
170 | 196 | | |
171 | 197 | | |
172 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
173 | 203 | | |
174 | 204 | | |
175 | 205 | | |
| 206 | + | |
| 207 | + | |
176 | 208 | | |
177 | 209 | | |
178 | 210 | | |
| |||
221 | 253 | | |
222 | 254 | | |
223 | 255 | | |
224 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
225 | 261 | | |
226 | 262 | | |
227 | 263 | | |
| |||
248 | 284 | | |
249 | 285 | | |
250 | 286 | | |
| 287 | + | |
251 | 288 | | |
252 | | - | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
253 | 298 | | |
254 | 299 | | |
255 | 300 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
228 | 245 | | |
229 | 246 | | |
230 | 247 | | |
231 | | - | |
| 248 | + | |
232 | 249 | | |
233 | 250 | | |
234 | 251 | | |
| |||
340 | 357 | | |
341 | 358 | | |
342 | 359 | | |
343 | | - | |
| 360 | + | |
344 | 361 | | |
345 | | - | |
| 362 | + | |
| 363 | + | |
346 | 364 | | |
347 | 365 | | |
348 | 366 | | |
| |||
353 | 371 | | |
354 | 372 | | |
355 | 373 | | |
356 | | - | |
357 | | - | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
358 | 377 | | |
359 | 378 | | |
360 | 379 | | |
361 | | - | |
362 | | - | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
339 | 340 | | |
340 | 341 | | |
341 | 342 | | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
342 | 447 | | |
343 | 448 | | |
344 | 449 | | |
| |||
0 commit comments