Commit 2244617
fix: address security audit findings from aisafe.io
Fix 15 security issues identified in the aisafe.io audit:
Critical/High:
- Safe UTF-8 byte slicing in subdomain extraction (RQS-015)
- JWT type confusion: deny_unknown_fields on Claims (RQS-004)
- Cache eviction O(N*M) loop: collect keys once outside loop (RQS-008)
- Cross-tenant quota bypass: fix subdomain extraction for DNS keys (RQS-005)
- Cache leak: recognize request: keys in extract_subdomain_from_key (RQS-009)
- Request deletion index desync: scan list by ID instead (RQS-007)
- DNS amplification: TXT record 512-char limit + UDP truncation bit (RQS-006)
- TCP exhaustion: semaphore (100 conns) + 30s read timeout (RQS-013)
- SMTP memory exhaustion: 64KB log cap, 500 cmd limit, 100 rcpt limit (RQS-003)
- WebSocket memory burst: limit initial history to last 100 requests (RQS-014)
- XSS mitigation: sandbox CSP + nosniff on served files (RQS-002)
Low/Info:
- Constant-time admin token comparison (RQS-001)
- DNS per-IP rate limiting at 100 qps (RQS-012)
- WebSocket message rate limiting at 30 msg/s (RQS-011)
- Share token endpoint rate limiting (RQS-010)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent fb39b70 commit 2244617
10 files changed
Lines changed: 322 additions & 70 deletions
File tree
- src/src
- cache
- dns
- http
- models
- smtp
- tcp
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
421 | 424 | | |
422 | 425 | | |
423 | 426 | | |
424 | 427 | | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | 428 | | |
429 | 429 | | |
430 | 430 | | |
| |||
490 | 490 | | |
491 | 491 | | |
492 | 492 | | |
493 | | - | |
| 493 | + | |
494 | 494 | | |
495 | 495 | | |
496 | 496 | | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
497 | 501 | | |
498 | 502 | | |
499 | 503 | | |
| |||
502 | 506 | | |
503 | 507 | | |
504 | 508 | | |
| 509 | + | |
505 | 510 | | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
512 | 520 | | |
513 | 521 | | |
514 | 522 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
5 | 6 | | |
6 | | - | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | | - | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
21 | 71 | | |
22 | 72 | | |
23 | 73 | | |
| |||
33 | 83 | | |
34 | 84 | | |
35 | 85 | | |
| 86 | + | |
| 87 | + | |
36 | 88 | | |
37 | 89 | | |
38 | 90 | | |
39 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
40 | 107 | | |
41 | 108 | | |
42 | 109 | | |
| |||
97 | 164 | | |
98 | 165 | | |
99 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
100 | 183 | | |
101 | 184 | | |
102 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
| 185 | + | |
186 | 186 | | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
| 187 | + | |
200 | 188 | | |
201 | 189 | | |
202 | 190 | | |
| |||
368 | 356 | | |
369 | 357 | | |
370 | 358 | | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
371 | 364 | | |
372 | 365 | | |
373 | 366 | | |
| |||
0 commit comments