Commit a0c6cd7
fix: 14 high-severity issues from 130-point audit (batches 1-3)
Batch 1 — Server resilience (_llm.py):
- B2: Distinguish HTTP 429/connection-lost/timeout errors with specific messages
- B13: Auto-restart server on connection refused (crash detection)
- J4: FileNotFoundError on missing model/binary before subprocess start
- J5: Timeout returns specific error type (not generic)
- J11: _check_server_alive() polls process status between calls
- Exponential backoff retry (1 retry on 429/network, immediate restart on crash)
Batch 2 — Locator/Researcher safety (researcher.py):
- B10: try/except around lookup.lookup() — exception → skip chunk, continue
- A13: Log exhaustion details (tried N/total chunks, no CONFIDENT found)
- Best-answer selection from attempts (prefer non-error, non-contradicted)
Batch 3 — C server hardening (quant_server_unified.c):
- C6: Port validation (1-65535), thread count validation (1-256)
- A14: Unique completion IDs (timestamp + counter, not just timestamp)
- B12: 30s read timeout on client socket (slow-loris protection)
- Empty request guard (client disconnect before sending data)
- Buffer size calculation uses resp_cap variable (overflow prevention)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 4b8ce4b commit a0c6cd7
3 files changed
Lines changed: 126 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
215 | 236 | | |
216 | 237 | | |
217 | 238 | | |
| |||
226 | 247 | | |
227 | 248 | | |
228 | 249 | | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
229 | 255 | | |
230 | 256 | | |
231 | 257 | | |
| |||
238 | 264 | | |
239 | 265 | | |
240 | 266 | | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | 267 | | |
246 | 268 | | |
247 | 269 | | |
| |||
259 | 281 | | |
260 | 282 | | |
261 | 283 | | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | 284 | | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
276 | 335 | | |
277 | | - | |
278 | | - | |
| 336 | + | |
| 337 | + | |
279 | 338 | | |
280 | 339 | | |
281 | 340 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
68 | 78 | | |
69 | 79 | | |
70 | 80 | | |
| |||
104 | 114 | | |
105 | 115 | | |
106 | 116 | | |
107 | | - | |
108 | | - | |
109 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
110 | 131 | | |
111 | 132 | | |
112 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
278 | 278 | | |
279 | 279 | | |
280 | 280 | | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
281 | 286 | | |
282 | 287 | | |
283 | 288 | | |
284 | 289 | | |
285 | | - | |
| 290 | + | |
286 | 291 | | |
287 | 292 | | |
288 | 293 | | |
289 | 294 | | |
290 | 295 | | |
| 296 | + | |
| 297 | + | |
291 | 298 | | |
292 | 299 | | |
293 | 300 | | |
| |||
359 | 366 | | |
360 | 367 | | |
361 | 368 | | |
362 | | - | |
363 | | - | |
364 | | - | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
365 | 374 | | |
366 | 375 | | |
367 | 376 | | |
| |||
497 | 506 | | |
498 | 507 | | |
499 | 508 | | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
500 | 519 | | |
501 | 520 | | |
502 | 521 | | |
| |||
0 commit comments