Commit dd6f00a
fix(security): close ReDoS, zip-bomb, SSRF and redaction gaps found by audit
A dependency re-audit asked "does this library actually deliver the guarantee
the calling code assumes" rather than "is it popular". These are the results.
Security:
- Copilot VFS glob() handed a caller-controlled pattern to micromatch, whose
picomatch backend compiles `*` into a backtracking regex. A 25-char pattern
took 41s; 29 chars exceeded 180s. Matching now runs on RE2, mirroring the
grep() sibling in the same file that already did this. micromatch.makeRe()
emits lookaheads RE2 cannot express, so picomatch's dot-assertions are
translated into character exclusions; a differential test covers 519,688
pattern/path pairs against micromatch with no mismatches. Patterns that
still carry an assertion fail closed rather than falling back.
- doc-parser was the only OOXML-adjacent parser without the zip-bomb guard.
officeparser sniffs content rather than extension, so a docx renamed .doc
reached an unguarded unzip and could OOM the shared server. Genuine OLE2
.doc files are unaffected. Same guard added to the copilot style reader.
- json-yaml-chunker called yaml.load with no alias-expansion cap. js-yaml has
no maxAliasCount, so this is routed through assertYamlWithinLimits like the
file parser already was.
- Video tools and falai fetched provider-supplied URLs raw, including one that
replayed an Authorization header to a polled status_url. Those URLs are now
origin-pinned and revalidated on every poll. Cross-origin redirects drop
credential headers by default, keyed on registrable domain rather than exact
origin so same-site subdomain hops and http->https upgrades keep working.
- Redaction key patterns were fully anchored, so openai_api_key, x-api-key,
set-cookie, secretAccessKey and session_id were logged in the clear. The
matcher now tokenizes keys, with exemptions so token-usage fields such as
promptTokens stay readable.
- drawtext escaping did not match ffmpeg's quoting grammar; a quote in agent
supplied text escaped into filter options. Text is passed via textfile= so
it never enters the filter string.
- Loop conditions interpolated a resolved value into a JS string by hand.
Supply chain:
- Vendor free-email-domains' data. Its postinstall fetched a CDN CSV and
overwrote the shipped list, so the lockfile hash covered the tarball but not
the data actually used. It is inert under Bun today only because the package
is outside trustedDependencies.
- Document why xlsx is pinned to the SheetJS CDN: the npm copy is frozen at
0.18.5 with two unfixed CVEs, and a URL dependency is invisible to audit
tooling, so upgrades have to be tracked by hand.
Dependencies:
- @daytonaio/sdk is deprecated in favour of @daytona/sdk (same API).
- The @react-email/components 0.x line is deprecated; 1.0.12 needs no source
changes here since no template uses <Tailwind> and render() already moved.
- Load the pptx preview lazily so echarts leaves the Home, Files and share
page bundles.
- Drop autoprefixer (absent from the PostCSS config, so it never ran) and
tailwind-merge (no importers; @sim/emcn declares its own).1 parent b69fdbd commit dd6f00a
34 files changed
Lines changed: 8307 additions & 299 deletions
File tree
- apps/sim
- app
- api/tools
- onedrive/upload
- video
- workspace/[workspaceId]/files/components/file-viewer
- executor/orchestrators
- lib
- chunkers
- copilot
- tools/handlers
- vfs
- core/security
- execution/remote-sandbox
- file-parsers
- media
- messaging/email
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
11 | 15 | | |
12 | 16 | | |
13 | 17 | | |
| |||
18 | 22 | | |
19 | 23 | | |
20 | 24 | | |
| 25 | + | |
21 | 26 | | |
22 | 27 | | |
23 | 28 | | |
| |||
36 | 41 | | |
37 | 42 | | |
38 | 43 | | |
39 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
40 | 61 | | |
41 | 62 | | |
42 | 63 | | |
43 | 64 | | |
44 | 65 | | |
45 | 66 | | |
46 | 67 | | |
47 | | - | |
| 68 | + | |
48 | 69 | | |
49 | 70 | | |
50 | 71 | | |
| |||
53 | 74 | | |
54 | 75 | | |
55 | 76 | | |
56 | | - | |
| 77 | + | |
57 | 78 | | |
58 | 79 | | |
59 | 80 | | |
60 | 81 | | |
61 | 82 | | |
62 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
63 | 123 | | |
64 | 124 | | |
65 | 125 | | |
| |||
461 | 521 | | |
462 | 522 | | |
463 | 523 | | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | 524 | | |
471 | | - | |
| 525 | + | |
472 | 526 | | |
473 | 527 | | |
474 | 528 | | |
| |||
486 | 540 | | |
487 | 541 | | |
488 | 542 | | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
489 | 558 | | |
490 | 559 | | |
491 | 560 | | |
| |||
583 | 652 | | |
584 | 653 | | |
585 | 654 | | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | | - | |
596 | | - | |
597 | 655 | | |
598 | | - | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
599 | 661 | | |
600 | 662 | | |
601 | 663 | | |
| |||
697 | 759 | | |
698 | 760 | | |
699 | 761 | | |
700 | | - | |
701 | | - | |
702 | | - | |
703 | | - | |
704 | | - | |
705 | | - | |
706 | 762 | | |
707 | | - | |
| 763 | + | |
708 | 764 | | |
709 | 765 | | |
710 | 766 | | |
| |||
859 | 915 | | |
860 | 916 | | |
861 | 917 | | |
862 | | - | |
863 | | - | |
864 | | - | |
865 | | - | |
866 | | - | |
867 | | - | |
868 | | - | |
869 | 918 | | |
870 | | - | |
| 919 | + | |
871 | 920 | | |
872 | 921 | | |
873 | 922 | | |
| |||
1160 | 1209 | | |
1161 | 1210 | | |
1162 | 1211 | | |
1163 | | - | |
1164 | | - | |
1165 | | - | |
1166 | | - | |
1167 | | - | |
1168 | | - | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
1169 | 1221 | | |
1170 | 1222 | | |
1171 | 1223 | | |
| |||
1218 | 1270 | | |
1219 | 1271 | | |
1220 | 1272 | | |
1221 | | - | |
| 1273 | + | |
1222 | 1274 | | |
1223 | 1275 | | |
1224 | 1276 | | |
| |||
1242 | 1294 | | |
1243 | 1295 | | |
1244 | 1296 | | |
1245 | | - | |
1246 | | - | |
1247 | | - | |
1248 | | - | |
1249 | | - | |
1250 | | - | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
1251 | 1305 | | |
1252 | 1306 | | |
1253 | 1307 | | |
| |||
1258 | 1312 | | |
1259 | 1313 | | |
1260 | 1314 | | |
1261 | | - | |
1262 | | - | |
1263 | | - | |
1264 | | - | |
1265 | | - | |
| 1315 | + | |
1266 | 1316 | | |
1267 | 1317 | | |
1268 | 1318 | | |
| |||
1282 | 1332 | | |
1283 | 1333 | | |
1284 | 1334 | | |
1285 | | - | |
1286 | | - | |
1287 | | - | |
1288 | | - | |
1289 | | - | |
1290 | | - | |
1291 | | - | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
1292 | 1338 | | |
1293 | 1339 | | |
1294 | 1340 | | |
| |||
1309 | 1355 | | |
1310 | 1356 | | |
1311 | 1357 | | |
1312 | | - | |
1313 | | - | |
1314 | | - | |
1315 | | - | |
1316 | | - | |
| 1358 | + | |
1317 | 1359 | | |
1318 | 1360 | | |
1319 | 1361 | | |
| |||
1325 | 1367 | | |
1326 | 1368 | | |
1327 | 1369 | | |
1328 | | - | |
| 1370 | + | |
1329 | 1371 | | |
1330 | 1372 | | |
1331 | 1373 | | |
| |||
Lines changed: 13 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
| |||
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
36 | 48 | | |
37 | 49 | | |
38 | 50 | | |
| |||
0 commit comments