Commit 2b88944
committed
fix(v2-api): close two secret disclosures and align docs with signatures
Two P0 disclosures, five correctness bugs, and the standardization and
guard work that came out of auditing them.
**Secret disclosure — workflow version state.** `GET /api/v2/workflows/{id}/
versions/{version}` served the deployed graph unsanitized, so a read-role
workspace API key received plaintext block-password values and OAuth
credential ids. The sibling export route has always sanitized. Every other v2
response is protected structurally because the builder re-parses it, but this
field is `z.custom<WorkflowState>()` — a predicate that validates nothing —
which is why it survived earlier audits. Sanitization now lives in the use
case, secure by default, with a named `includeCredentialValues` opt-in that
only the session-authed deploy-preview route sets.
**Secret disclosure — MCP headers.** The internal list and update routes
returned custom `Authorization` headers verbatim to any read-role member;
headers are stored unencrypted. Values are now gated on write permission and
projected through one shared helper. The settings UI genuinely prefills from
them, so blanking outright would wipe headers on unrelated edits — write-only
headers plus encryption at rest are the follow-up.
Correctness:
- v2 execute ignored `X-Sim-Via`, resetting the call chain on every hop and
defeating the recursion guard. Wired on both the keyed and anonymous paths.
- v2 knowledge search accepted `searchMode` and dropped it, silently serving
vector-only results for a hybrid request, and allowed 50MB bodies where
internal caps at 2MiB.
- v2 run cancel never released the plan concurrency slot and half-cancelled
group runs; a group conflict now returns 409 instead of reporting success.
- v2 table row writes stamped no secret provenance, so the next internal read
reported the whole page incomplete. `secretProvenance` is now required on
the primitives, making the next omission a compile error.
- Folder conflicts and malformed paths returned 500; they are 409/404/400 now.
`FolderPathError` splits from `FolderHierarchyError` so a corrupt stored
tree stays a 500 and stays in 5xx alerting.
Standardization and documentation:
- `PUT /files/{id}/share` -> PATCH. The resource is not round-trippable
(`hasPassword`, never the password), so merge-on-omission is the only
implementable semantics.
- ~40 spec truthfulness fixes: a 410 the API cannot emit, eight 423s with no
lock guard, ~30 reachable-but-undocumented 404/400/413s, and six inverted
field claims. Eleven operations that always reject a workspace key now say
so — four of them answer 404, so a workspace key was told the resource did
not exist.
- `NAME_PATTERN` lost its `/i` through `z.toJSONSchema`, publishing 15
patterns that reject names the runtime accepts. Every generated client
rejected any capitalized table or column name, and two of the spec's own
examples failed the spec's own schema.
Guards, so these classes cannot recur:
- `check:route-verbs` (new) cross-checks all 212 builder routes' exported verb
and path against their contract. The builders only compare at runtime, so a
half-done rename previously passed CI and 500'd in production.
- Example validation now runs against the published JSON Schema with formats
on, covering 225 nodes instead of 100 — this is what caught the regex bug.
- The list-pagination sweep is union-aware and fails loudly on a schema it
cannot introspect, rather than counting it compliant.1 parent 1dd85eb commit 2b88944
73 files changed
Lines changed: 3164 additions & 1075 deletions
File tree
- apps
- docs
- sim
- app
- api
- mcp/servers
- [id]
- v2
- files
- folders
- knowledge/search
- mcp-servers
- tables
- [tableId]/views/[viewId]
- workflows/[id]
- execute
- versions/[version]
- workflows/[id]/deployments/[version]
- workspace/[workspaceId]/tables/components/import-csv-dialog
- background
- lib
- api/contracts
- v2
- __tests__
- openapi
- core/config
- execution
- folders
- mcp
- table
- __tests__
- application
- uploads/contexts/workspace
- workflows
- application
- executor
- workspace-files/application
- scripts
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
84 | 88 | | |
85 | 89 | | |
86 | 90 | | |
| |||
128 | 132 | | |
129 | 133 | | |
130 | 134 | | |
131 | | - | |
| 135 | + | |
| 136 | + | |
132 | 137 | | |
133 | 138 | | |
134 | 139 | | |
| |||
221 | 226 | | |
222 | 227 | | |
223 | 228 | | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
224 | 232 | | |
225 | 233 | | |
226 | 234 | | |
| |||
240 | 248 | | |
241 | 249 | | |
242 | 250 | | |
243 | | - | |
| 251 | + | |
244 | 252 | | |
245 | 253 | | |
246 | 254 | | |
| |||
381 | 389 | | |
382 | 390 | | |
383 | 391 | | |
384 | | - | |
| 392 | + | |
385 | 393 | | |
386 | 394 | | |
387 | 395 | | |
| |||
425 | 433 | | |
426 | 434 | | |
427 | 435 | | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
428 | 446 | | |
429 | 447 | | |
430 | 448 | | |
| |||
502 | 520 | | |
503 | 521 | | |
504 | 522 | | |
505 | | - | |
| 523 | + | |
506 | 524 | | |
507 | 525 | | |
508 | 526 | | |
509 | 527 | | |
510 | | - | |
| 528 | + | |
511 | 529 | | |
512 | 530 | | |
513 | 531 | | |
514 | 532 | | |
515 | 533 | | |
516 | | - | |
| 534 | + | |
517 | 535 | | |
518 | 536 | | |
519 | 537 | | |
| |||
529 | 547 | | |
530 | 548 | | |
531 | 549 | | |
532 | | - | |
| 550 | + | |
533 | 551 | | |
534 | 552 | | |
535 | 553 | | |
536 | | - | |
| 554 | + | |
537 | 555 | | |
538 | 556 | | |
539 | 557 | | |
540 | | - | |
| 558 | + | |
541 | 559 | | |
542 | 560 | | |
543 | 561 | | |
544 | 562 | | |
545 | | - | |
| 563 | + | |
546 | 564 | | |
547 | 565 | | |
548 | 566 | | |
| |||
717 | 735 | | |
718 | 736 | | |
719 | 737 | | |
720 | | - | |
| 738 | + | |
721 | 739 | | |
722 | 740 | | |
723 | 741 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
356 | 356 | | |
357 | 357 | | |
358 | 358 | | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
359 | 362 | | |
360 | 363 | | |
361 | 364 | | |
| |||
896 | 899 | | |
897 | 900 | | |
898 | 901 | | |
899 | | - | |
| 902 | + | |
900 | 903 | | |
901 | 904 | | |
902 | 905 | | |
| |||
1065 | 1068 | | |
1066 | 1069 | | |
1067 | 1070 | | |
1068 | | - | |
| 1071 | + | |
1069 | 1072 | | |
1070 | 1073 | | |
1071 | 1074 | | |
| |||
1113 | 1116 | | |
1114 | 1117 | | |
1115 | 1118 | | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
1116 | 1122 | | |
1117 | 1123 | | |
1118 | 1124 | | |
| |||
1277 | 1283 | | |
1278 | 1284 | | |
1279 | 1285 | | |
1280 | | - | |
| 1286 | + | |
1281 | 1287 | | |
1282 | 1288 | | |
1283 | | - | |
| 1289 | + | |
1284 | 1290 | | |
1285 | 1291 | | |
1286 | 1292 | | |
| |||
1505 | 1511 | | |
1506 | 1512 | | |
1507 | 1513 | | |
1508 | | - | |
| 1514 | + | |
1509 | 1515 | | |
1510 | 1516 | | |
1511 | 1517 | | |
| |||
1600 | 1606 | | |
1601 | 1607 | | |
1602 | 1608 | | |
1603 | | - | |
1604 | | - | |
1605 | | - | |
1606 | 1609 | | |
1607 | 1610 | | |
1608 | 1611 | | |
| |||
1631 | 1634 | | |
1632 | 1635 | | |
1633 | 1636 | | |
1634 | | - | |
| 1637 | + | |
1635 | 1638 | | |
1636 | 1639 | | |
1637 | 1640 | | |
| |||
1837 | 1840 | | |
1838 | 1841 | | |
1839 | 1842 | | |
1840 | | - | |
| 1843 | + | |
1841 | 1844 | | |
1842 | 1845 | | |
1843 | 1846 | | |
| |||
2003 | 2006 | | |
2004 | 2007 | | |
2005 | 2008 | | |
2006 | | - | |
| 2009 | + | |
2007 | 2010 | | |
2008 | 2011 | | |
2009 | 2012 | | |
| |||
2047 | 2050 | | |
2048 | 2051 | | |
2049 | 2052 | | |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
2050 | 2063 | | |
2051 | 2064 | | |
2052 | 2065 | | |
| |||
2192 | 2205 | | |
2193 | 2206 | | |
2194 | 2207 | | |
2195 | | - | |
| 2208 | + | |
2196 | 2209 | | |
2197 | 2210 | | |
2198 | 2211 | | |
| |||
2272 | 2285 | | |
2273 | 2286 | | |
2274 | 2287 | | |
2275 | | - | |
| 2288 | + | |
2276 | 2289 | | |
2277 | 2290 | | |
2278 | 2291 | | |
| |||
2980 | 2993 | | |
2981 | 2994 | | |
2982 | 2995 | | |
2983 | | - | |
| 2996 | + | |
2984 | 2997 | | |
2985 | 2998 | | |
2986 | 2999 | | |
| |||
3276 | 3289 | | |
3277 | 3290 | | |
3278 | 3291 | | |
3279 | | - | |
| 3292 | + | |
3280 | 3293 | | |
3281 | 3294 | | |
3282 | 3295 | | |
| |||
3421 | 3434 | | |
3422 | 3435 | | |
3423 | 3436 | | |
3424 | | - | |
| 3437 | + | |
3425 | 3438 | | |
3426 | 3439 | | |
3427 | 3440 | | |
| |||
0 commit comments