@tellescope/sdk 1.256.13 → 1.256.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (352) hide show
  1. package/lib/cjs/tests/api_tests/auto_merge_form_submission.test.js +1 -1
  2. package/lib/cjs/tests/api_tests/auto_merge_form_submission.test.js.map +1 -1
  3. package/lib/cjs/tests/api_tests/enduser_observations_auto_review.test.d.ts +5 -0
  4. package/lib/cjs/tests/api_tests/enduser_observations_auto_review.test.d.ts.map +1 -0
  5. package/lib/cjs/tests/api_tests/enduser_observations_auto_review.test.js +388 -0
  6. package/lib/cjs/tests/api_tests/enduser_observations_auto_review.test.js.map +1 -0
  7. package/lib/cjs/tests/api_tests/integrations_redacted.test.js +3 -3
  8. package/lib/cjs/tests/api_tests/integrations_redacted.test.js.map +1 -1
  9. package/lib/cjs/tests/api_tests/organization_signup.test.d.ts +20 -0
  10. package/lib/cjs/tests/api_tests/organization_signup.test.d.ts.map +1 -0
  11. package/lib/cjs/tests/api_tests/organization_signup.test.js +272 -0
  12. package/lib/cjs/tests/api_tests/organization_signup.test.js.map +1 -0
  13. package/lib/cjs/tests/api_tests/purchase_made_trigger.test.d.ts.map +1 -1
  14. package/lib/cjs/tests/api_tests/purchase_made_trigger.test.js +103 -162
  15. package/lib/cjs/tests/api_tests/purchase_made_trigger.test.js.map +1 -1
  16. package/lib/cjs/tests/api_tests/security/F-0179-booking-info-idor-token-mint.test.d.ts +30 -0
  17. package/lib/cjs/tests/api_tests/security/F-0179-booking-info-idor-token-mint.test.d.ts.map +1 -0
  18. package/lib/cjs/tests/api_tests/security/F-0179-booking-info-idor-token-mint.test.js +336 -0
  19. package/lib/cjs/tests/api_tests/security/F-0179-booking-info-idor-token-mint.test.js.map +1 -0
  20. package/lib/cjs/tests/api_tests/security/F-0185-startlinktoken-enduser-staff-escalation.test.d.ts +6 -0
  21. package/lib/cjs/tests/api_tests/security/F-0185-startlinktoken-enduser-staff-escalation.test.d.ts.map +1 -0
  22. package/lib/cjs/tests/api_tests/security/F-0185-startlinktoken-enduser-staff-escalation.test.js +354 -0
  23. package/lib/cjs/tests/api_tests/security/F-0185-startlinktoken-enduser-staff-escalation.test.js.map +1 -0
  24. package/lib/cjs/tests/api_tests/security/F-0191-schema-adminonly-enforcement.test.d.ts +46 -0
  25. package/lib/cjs/tests/api_tests/security/F-0191-schema-adminonly-enforcement.test.d.ts.map +1 -0
  26. package/lib/cjs/tests/api_tests/security/F-0191-schema-adminonly-enforcement.test.js +389 -0
  27. package/lib/cjs/tests/api_tests/security/F-0191-schema-adminonly-enforcement.test.js.map +1 -0
  28. package/lib/cjs/tests/api_tests/security/F-0192-automated-actions-process-gate.test.d.ts +43 -0
  29. package/lib/cjs/tests/api_tests/security/F-0192-automated-actions-process-gate.test.d.ts.map +1 -0
  30. package/lib/cjs/tests/api_tests/security/F-0192-automated-actions-process-gate.test.js +324 -0
  31. package/lib/cjs/tests/api_tests/security/F-0192-automated-actions-process-gate.test.js.map +1 -0
  32. package/lib/cjs/tests/api_tests/security/F-0196-add-to-journey-foreign-enduserid.test.d.ts +43 -0
  33. package/lib/cjs/tests/api_tests/security/F-0196-add-to-journey-foreign-enduserid.test.d.ts.map +1 -0
  34. package/lib/cjs/tests/api_tests/security/F-0196-add-to-journey-foreign-enduserid.test.js +282 -0
  35. package/lib/cjs/tests/api_tests/security/F-0196-add-to-journey-foreign-enduserid.test.js.map +1 -0
  36. package/lib/cjs/tests/api_tests/security/F-0200-form-logic-js-execution.test.d.ts +33 -0
  37. package/lib/cjs/tests/api_tests/security/F-0200-form-logic-js-execution.test.d.ts.map +1 -0
  38. package/lib/cjs/tests/api_tests/security/F-0200-form-logic-js-execution.test.js +249 -0
  39. package/lib/cjs/tests/api_tests/security/F-0200-form-logic-js-execution.test.js.map +1 -0
  40. package/lib/cjs/tests/api_tests/security/add-to-journey-foreign-enduserid.test.d.ts +42 -0
  41. package/lib/cjs/tests/api_tests/security/add-to-journey-foreign-enduserid.test.d.ts.map +1 -0
  42. package/lib/cjs/tests/api_tests/security/add-to-journey-foreign-enduserid.test.js +281 -0
  43. package/lib/cjs/tests/api_tests/security/add-to-journey-foreign-enduserid.test.js.map +1 -0
  44. package/lib/cjs/tests/api_tests/security/ai-conversations-rbac.test.d.ts +38 -0
  45. package/lib/cjs/tests/api_tests/security/ai-conversations-rbac.test.d.ts.map +1 -0
  46. package/lib/cjs/tests/api_tests/security/ai-conversations-rbac.test.js +390 -0
  47. package/lib/cjs/tests/api_tests/security/ai-conversations-rbac.test.js.map +1 -0
  48. package/lib/cjs/tests/api_tests/security/allowed-paths-confinement.test.d.ts +6 -0
  49. package/lib/cjs/tests/api_tests/security/allowed-paths-confinement.test.d.ts.map +1 -0
  50. package/lib/cjs/tests/api_tests/security/allowed-paths-confinement.test.js +1003 -0
  51. package/lib/cjs/tests/api_tests/security/allowed-paths-confinement.test.js.map +1 -0
  52. package/lib/cjs/tests/api_tests/security/automated-actions-process-gate.test.d.ts +42 -0
  53. package/lib/cjs/tests/api_tests/security/automated-actions-process-gate.test.d.ts.map +1 -0
  54. package/lib/cjs/tests/api_tests/security/automated-actions-process-gate.test.js +323 -0
  55. package/lib/cjs/tests/api_tests/security/automated-actions-process-gate.test.js.map +1 -0
  56. package/lib/cjs/tests/api_tests/security/booking-info-idor-token-mint.test.d.ts +29 -0
  57. package/lib/cjs/tests/api_tests/security/booking-info-idor-token-mint.test.d.ts.map +1 -0
  58. package/lib/cjs/tests/api_tests/security/booking-info-idor-token-mint.test.js +335 -0
  59. package/lib/cjs/tests/api_tests/security/booking-info-idor-token-mint.test.js.map +1 -0
  60. package/lib/cjs/tests/api_tests/security/cascade-role-rename-cross-tenant.test.d.ts +32 -0
  61. package/lib/cjs/tests/api_tests/security/cascade-role-rename-cross-tenant.test.d.ts.map +1 -0
  62. package/lib/cjs/tests/api_tests/security/cascade-role-rename-cross-tenant.test.js +237 -0
  63. package/lib/cjs/tests/api_tests/security/cascade-role-rename-cross-tenant.test.js.map +1 -0
  64. package/lib/cjs/tests/api_tests/security/data-sync-redaction-bypass.test.d.ts +28 -0
  65. package/lib/cjs/tests/api_tests/security/data-sync-redaction-bypass.test.d.ts.map +1 -0
  66. package/lib/cjs/tests/api_tests/security/data-sync-redaction-bypass.test.js +349 -0
  67. package/lib/cjs/tests/api_tests/security/data-sync-redaction-bypass.test.js.map +1 -0
  68. package/lib/cjs/tests/api_tests/security/develop-health-benefit-verification-rbac.test.d.ts +30 -0
  69. package/lib/cjs/tests/api_tests/security/develop-health-benefit-verification-rbac.test.d.ts.map +1 -0
  70. package/lib/cjs/tests/api_tests/security/develop-health-benefit-verification-rbac.test.js +314 -0
  71. package/lib/cjs/tests/api_tests/security/develop-health-benefit-verification-rbac.test.js.map +1 -0
  72. package/lib/cjs/tests/api_tests/security/enduser-cross-create.test.d.ts +21 -0
  73. package/lib/cjs/tests/api_tests/security/enduser-cross-create.test.d.ts.map +1 -0
  74. package/lib/cjs/tests/api_tests/security/enduser-cross-create.test.js +362 -0
  75. package/lib/cjs/tests/api_tests/security/enduser-cross-create.test.js.map +1 -0
  76. package/lib/cjs/tests/api_tests/security/enduser-write-restrictions.test.d.ts +21 -0
  77. package/lib/cjs/tests/api_tests/security/enduser-write-restrictions.test.d.ts.map +1 -0
  78. package/lib/cjs/tests/api_tests/security/enduser-write-restrictions.test.js +366 -0
  79. package/lib/cjs/tests/api_tests/security/enduser-write-restrictions.test.js.map +1 -0
  80. package/lib/cjs/tests/api_tests/security/form-logic-js-execution.test.d.ts +32 -0
  81. package/lib/cjs/tests/api_tests/security/form-logic-js-execution.test.d.ts.map +1 -0
  82. package/lib/cjs/tests/api_tests/security/form-logic-js-execution.test.js +248 -0
  83. package/lib/cjs/tests/api_tests/security/form-logic-js-execution.test.js.map +1 -0
  84. package/lib/cjs/tests/api_tests/security/globalunique-conflict-redaction.test.d.ts +19 -0
  85. package/lib/cjs/tests/api_tests/security/globalunique-conflict-redaction.test.d.ts.map +1 -0
  86. package/lib/cjs/tests/api_tests/security/globalunique-conflict-redaction.test.js +138 -0
  87. package/lib/cjs/tests/api_tests/security/globalunique-conflict-redaction.test.js.map +1 -0
  88. package/lib/cjs/tests/api_tests/security/handle-incoming-communication-cross-tenant.test.d.ts +24 -0
  89. package/lib/cjs/tests/api_tests/security/handle-incoming-communication-cross-tenant.test.d.ts.map +1 -0
  90. package/lib/cjs/tests/api_tests/security/handle-incoming-communication-cross-tenant.test.js +201 -0
  91. package/lib/cjs/tests/api_tests/security/handle-incoming-communication-cross-tenant.test.js.map +1 -0
  92. package/lib/cjs/tests/api_tests/security/invite-user-enumeration.test.d.ts +29 -0
  93. package/lib/cjs/tests/api_tests/security/invite-user-enumeration.test.d.ts.map +1 -0
  94. package/lib/cjs/tests/api_tests/security/invite-user-enumeration.test.js +278 -0
  95. package/lib/cjs/tests/api_tests/security/invite-user-enumeration.test.js.map +1 -0
  96. package/lib/cjs/tests/api_tests/security/load-inbox-redaction.test.d.ts +17 -0
  97. package/lib/cjs/tests/api_tests/security/load-inbox-redaction.test.d.ts.map +1 -0
  98. package/lib/cjs/tests/api_tests/security/load-inbox-redaction.test.js +155 -0
  99. package/lib/cjs/tests/api_tests/security/load-inbox-redaction.test.js.map +1 -0
  100. package/lib/cjs/tests/api_tests/security/prototype-pollution.test.d.ts +2 -0
  101. package/lib/cjs/tests/api_tests/security/prototype-pollution.test.d.ts.map +1 -0
  102. package/lib/cjs/tests/api_tests/security/prototype-pollution.test.js +88 -0
  103. package/lib/cjs/tests/api_tests/security/prototype-pollution.test.js.map +1 -0
  104. package/lib/cjs/tests/api_tests/security/proxy-image-unauth-ssrf.test.d.ts +34 -0
  105. package/lib/cjs/tests/api_tests/security/proxy-image-unauth-ssrf.test.d.ts.map +1 -0
  106. package/lib/cjs/tests/api_tests/security/proxy-image-unauth-ssrf.test.js +230 -0
  107. package/lib/cjs/tests/api_tests/security/proxy-image-unauth-ssrf.test.js.map +1 -0
  108. package/lib/cjs/tests/api_tests/security/sanitize-user-html-with-iframes.test.d.ts +2 -0
  109. package/lib/cjs/tests/api_tests/security/sanitize-user-html-with-iframes.test.d.ts.map +1 -0
  110. package/lib/cjs/tests/api_tests/security/sanitize-user-html-with-iframes.test.js +242 -0
  111. package/lib/cjs/tests/api_tests/security/sanitize-user-html-with-iframes.test.js.map +1 -0
  112. package/lib/cjs/tests/api_tests/security/sanitize-user-html.test.d.ts +2 -0
  113. package/lib/cjs/tests/api_tests/security/sanitize-user-html.test.d.ts.map +1 -0
  114. package/lib/cjs/tests/api_tests/security/sanitize-user-html.test.js +148 -0
  115. package/lib/cjs/tests/api_tests/security/sanitize-user-html.test.js.map +1 -0
  116. package/lib/cjs/tests/api_tests/security/schema-adminonly-enforcement.test.d.ts +45 -0
  117. package/lib/cjs/tests/api_tests/security/schema-adminonly-enforcement.test.d.ts.map +1 -0
  118. package/lib/cjs/tests/api_tests/security/schema-adminonly-enforcement.test.js +388 -0
  119. package/lib/cjs/tests/api_tests/security/schema-adminonly-enforcement.test.js.map +1 -0
  120. package/lib/cjs/tests/api_tests/security/self-admin-role-assignment.test.d.ts +38 -0
  121. package/lib/cjs/tests/api_tests/security/self-admin-role-assignment.test.d.ts.map +1 -0
  122. package/lib/cjs/tests/api_tests/security/self-admin-role-assignment.test.js +222 -0
  123. package/lib/cjs/tests/api_tests/security/self-admin-role-assignment.test.js.map +1 -0
  124. package/lib/cjs/tests/api_tests/security/startlinktoken-enduser-staff-escalation.test.d.ts +6 -0
  125. package/lib/cjs/tests/api_tests/security/startlinktoken-enduser-staff-escalation.test.d.ts.map +1 -0
  126. package/lib/cjs/tests/api_tests/security/startlinktoken-enduser-staff-escalation.test.js +354 -0
  127. package/lib/cjs/tests/api_tests/security/startlinktoken-enduser-staff-escalation.test.js.map +1 -0
  128. package/lib/cjs/tests/api_tests/security/webhook-outbound-ssrf.test.d.ts +28 -0
  129. package/lib/cjs/tests/api_tests/security/webhook-outbound-ssrf.test.d.ts.map +1 -0
  130. package/lib/cjs/tests/api_tests/security/webhook-outbound-ssrf.test.js +442 -0
  131. package/lib/cjs/tests/api_tests/security/webhook-outbound-ssrf.test.js.map +1 -0
  132. package/lib/cjs/tests/api_tests/security/webhook-timeout.test.d.ts +19 -0
  133. package/lib/cjs/tests/api_tests/security/webhook-timeout.test.d.ts.map +1 -0
  134. package/lib/cjs/tests/api_tests/security/webhook-timeout.test.js +156 -0
  135. package/lib/cjs/tests/api_tests/security/webhook-timeout.test.js.map +1 -0
  136. package/lib/cjs/tests/api_tests/tickets_bulk_assign_from_queue.test.d.ts +5 -0
  137. package/lib/cjs/tests/api_tests/tickets_bulk_assign_from_queue.test.d.ts.map +1 -0
  138. package/lib/cjs/tests/api_tests/tickets_bulk_assign_from_queue.test.js +329 -0
  139. package/lib/cjs/tests/api_tests/tickets_bulk_assign_from_queue.test.js.map +1 -0
  140. package/lib/cjs/tests/api_tests/webhook_error_handling.test.js +2 -2
  141. package/lib/cjs/tests/api_tests/webhook_error_handling.test.js.map +1 -1
  142. package/lib/cjs/tests/setup_isolated.d.ts +68 -0
  143. package/lib/cjs/tests/setup_isolated.d.ts.map +1 -0
  144. package/lib/cjs/tests/setup_isolated.js +232 -0
  145. package/lib/cjs/tests/setup_isolated.js.map +1 -0
  146. package/lib/cjs/tests/tests.d.ts.map +1 -1
  147. package/lib/cjs/tests/tests.js +287 -227
  148. package/lib/cjs/tests/tests.js.map +1 -1
  149. package/lib/cjs/tests/unit_tests/do_not_send_address.test.d.ts +2 -0
  150. package/lib/cjs/tests/unit_tests/do_not_send_address.test.d.ts.map +1 -0
  151. package/lib/cjs/tests/unit_tests/do_not_send_address.test.js +89 -0
  152. package/lib/cjs/tests/unit_tests/do_not_send_address.test.js.map +1 -0
  153. package/lib/cjs/tests/unit_tests/openapi_spec_freshness.test.d.ts +17 -0
  154. package/lib/cjs/tests/unit_tests/openapi_spec_freshness.test.d.ts.map +1 -0
  155. package/lib/cjs/tests/unit_tests/openapi_spec_freshness.test.js +140 -0
  156. package/lib/cjs/tests/unit_tests/openapi_spec_freshness.test.js.map +1 -0
  157. package/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -0
  158. package/lib/esm/tests/api_tests/auto_merge_form_submission.test.js +1 -1
  159. package/lib/esm/tests/api_tests/auto_merge_form_submission.test.js.map +1 -1
  160. package/lib/esm/tests/api_tests/enduser_observations_auto_review.test.d.ts +5 -0
  161. package/lib/esm/tests/api_tests/enduser_observations_auto_review.test.d.ts.map +1 -0
  162. package/lib/esm/tests/api_tests/enduser_observations_auto_review.test.js +383 -0
  163. package/lib/esm/tests/api_tests/enduser_observations_auto_review.test.js.map +1 -0
  164. package/lib/esm/tests/api_tests/integrations_redacted.test.js +3 -3
  165. package/lib/esm/tests/api_tests/integrations_redacted.test.js.map +1 -1
  166. package/lib/esm/tests/api_tests/organization_signup.test.d.ts +20 -0
  167. package/lib/esm/tests/api_tests/organization_signup.test.d.ts.map +1 -0
  168. package/lib/esm/tests/api_tests/organization_signup.test.js +264 -0
  169. package/lib/esm/tests/api_tests/organization_signup.test.js.map +1 -0
  170. package/lib/esm/tests/api_tests/purchase_made_trigger.test.d.ts.map +1 -1
  171. package/lib/esm/tests/api_tests/purchase_made_trigger.test.js +104 -163
  172. package/lib/esm/tests/api_tests/purchase_made_trigger.test.js.map +1 -1
  173. package/lib/esm/tests/api_tests/security/F-0179-booking-info-idor-token-mint.test.d.ts +30 -0
  174. package/lib/esm/tests/api_tests/security/F-0179-booking-info-idor-token-mint.test.d.ts.map +1 -0
  175. package/lib/esm/tests/api_tests/security/F-0179-booking-info-idor-token-mint.test.js +332 -0
  176. package/lib/esm/tests/api_tests/security/F-0179-booking-info-idor-token-mint.test.js.map +1 -0
  177. package/lib/esm/tests/api_tests/security/F-0185-startlinktoken-enduser-staff-escalation.test.d.ts +6 -0
  178. package/lib/esm/tests/api_tests/security/F-0185-startlinktoken-enduser-staff-escalation.test.d.ts.map +1 -0
  179. package/lib/esm/tests/api_tests/security/F-0185-startlinktoken-enduser-staff-escalation.test.js +350 -0
  180. package/lib/esm/tests/api_tests/security/F-0185-startlinktoken-enduser-staff-escalation.test.js.map +1 -0
  181. package/lib/esm/tests/api_tests/security/F-0191-schema-adminonly-enforcement.test.d.ts +46 -0
  182. package/lib/esm/tests/api_tests/security/F-0191-schema-adminonly-enforcement.test.d.ts.map +1 -0
  183. package/lib/esm/tests/api_tests/security/F-0191-schema-adminonly-enforcement.test.js +382 -0
  184. package/lib/esm/tests/api_tests/security/F-0191-schema-adminonly-enforcement.test.js.map +1 -0
  185. package/lib/esm/tests/api_tests/security/F-0192-automated-actions-process-gate.test.d.ts +43 -0
  186. package/lib/esm/tests/api_tests/security/F-0192-automated-actions-process-gate.test.d.ts.map +1 -0
  187. package/lib/esm/tests/api_tests/security/F-0192-automated-actions-process-gate.test.js +317 -0
  188. package/lib/esm/tests/api_tests/security/F-0192-automated-actions-process-gate.test.js.map +1 -0
  189. package/lib/esm/tests/api_tests/security/F-0196-add-to-journey-foreign-enduserid.test.d.ts +43 -0
  190. package/lib/esm/tests/api_tests/security/F-0196-add-to-journey-foreign-enduserid.test.d.ts.map +1 -0
  191. package/lib/esm/tests/api_tests/security/F-0196-add-to-journey-foreign-enduserid.test.js +277 -0
  192. package/lib/esm/tests/api_tests/security/F-0196-add-to-journey-foreign-enduserid.test.js.map +1 -0
  193. package/lib/esm/tests/api_tests/security/F-0200-form-logic-js-execution.test.d.ts +33 -0
  194. package/lib/esm/tests/api_tests/security/F-0200-form-logic-js-execution.test.d.ts.map +1 -0
  195. package/lib/esm/tests/api_tests/security/F-0200-form-logic-js-execution.test.js +244 -0
  196. package/lib/esm/tests/api_tests/security/F-0200-form-logic-js-execution.test.js.map +1 -0
  197. package/lib/esm/tests/api_tests/security/add-to-journey-foreign-enduserid.test.d.ts +42 -0
  198. package/lib/esm/tests/api_tests/security/add-to-journey-foreign-enduserid.test.d.ts.map +1 -0
  199. package/lib/esm/tests/api_tests/security/add-to-journey-foreign-enduserid.test.js +276 -0
  200. package/lib/esm/tests/api_tests/security/add-to-journey-foreign-enduserid.test.js.map +1 -0
  201. package/lib/esm/tests/api_tests/security/ai-conversations-rbac.test.d.ts +38 -0
  202. package/lib/esm/tests/api_tests/security/ai-conversations-rbac.test.d.ts.map +1 -0
  203. package/lib/esm/tests/api_tests/security/ai-conversations-rbac.test.js +386 -0
  204. package/lib/esm/tests/api_tests/security/ai-conversations-rbac.test.js.map +1 -0
  205. package/lib/esm/tests/api_tests/security/allowed-paths-confinement.test.d.ts +6 -0
  206. package/lib/esm/tests/api_tests/security/allowed-paths-confinement.test.d.ts.map +1 -0
  207. package/lib/esm/tests/api_tests/security/allowed-paths-confinement.test.js +996 -0
  208. package/lib/esm/tests/api_tests/security/allowed-paths-confinement.test.js.map +1 -0
  209. package/lib/esm/tests/api_tests/security/automated-actions-process-gate.test.d.ts +42 -0
  210. package/lib/esm/tests/api_tests/security/automated-actions-process-gate.test.d.ts.map +1 -0
  211. package/lib/esm/tests/api_tests/security/automated-actions-process-gate.test.js +316 -0
  212. package/lib/esm/tests/api_tests/security/automated-actions-process-gate.test.js.map +1 -0
  213. package/lib/esm/tests/api_tests/security/booking-info-idor-token-mint.test.d.ts +29 -0
  214. package/lib/esm/tests/api_tests/security/booking-info-idor-token-mint.test.d.ts.map +1 -0
  215. package/lib/esm/tests/api_tests/security/booking-info-idor-token-mint.test.js +331 -0
  216. package/lib/esm/tests/api_tests/security/booking-info-idor-token-mint.test.js.map +1 -0
  217. package/lib/esm/tests/api_tests/security/cascade-role-rename-cross-tenant.test.d.ts +32 -0
  218. package/lib/esm/tests/api_tests/security/cascade-role-rename-cross-tenant.test.d.ts.map +1 -0
  219. package/lib/esm/tests/api_tests/security/cascade-role-rename-cross-tenant.test.js +233 -0
  220. package/lib/esm/tests/api_tests/security/cascade-role-rename-cross-tenant.test.js.map +1 -0
  221. package/lib/esm/tests/api_tests/security/data-sync-redaction-bypass.test.d.ts +28 -0
  222. package/lib/esm/tests/api_tests/security/data-sync-redaction-bypass.test.d.ts.map +1 -0
  223. package/lib/esm/tests/api_tests/security/data-sync-redaction-bypass.test.js +345 -0
  224. package/lib/esm/tests/api_tests/security/data-sync-redaction-bypass.test.js.map +1 -0
  225. package/lib/esm/tests/api_tests/security/develop-health-benefit-verification-rbac.test.d.ts +30 -0
  226. package/lib/esm/tests/api_tests/security/develop-health-benefit-verification-rbac.test.d.ts.map +1 -0
  227. package/lib/esm/tests/api_tests/security/develop-health-benefit-verification-rbac.test.js +310 -0
  228. package/lib/esm/tests/api_tests/security/develop-health-benefit-verification-rbac.test.js.map +1 -0
  229. package/lib/esm/tests/api_tests/security/enduser-cross-create.test.d.ts +21 -0
  230. package/lib/esm/tests/api_tests/security/enduser-cross-create.test.d.ts.map +1 -0
  231. package/lib/esm/tests/api_tests/security/enduser-cross-create.test.js +358 -0
  232. package/lib/esm/tests/api_tests/security/enduser-cross-create.test.js.map +1 -0
  233. package/lib/esm/tests/api_tests/security/enduser-write-restrictions.test.d.ts +21 -0
  234. package/lib/esm/tests/api_tests/security/enduser-write-restrictions.test.d.ts.map +1 -0
  235. package/lib/esm/tests/api_tests/security/enduser-write-restrictions.test.js +362 -0
  236. package/lib/esm/tests/api_tests/security/enduser-write-restrictions.test.js.map +1 -0
  237. package/lib/esm/tests/api_tests/security/form-logic-js-execution.test.d.ts +32 -0
  238. package/lib/esm/tests/api_tests/security/form-logic-js-execution.test.d.ts.map +1 -0
  239. package/lib/esm/tests/api_tests/security/form-logic-js-execution.test.js +243 -0
  240. package/lib/esm/tests/api_tests/security/form-logic-js-execution.test.js.map +1 -0
  241. package/lib/esm/tests/api_tests/security/globalunique-conflict-redaction.test.d.ts +19 -0
  242. package/lib/esm/tests/api_tests/security/globalunique-conflict-redaction.test.d.ts.map +1 -0
  243. package/lib/esm/tests/api_tests/security/globalunique-conflict-redaction.test.js +134 -0
  244. package/lib/esm/tests/api_tests/security/globalunique-conflict-redaction.test.js.map +1 -0
  245. package/lib/esm/tests/api_tests/security/handle-incoming-communication-cross-tenant.test.d.ts +24 -0
  246. package/lib/esm/tests/api_tests/security/handle-incoming-communication-cross-tenant.test.d.ts.map +1 -0
  247. package/lib/esm/tests/api_tests/security/handle-incoming-communication-cross-tenant.test.js +194 -0
  248. package/lib/esm/tests/api_tests/security/handle-incoming-communication-cross-tenant.test.js.map +1 -0
  249. package/lib/esm/tests/api_tests/security/invite-user-enumeration.test.d.ts +29 -0
  250. package/lib/esm/tests/api_tests/security/invite-user-enumeration.test.d.ts.map +1 -0
  251. package/lib/esm/tests/api_tests/security/invite-user-enumeration.test.js +271 -0
  252. package/lib/esm/tests/api_tests/security/invite-user-enumeration.test.js.map +1 -0
  253. package/lib/esm/tests/api_tests/security/load-inbox-redaction.test.d.ts +17 -0
  254. package/lib/esm/tests/api_tests/security/load-inbox-redaction.test.d.ts.map +1 -0
  255. package/lib/esm/tests/api_tests/security/load-inbox-redaction.test.js +151 -0
  256. package/lib/esm/tests/api_tests/security/load-inbox-redaction.test.js.map +1 -0
  257. package/lib/esm/tests/api_tests/security/prototype-pollution.test.d.ts +2 -0
  258. package/lib/esm/tests/api_tests/security/prototype-pollution.test.d.ts.map +1 -0
  259. package/lib/esm/tests/api_tests/security/prototype-pollution.test.js +84 -0
  260. package/lib/esm/tests/api_tests/security/prototype-pollution.test.js.map +1 -0
  261. package/lib/esm/tests/api_tests/security/proxy-image-unauth-ssrf.test.d.ts +34 -0
  262. package/lib/esm/tests/api_tests/security/proxy-image-unauth-ssrf.test.d.ts.map +1 -0
  263. package/lib/esm/tests/api_tests/security/proxy-image-unauth-ssrf.test.js +223 -0
  264. package/lib/esm/tests/api_tests/security/proxy-image-unauth-ssrf.test.js.map +1 -0
  265. package/lib/esm/tests/api_tests/security/sanitize-user-html-with-iframes.test.d.ts +2 -0
  266. package/lib/esm/tests/api_tests/security/sanitize-user-html-with-iframes.test.d.ts.map +1 -0
  267. package/lib/esm/tests/api_tests/security/sanitize-user-html-with-iframes.test.js +238 -0
  268. package/lib/esm/tests/api_tests/security/sanitize-user-html-with-iframes.test.js.map +1 -0
  269. package/lib/esm/tests/api_tests/security/sanitize-user-html.test.d.ts +2 -0
  270. package/lib/esm/tests/api_tests/security/sanitize-user-html.test.d.ts.map +1 -0
  271. package/lib/esm/tests/api_tests/security/sanitize-user-html.test.js +144 -0
  272. package/lib/esm/tests/api_tests/security/sanitize-user-html.test.js.map +1 -0
  273. package/lib/esm/tests/api_tests/security/schema-adminonly-enforcement.test.d.ts +45 -0
  274. package/lib/esm/tests/api_tests/security/schema-adminonly-enforcement.test.d.ts.map +1 -0
  275. package/lib/esm/tests/api_tests/security/schema-adminonly-enforcement.test.js +381 -0
  276. package/lib/esm/tests/api_tests/security/schema-adminonly-enforcement.test.js.map +1 -0
  277. package/lib/esm/tests/api_tests/security/self-admin-role-assignment.test.d.ts +38 -0
  278. package/lib/esm/tests/api_tests/security/self-admin-role-assignment.test.d.ts.map +1 -0
  279. package/lib/esm/tests/api_tests/security/self-admin-role-assignment.test.js +218 -0
  280. package/lib/esm/tests/api_tests/security/self-admin-role-assignment.test.js.map +1 -0
  281. package/lib/esm/tests/api_tests/security/startlinktoken-enduser-staff-escalation.test.d.ts +6 -0
  282. package/lib/esm/tests/api_tests/security/startlinktoken-enduser-staff-escalation.test.d.ts.map +1 -0
  283. package/lib/esm/tests/api_tests/security/startlinktoken-enduser-staff-escalation.test.js +350 -0
  284. package/lib/esm/tests/api_tests/security/startlinktoken-enduser-staff-escalation.test.js.map +1 -0
  285. package/lib/esm/tests/api_tests/security/webhook-outbound-ssrf.test.d.ts +28 -0
  286. package/lib/esm/tests/api_tests/security/webhook-outbound-ssrf.test.d.ts.map +1 -0
  287. package/lib/esm/tests/api_tests/security/webhook-outbound-ssrf.test.js +435 -0
  288. package/lib/esm/tests/api_tests/security/webhook-outbound-ssrf.test.js.map +1 -0
  289. package/lib/esm/tests/api_tests/security/webhook-timeout.test.d.ts +19 -0
  290. package/lib/esm/tests/api_tests/security/webhook-timeout.test.d.ts.map +1 -0
  291. package/lib/esm/tests/api_tests/security/webhook-timeout.test.js +149 -0
  292. package/lib/esm/tests/api_tests/security/webhook-timeout.test.js.map +1 -0
  293. package/lib/esm/tests/api_tests/tickets_bulk_assign_from_queue.test.d.ts +5 -0
  294. package/lib/esm/tests/api_tests/tickets_bulk_assign_from_queue.test.d.ts.map +1 -0
  295. package/lib/esm/tests/api_tests/tickets_bulk_assign_from_queue.test.js +324 -0
  296. package/lib/esm/tests/api_tests/tickets_bulk_assign_from_queue.test.js.map +1 -0
  297. package/lib/esm/tests/api_tests/webhook_error_handling.test.js +2 -2
  298. package/lib/esm/tests/api_tests/webhook_error_handling.test.js.map +1 -1
  299. package/lib/esm/tests/setup_isolated.d.ts +68 -0
  300. package/lib/esm/tests/setup_isolated.d.ts.map +1 -0
  301. package/lib/esm/tests/setup_isolated.js +221 -0
  302. package/lib/esm/tests/setup_isolated.js.map +1 -0
  303. package/lib/esm/tests/tests.d.ts.map +1 -1
  304. package/lib/esm/tests/tests.js +287 -227
  305. package/lib/esm/tests/tests.js.map +1 -1
  306. package/lib/esm/tests/unit_tests/do_not_send_address.test.d.ts +2 -0
  307. package/lib/esm/tests/unit_tests/do_not_send_address.test.d.ts.map +1 -0
  308. package/lib/esm/tests/unit_tests/do_not_send_address.test.js +85 -0
  309. package/lib/esm/tests/unit_tests/do_not_send_address.test.js.map +1 -0
  310. package/lib/esm/tests/unit_tests/openapi_spec_freshness.test.d.ts +17 -0
  311. package/lib/esm/tests/unit_tests/openapi_spec_freshness.test.d.ts.map +1 -0
  312. package/lib/esm/tests/unit_tests/openapi_spec_freshness.test.js +113 -0
  313. package/lib/esm/tests/unit_tests/openapi_spec_freshness.test.js.map +1 -0
  314. package/lib/tsconfig.tsbuildinfo +1 -1
  315. package/package.json +10 -10
  316. package/src/tests/api_tests/auto_merge_form_submission.test.ts +1 -1
  317. package/src/tests/api_tests/enduser_observations_auto_review.test.ts +358 -0
  318. package/src/tests/api_tests/integrations_redacted.test.ts +1 -1
  319. package/src/tests/api_tests/organization_signup.test.ts +240 -0
  320. package/src/tests/api_tests/purchase_made_trigger.test.ts +29 -41
  321. package/src/tests/api_tests/security/add-to-journey-foreign-enduserid.test.ts +207 -0
  322. package/src/tests/api_tests/security/{F-0005-ai-conversations-rbac.test.ts → ai-conversations-rbac.test.ts} +14 -14
  323. package/src/tests/api_tests/security/{F-0166-allowed-paths-wildcard-bypass.test.ts → allowed-paths-confinement.test.ts} +11 -11
  324. package/src/tests/api_tests/security/automated-actions-process-gate.test.ts +237 -0
  325. package/src/tests/api_tests/security/booking-info-idor-token-mint.test.ts +224 -0
  326. package/src/tests/api_tests/security/{F-0053-cascade-role-rename-cross-tenant.test.ts → cascade-role-rename-cross-tenant.test.ts} +10 -10
  327. package/src/tests/api_tests/security/{F-0001-data-sync-redaction-bypass.test.ts → data-sync-redaction-bypass.test.ts} +9 -9
  328. package/src/tests/api_tests/security/{F-0006-develop-health-benefit-verification-rbac.test.ts → develop-health-benefit-verification-rbac.test.ts} +7 -8
  329. package/src/tests/api_tests/security/{F-0116-F-0119-enduser-cross-create.test.ts → enduser-cross-create.test.ts} +25 -25
  330. package/src/tests/api_tests/security/{F-0106-F-0110-enduser-write-restrictions.test.ts → enduser-write-restrictions.test.ts} +12 -14
  331. package/src/tests/api_tests/security/form-logic-js-execution.test.ts +183 -0
  332. package/src/tests/api_tests/security/{F-0145-globalunique-leak.test.ts → globalunique-conflict-redaction.test.ts} +5 -6
  333. package/src/tests/api_tests/security/{F-0008-handle-incoming-communication-cross-tenant.test.ts → handle-incoming-communication-cross-tenant.test.ts} +8 -8
  334. package/src/tests/api_tests/security/{F-0007-invite-user-enumeration.test.ts → invite-user-enumeration.test.ts} +8 -8
  335. package/src/tests/api_tests/security/{F-0151-load-inbox-redaction.test.ts → load-inbox-redaction.test.ts} +5 -6
  336. package/src/tests/api_tests/security/{F-0016-prototype-pollution.test.ts → prototype-pollution.test.ts} +4 -4
  337. package/src/tests/api_tests/security/{F-0025-proxy-image-unauth-ssrf.test.ts → proxy-image-unauth-ssrf.test.ts} +11 -12
  338. package/src/tests/api_tests/security/{F-0013-sanitize-user-html-with-iframes.test.ts → sanitize-user-html-with-iframes.test.ts} +5 -5
  339. package/src/tests/api_tests/security/{F-0013-sanitize-user-html.test.ts → sanitize-user-html.test.ts} +4 -4
  340. package/src/tests/api_tests/security/schema-adminonly-enforcement.test.ts +287 -0
  341. package/src/tests/api_tests/security/{F-0076-self-admin-role-assignment.test.ts → self-admin-role-assignment.test.ts} +13 -13
  342. package/src/tests/api_tests/security/startlinktoken-enduser-staff-escalation.test.ts +162 -0
  343. package/src/tests/api_tests/security/{F-0015-webhook-outbound-ssrf.test.ts → webhook-outbound-ssrf.test.ts} +13 -14
  344. package/src/tests/api_tests/security/{F-0155-webhook-timeout.test.ts → webhook-timeout.test.ts} +6 -7
  345. package/src/tests/api_tests/tickets_bulk_assign_from_queue.test.ts +279 -0
  346. package/src/tests/api_tests/webhook_error_handling.test.ts +1 -1
  347. package/src/tests/setup_isolated.ts +170 -0
  348. package/src/tests/tests.ts +60 -18
  349. package/src/tests/unit_tests/do_not_send_address.test.ts +60 -0
  350. package/src/tests/unit_tests/openapi_spec_freshness.test.ts +88 -0
  351. package/test_generated.pdf +0 -0
  352. package/src/tests/api_tests/security/readonly-enduser-preview.test.ts +0 -301
@@ -0,0 +1,238 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import { DEFAULT_IFRAME_SANDBOX, replace_form_field_template_values, sanitize_user_html, sanitize_user_html_with_iframes } from "@tellescope/utilities";
38
+ // Companion to sanitize-user-html.test.ts (pattern 06 — XSS via dangerouslySetInnerHTML).
39
+ //
40
+ // sanitize_user_html_with_iframes is the variant used by the live form's field description, so
41
+ // admins can embed video / scheduling widgets. It permits <iframe> and NOTHING else beyond what
42
+ // sanitize_user_html allows. This asserts:
43
+ // 1. permitting iframe did not reopen any of the base vectors (the full payload list is re-run)
44
+ // 2. only absolute https iframes survive — relative, protocol-relative, http, javascript:, data:
45
+ // and srcdoc frames are dropped, along with their fallback content
46
+ // 3. the restrictive sandbox is forced, but an author-supplied sandbox is honored
47
+ // 4. sanitize_user_html itself still strips iframes (the boundary between the two functions)
48
+ //
49
+ // Pure-function test — no Session needed. Runs as part of the main suite and standalone:
50
+ // ./build_cjs.sh && cd packages/public/sdk && node -r dotenv/config lib/cjs/tests/api_tests/security/sanitize-user-html-with-iframes.test.js
51
+ var fail = function (msg) { throw new Error(msg); };
52
+ // Same as has_no_executable_vector in the base sanitizer test, minus the '<iframe' clause (iframes are
53
+ // expected in this function's output). Everything else must still be neutralized.
54
+ var has_no_executable_vector_allowing_iframe = function (out) {
55
+ var o = out.toLowerCase();
56
+ var withoutValues = o.replace(/"[^"]*"/g, '""').replace(/'[^']*'/g, "''");
57
+ return !/\son[a-z]+\s*=/.test(withoutValues) // no live on*= event-handler attribute
58
+ && !o.includes('javascript:')
59
+ && !o.includes('vbscript:')
60
+ && !o.includes('<script')
61
+ && !o.includes('<svg')
62
+ && !o.includes('<math')
63
+ && !o.includes('<object')
64
+ && !o.includes('<embed')
65
+ && !o.includes('<form')
66
+ && !o.includes('<noscript')
67
+ && !o.includes('<template')
68
+ && !o.includes('srcdoc'); // an inline document is arbitrary markup
69
+ };
70
+ // Tokens that must NEVER appear in the forced default. allow-top-navigation is the important one:
71
+ // it is what stops a hostile embed from redirecting the patient's form page to a phishing site.
72
+ var FORBIDDEN_SANDBOX_TOKENS = [
73
+ 'allow-top-navigation',
74
+ 'allow-downloads',
75
+ 'allow-modals',
76
+ 'allow-pointer-lock',
77
+ 'allow-orientation-lock',
78
+ ];
79
+ export var sanitize_user_html_with_iframes_tests = function () { return __awaiter(void 0, void 0, void 0, function () {
80
+ var xssPayloads, _i, xssPayloads_1, _a, name_1, payload, out, badSrcs, _b, badSrcs_1, _c, name_2, src, out, fallback, srcdoc, handlers, yt, _d, FORBIDDEN_SANDBOX_TOKENS_1, token, authorSandbox, emptySandbox, noref, allowAttr, heading, table, list, link, img, dataimg, fmt, shared, adminTemplate, templated, endToEnd;
81
+ return __generator(this, function (_e) {
82
+ console.log("Running sanitize_user_html_with_iframes XSS regression tests");
83
+ xssPayloads = [
84
+ ['img onerror', "<img src=x onerror=\"alert(document.domain)\">"],
85
+ ['svg onload', "<svg onload=\"alert(1)\"></svg>"],
86
+ ['svg animate onbegin', "<svg><animate onbegin=\"alert(1)\" attributeName=\"x\" dur=\"1s\"></svg>"],
87
+ ['details ontoggle', "<details open ontoggle=\"alert(1)\"></details>"],
88
+ ['input onfocus autofocus', "<input autofocus onfocus=\"alert(1)\">"],
89
+ ['body onpageshow', "<body onpageshow=\"alert(1)\">"],
90
+ ['a javascript scheme', "<a href=\"javascript:alert(1)\">x</a>"],
91
+ ['a javascript entity-encoded', "<a href=\"jav&#x09;ascript:alert(1)\">x</a>"],
92
+ ['script tag', "<script>alert(1)</script>"],
93
+ ['onerror newline before =', "<img src=x onerror\n=\"alert(1)\">"],
94
+ ['onerror mixed case', "<IMG SRC=x OnErRoR=\"alert(1)\">"],
95
+ ['marquee onstart', "<marquee onstart=\"alert(1)\">x</marquee>"],
96
+ ['mathml mglyph style mxss', "<math><mtext><table><mglyph><style><!--</style><img src=x onerror=alert(1)>"],
97
+ ['svg foreignObject', "<svg><foreignObject><img src=x onerror=alert(1)></foreignObject></svg>"],
98
+ ['noscript context confusion', "<noscript><p title=\"</noscript><img src=x onerror=alert(1)>\">"],
99
+ ['template content', "<template><img src=x onerror=alert(1)></template>"],
100
+ ['comment confusion', "<!--><img src=x onerror=alert(1)>-->"],
101
+ ['cdata confusion', "<![CDATA[<img src=x onerror=alert(1)>]]>"],
102
+ ['markup inside attr value', "<img src=\"x\" alt=\"<script>alert(1)</script>\">"],
103
+ ['vbscript scheme', "<a href=\"vbscript:msgbox(1)\">x</a>"],
104
+ ['data text/html href', "<a href=\"data:text/html,<script>alert(1)</script>\">x</a>"],
105
+ ['javascript decimal entity', "<a href=\"&#74;avascript:alert(1)\">x</a>"],
106
+ ['javascript newline entity', "<a href=\"jav&#x0A;ascript:alert(1)\">x</a>"],
107
+ ];
108
+ for (_i = 0, xssPayloads_1 = xssPayloads; _i < xssPayloads_1.length; _i++) {
109
+ _a = xssPayloads_1[_i], name_1 = _a[0], payload = _a[1];
110
+ out = sanitize_user_html_with_iframes(payload);
111
+ if (!has_no_executable_vector_allowing_iframe(out))
112
+ fail("XSS not neutralized [".concat(name_1, "] -> ").concat(out));
113
+ }
114
+ badSrcs = [
115
+ ['javascript scheme', "javascript:alert(1)"],
116
+ ['data text/html', "data:text/html,<script>alert(1)</script>"],
117
+ ['http (not https)', "http://evil.example"],
118
+ // sanitize-html does NOT reject protocol-relative iframe srcs on its own when
119
+ // allowProtocolRelative is set — this is the self-origin framing vector and the reason the
120
+ // sanitizer does its own absolute-https check.
121
+ ['protocol-relative', "//app.tellescope.com/"],
122
+ ['root-relative', "/portal/settings"],
123
+ ['bare relative', "settings"],
124
+ ['whitespace-obfuscated', " https:/\\/\\evil"],
125
+ ['tab-entity javascript', "jav&#x09;ascript:alert(1)"],
126
+ ['scheme-only', "https://"],
127
+ ['empty', ""],
128
+ ];
129
+ for (_b = 0, badSrcs_1 = badSrcs; _b < badSrcs_1.length; _b++) {
130
+ _c = badSrcs_1[_b], name_2 = _c[0], src = _c[1];
131
+ out = sanitize_user_html_with_iframes("<iframe src=\"".concat(src, "\"></iframe>"));
132
+ if (out.toLowerCase().includes('<iframe'))
133
+ fail("bad iframe src survived [".concat(name_2, "] -> ").concat(out));
134
+ }
135
+ fallback = sanitize_user_html_with_iframes("<iframe src=\"/x\">FALLBACK-TEXT</iframe>");
136
+ if (fallback.includes('FALLBACK-TEXT'))
137
+ fail("dropped iframe leaked its fallback text: ".concat(fallback));
138
+ if (fallback.toLowerCase().includes('<iframe'))
139
+ fail("dropped iframe survived: ".concat(fallback));
140
+ srcdoc = sanitize_user_html_with_iframes("<iframe src=\"https://ok.example\" srcdoc=\"<img src=x onerror=alert(1)>\"></iframe>");
141
+ if (srcdoc.toLowerCase().includes('srcdoc'))
142
+ fail("srcdoc not stripped: ".concat(srcdoc));
143
+ if (!srcdoc.toLowerCase().includes('<iframe'))
144
+ fail("valid iframe dropped alongside srcdoc: ".concat(srcdoc));
145
+ handlers = sanitize_user_html_with_iframes("<iframe src=\"https://ok.example\" onload=\"alert(1)\" id=\"x\" name=\"getElementById\"></iframe>");
146
+ if (!handlers.toLowerCase().includes('<iframe'))
147
+ fail("valid iframe dropped: ".concat(handlers));
148
+ if (/\son[a-z]+\s*=/.test(handlers.toLowerCase()))
149
+ fail("iframe event handler survived: ".concat(handlers));
150
+ if (/\b(id|name)\s*=/.test(handlers))
151
+ fail("iframe id/name not stripped (DOM clobbering): ".concat(handlers));
152
+ yt = sanitize_user_html_with_iframes("<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/abc\" frameBorder=\"0\"></iframe>");
153
+ if (!yt.includes('src="https://www.youtube.com/embed/abc"'))
154
+ fail("youtube embed src stripped: ".concat(yt));
155
+ if (!(yt.includes('width="560"') && yt.includes('height="315"')))
156
+ fail("iframe dimensions stripped: ".concat(yt));
157
+ if (!yt.toLowerCase().includes('frameborder'))
158
+ fail("frameborder stripped: ".concat(yt));
159
+ // forced containment
160
+ if (!yt.includes("sandbox=\"".concat(DEFAULT_IFRAME_SANDBOX, "\"")))
161
+ fail("sandbox not forced: ".concat(yt));
162
+ if (!yt.toLowerCase().includes('referrerpolicy='))
163
+ fail("referrerpolicy not set: ".concat(yt));
164
+ for (_d = 0, FORBIDDEN_SANDBOX_TOKENS_1 = FORBIDDEN_SANDBOX_TOKENS; _d < FORBIDDEN_SANDBOX_TOKENS_1.length; _d++) {
165
+ token = FORBIDDEN_SANDBOX_TOKENS_1[_d];
166
+ if (DEFAULT_IFRAME_SANDBOX.includes(token))
167
+ fail("forced sandbox must not grant ".concat(token, ": ").concat(DEFAULT_IFRAME_SANDBOX));
168
+ }
169
+ // allow-same-origin IS granted — required for real embeds (a Loom embed renders blank without it)
170
+ // and harmless because the src is guaranteed cross-origin by the check asserted above.
171
+ if (!DEFAULT_IFRAME_SANDBOX.includes('allow-same-origin'))
172
+ fail("forced sandbox must grant allow-same-origin so real embeds render: ".concat(DEFAULT_IFRAME_SANDBOX));
173
+ authorSandbox = sanitize_user_html_with_iframes("<iframe src=\"https://ok.example\" sandbox=\"allow-scripts\"></iframe>");
174
+ if (!authorSandbox.includes('sandbox="allow-scripts"'))
175
+ fail("author sandbox not honored: ".concat(authorSandbox));
176
+ emptySandbox = sanitize_user_html_with_iframes("<iframe src=\"https://ok.example\" sandbox=\"\"></iframe>");
177
+ if (emptySandbox.includes('allow-'))
178
+ fail("empty sandbox was replaced with the permissive default: ".concat(emptySandbox));
179
+ if (!/\ssandbox(\s|>)/.test(emptySandbox))
180
+ fail("empty sandbox attribute lost entirely: ".concat(emptySandbox));
181
+ noref = sanitize_user_html_with_iframes("<iframe src=\"https://ok.example\" referrerpolicy=\"no-referrer\"></iframe>");
182
+ if (!noref.includes('referrerpolicy="no-referrer"'))
183
+ fail("author referrerpolicy not honored: ".concat(noref));
184
+ allowAttr = sanitize_user_html_with_iframes("<iframe src=\"https://ok.example\" allow=\"autoplay; encrypted-media\" allowfullscreen></iframe>");
185
+ if (!allowAttr.includes('allow="autoplay; encrypted-media"'))
186
+ fail("allow attribute stripped: ".concat(allowAttr));
187
+ heading = sanitize_user_html_with_iframes("<h1>Welcome</h1><h3 style=\"color:#333\">Sub</h3>");
188
+ if (!(heading.includes('<h1>') && heading.includes('<h3') && heading.toLowerCase().includes('color')))
189
+ fail("headings/style stripped: ".concat(heading));
190
+ table = sanitize_user_html_with_iframes("<table><thead><tr><th>H</th></tr></thead><tbody><tr><td style=\"padding:4px\" colspan=\"2\">cell</td></tr></tbody></table>");
191
+ if (!(table.includes('<table') && table.includes('<td') && table.includes('colspan')))
192
+ fail("table stripped: ".concat(table));
193
+ list = sanitize_user_html_with_iframes("<ul><li>a</li></ul><ol start=\"3\"><li>c</li></ol>");
194
+ if (!(list.includes('<ul') && list.includes('<li') && list.includes('<ol')))
195
+ fail("list stripped: ".concat(list));
196
+ link = sanitize_user_html_with_iframes("<a href=\"https://example.com\">link</a>");
197
+ if (!link.includes('href="https://example.com"'))
198
+ fail("safe link stripped: ".concat(link));
199
+ if (!link.toLowerCase().includes('noopener'))
200
+ fail("external link not hardened: ".concat(link));
201
+ img = sanitize_user_html_with_iframes("<img src=\"https://cdn.example.com/a.png\" alt=\"pic\" width=\"200\">");
202
+ if (!(img.includes('src="https://cdn.example.com/a.png"') && img.includes('alt="pic"')))
203
+ fail("image stripped: ".concat(img));
204
+ dataimg = sanitize_user_html_with_iframes("<img src=\"data:image/png;base64,iVBORw0KGgo=\">");
205
+ if (!dataimg.includes('data:image/png'))
206
+ fail("data: image stripped: ".concat(dataimg));
207
+ fmt = sanitize_user_html_with_iframes("<p><strong>b</strong> <em>i</em> <span style=\"font-size:14px\">s</span></p><blockquote>q</blockquote>");
208
+ if (!(fmt.includes('<strong>') && fmt.includes('<span') && fmt.toLowerCase().includes('font-size')))
209
+ fail("formatting stripped: ".concat(fmt));
210
+ shared = sanitize_user_html("<iframe src=\"https://www.youtube.com/embed/abc\"></iframe>");
211
+ if (shared.toLowerCase().includes('<iframe'))
212
+ fail("sanitize_user_html must still strip iframes: ".concat(shared));
213
+ adminTemplate = "<p>Hi {{enduser.fname}}, watch this:</p><iframe src=\"https://www.youtube.com/embed/abc\"></iframe>";
214
+ templated = replace_form_field_template_values(adminTemplate, {
215
+ enduser: { fname: "<iframe src=\"https://evil.example/phish\"></iframe>" },
216
+ responses: [],
217
+ escapeNewlinesAsHTMLBreaks: true,
218
+ escapeHTMLValues: true,
219
+ });
220
+ endToEnd = sanitize_user_html_with_iframes(templated);
221
+ if (!endToEnd.includes('src="https://www.youtube.com/embed/abc"'))
222
+ fail("admin's own iframe did not survive: ".concat(endToEnd));
223
+ // The patient's markup must survive only as inert escaped text — so 'evil.example' may still
224
+ // appear as visible characters, but there must be exactly one LIVE frame (the admin's).
225
+ if (!endToEnd.includes('&lt;iframe'))
226
+ fail("patient markup not escaped to inert text: ".concat(endToEnd));
227
+ if ((endToEnd.toLowerCase().match(/<iframe/g) || []).length !== 1)
228
+ fail("patient-injected iframe became a live frame: ".concat(endToEnd));
229
+ console.log("✅ sanitize_user_html_with_iframes XSS regression tests passed");
230
+ return [2 /*return*/];
231
+ });
232
+ }); };
233
+ if (require.main === module) {
234
+ sanitize_user_html_with_iframes_tests()
235
+ .then(function () { console.log("✅ suite completed"); process.exit(0); })
236
+ .catch(function (err) { console.error("❌ suite failed:", err); process.exit(1); });
237
+ }
238
+ //# sourceMappingURL=sanitize-user-html-with-iframes.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sanitize-user-html-with-iframes.test.js","sourceRoot":"","sources":["../../../../../src/tests/api_tests/security/sanitize-user-html-with-iframes.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,sBAAsB,EAAE,kCAAkC,EAAE,kBAAkB,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAA;AAEvJ,0FAA0F;AAC1F,EAAE;AACF,+FAA+F;AAC/F,gGAAgG;AAChG,2CAA2C;AAC3C,kGAAkG;AAClG,mGAAmG;AACnG,wEAAwE;AACxE,oFAAoF;AACpF,+FAA+F;AAC/F,EAAE;AACF,yFAAyF;AACzF,+IAA+I;AAE/I,IAAM,IAAI,GAAG,UAAC,GAAW,IAAO,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAA,CAAC,CAAC,CAAA;AAEtD,uGAAuG;AACvG,kFAAkF;AAClF,IAAM,wCAAwC,GAAG,UAAC,GAAW;IAC3D,IAAM,CAAC,GAAG,GAAG,CAAC,WAAW,EAAE,CAAA;IAC3B,IAAM,aAAa,GAAG,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,IAA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AC,UAAC,GAAG,IAAO,OAAO,CAAC,KAAK,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAA;CAC9E"}
@@ -0,0 +1,2 @@
1
+ export declare const sanitize_user_html_xss_tests: () => Promise<void>;
2
+ //# sourceMappingURL=sanitize-user-html.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sanitize-user-html.test.d.ts","sourceRoot":"","sources":["../../../../../src/tests/api_tests/security/sanitize-user-html.test.ts"],"names":[],"mappings":"AAgCA,eAAO,MAAM,4BAA4B,qBAsExC,CAAA"}
@@ -0,0 +1,144 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import { sanitize_user_html } from "@tellescope/utilities";
38
+ // Regression test: XSS via dangerouslySetInnerHTML.
39
+ // sanitize_user_html is the canonical render-time sanitizer that replaced remove_script_tags
40
+ // at every dangerouslySetInnerHTML sink. This asserts it neutralizes XSS vectors (incl. encoded /
41
+ // whitespace / mixed-case / iframe-srcdoc bypass variants) while preserving legitimate
42
+ // customization HTML (tables, headings, lists, links, images, inline styles).
43
+ //
44
+ // Pure-function test — no Session needed. Runs as part of the main suite and standalone:
45
+ // ./build_cjs.sh && cd packages/public/sdk && node -r dotenv/config lib/cjs/tests/api_tests/security/sanitize-user-html.test.js
46
+ var fail = function (msg) { throw new Error(msg); };
47
+ var has_no_executable_vector = function (out) {
48
+ var o = out.toLowerCase();
49
+ // A handler smuggled into an attribute VALUE (e.g. title="&lt;img onerror=...&gt;") is inert
50
+ // text — strip quoted values before checking for *live* on*= attributes to avoid false positives.
51
+ var withoutValues = o.replace(/"[^"]*"/g, '""').replace(/'[^']*'/g, "''");
52
+ return !/\son[a-z]+\s*=/.test(withoutValues) // no live on*= event-handler attribute
53
+ && !o.includes('javascript:') // dropped schemes never appear in safe output
54
+ && !o.includes('vbscript:')
55
+ && !o.includes('<script') // literal dangerous tags (encoded &lt;script is fine)
56
+ && !o.includes('<iframe')
57
+ && !o.includes('<svg')
58
+ && !o.includes('<math')
59
+ && !o.includes('<object')
60
+ && !o.includes('<embed')
61
+ && !o.includes('<form')
62
+ && !o.includes('<noscript')
63
+ && !o.includes('<template');
64
+ };
65
+ export var sanitize_user_html_xss_tests = function () { return __awaiter(void 0, void 0, void 0, function () {
66
+ var xssPayloads, _i, xssPayloads_1, _a, name_1, payload, out, clobber, heading, table, list, link, img, dataimg, fmt, mixed;
67
+ return __generator(this, function (_b) {
68
+ console.log("Running sanitize_user_html XSS regression tests");
69
+ xssPayloads = [
70
+ ['img onerror', "<img src=x onerror=\"alert(document.domain)\">"],
71
+ ['svg onload', "<svg onload=\"alert(1)\"></svg>"],
72
+ ['svg animate onbegin', "<svg><animate onbegin=\"alert(1)\" attributeName=\"x\" dur=\"1s\"></svg>"],
73
+ ['details ontoggle', "<details open ontoggle=\"alert(1)\"></details>"],
74
+ ['input onfocus autofocus', "<input autofocus onfocus=\"alert(1)\">"],
75
+ ['body onpageshow', "<body onpageshow=\"alert(1)\">"],
76
+ ['a javascript scheme', "<a href=\"javascript:alert(1)\">x</a>"],
77
+ ['a javascript entity-encoded', "<a href=\"jav&#x09;ascript:alert(1)\">x</a>"],
78
+ ['iframe javascript src', "<iframe src=\"javascript:alert(1)\"></iframe>"],
79
+ ['iframe srcdoc nested', "<iframe srcdoc=\"<img src=x onerror=alert(1)>\"></iframe>"],
80
+ ['script tag', "<script>alert(1)</script>"],
81
+ ['onerror newline before =', "<img src=x onerror\n=\"alert(1)\">"],
82
+ ['onerror mixed case', "<IMG SRC=x OnErRoR=\"alert(1)\">"],
83
+ ['marquee onstart', "<marquee onstart=\"alert(1)\">x</marquee>"],
84
+ // mutation / namespace confusion — svg/math/noscript/template must be stripped
85
+ ['mathml mglyph style mxss', "<math><mtext><table><mglyph><style><!--</style><img src=x onerror=alert(1)>"],
86
+ ['svg foreignObject', "<svg><foreignObject><img src=x onerror=alert(1)></foreignObject></svg>"],
87
+ ['noscript context confusion', "<noscript><p title=\"</noscript><img src=x onerror=alert(1)>\">"],
88
+ ['template content', "<template><img src=x onerror=alert(1)></template>"],
89
+ // comment / CDATA confusion
90
+ ['comment confusion', "<!--><img src=x onerror=alert(1)>-->"],
91
+ ['cdata confusion', "<![CDATA[<img src=x onerror=alert(1)>]]>"],
92
+ // markup smuggled inside an attribute value must stay inert
93
+ ['markup inside attr value', "<img src=\"x\" alt=\"<script>alert(1)</script>\">"],
94
+ // protocol obfuscation
95
+ ['vbscript scheme', "<a href=\"vbscript:msgbox(1)\">x</a>"],
96
+ ['data text/html href', "<a href=\"data:text/html,<script>alert(1)</script>\">x</a>"],
97
+ ['javascript decimal entity', "<a href=\"&#74;avascript:alert(1)\">x</a>"],
98
+ ['javascript newline entity', "<a href=\"jav&#x0A;ascript:alert(1)\">x</a>"],
99
+ ];
100
+ for (_i = 0, xssPayloads_1 = xssPayloads; _i < xssPayloads_1.length; _i++) {
101
+ _a = xssPayloads_1[_i], name_1 = _a[0], payload = _a[1];
102
+ out = sanitize_user_html(payload);
103
+ if (!has_no_executable_vector(out))
104
+ fail("XSS not neutralized [".concat(name_1, "] -> ").concat(out));
105
+ }
106
+ clobber = sanitize_user_html("<a id=\"x\" name=\"getElementById\">link</a><img name=\"y\">");
107
+ if (/\b(id|name)\s*=/.test(clobber))
108
+ fail("id/name not stripped (DOM clobbering): ".concat(clobber));
109
+ heading = sanitize_user_html("<h1>Welcome</h1><h3 style=\"color:#333\">Sub</h3>");
110
+ if (!(heading.includes('<h1>') && heading.includes('<h3') && heading.toLowerCase().includes('color')))
111
+ fail("headings/style stripped: ".concat(heading));
112
+ table = sanitize_user_html("<table><thead><tr><th>H</th></tr></thead><tbody><tr><td style=\"padding:4px\" colspan=\"2\">cell</td></tr></tbody></table>");
113
+ if (!(table.includes('<table') && table.includes('<td') && table.includes('colspan')))
114
+ fail("table stripped: ".concat(table));
115
+ list = sanitize_user_html("<ul><li>a</li></ul><ol start=\"3\"><li>c</li></ol>");
116
+ if (!(list.includes('<ul') && list.includes('<li') && list.includes('<ol')))
117
+ fail("list stripped: ".concat(list));
118
+ link = sanitize_user_html("<a href=\"https://example.com\">link</a>");
119
+ if (!link.includes('href="https://example.com"'))
120
+ fail("safe link stripped: ".concat(link));
121
+ if (!link.toLowerCase().includes('noopener'))
122
+ fail("external link not hardened: ".concat(link));
123
+ img = sanitize_user_html("<img src=\"https://cdn.example.com/a.png\" alt=\"pic\" width=\"200\">");
124
+ if (!(img.includes('src="https://cdn.example.com/a.png"') && img.includes('alt="pic"')))
125
+ fail("http image stripped: ".concat(img));
126
+ dataimg = sanitize_user_html("<img src=\"data:image/png;base64,iVBORw0KGgo=\">");
127
+ if (!dataimg.includes('data:image/png'))
128
+ fail("data: image stripped: ".concat(dataimg));
129
+ fmt = sanitize_user_html("<p><strong>b</strong> <em>i</em> <span style=\"font-size:14px\">s</span></p><blockquote>q</blockquote>");
130
+ if (!(fmt.includes('<strong>') && fmt.includes('<span') && fmt.toLowerCase().includes('font-size')))
131
+ fail("formatting stripped: ".concat(fmt));
132
+ mixed = sanitize_user_html("<p>Hello <b>name</b></p><img src=x onerror=\"steal()\">");
133
+ if (!(mixed.includes('<b>name</b>') && !/\son[a-z]+\s*=/.test(mixed.toLowerCase())))
134
+ fail("mixed content not handled: ".concat(mixed));
135
+ console.log("✅ sanitize_user_html XSS regression tests passed");
136
+ return [2 /*return*/];
137
+ });
138
+ }); };
139
+ if (require.main === module) {
140
+ sanitize_user_html_xss_tests()
141
+ .then(function () { console.log("✅ suite completed"); process.exit(0); })
142
+ .catch(function (err) { console.error("❌ suite failed:", err); process.exit(1); });
143
+ }
144
+ //# sourceMappingURL=sanitize-user-html.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sanitize-user-html.test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OAAO,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAA;;;KAChE,CAAA;AAED,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE;IAC3B,4BAA4B,EAAE;SAC3B,IAAI,CAAC,cAAQ,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC;SACjE,KAAK,CAAC,UAAC,GAAG,IAAO,OAAO,CAAC,KAAK,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAA;CAC9E"}
@@ -0,0 +1,45 @@
1
+ import { Session } from "../../../sdk";
2
+ /**
3
+ * Regression test: `adminOnly` custom actions must be enforced at runtime, not merely declared.
4
+ *
5
+ * `adminOnly: true` on a CUSTOM action in schema.ts was documentation-only. The runtime gate
6
+ * (routing.ts:944) reads the flag off the options object built by getCustomEndpointFields, and
7
+ * api.ts:609 set `adminOnly: o.adminOnly` without ever consulting `action.adminOnly`. So every
8
+ * admin-only custom action had to declare the flag twice, and the copies desynced: 11 of 20
9
+ * declared custom actions were unenforced at runtime while both public doc artifacts
10
+ * (openapi.json and the unauthenticated GET /documentation feed, which read the SCHEMA flag)
11
+ * advertised "**Admin only.**".
12
+ *
13
+ * DEFAULT CRUD actions never had this bug — routing.ts:2434 etc. read
14
+ * model.defaultActions.<op>.adminOnly straight off the schema. The fix
15
+ * (`adminOnly: o.adminOnly ?? action.adminOnly`) makes custom actions behave the same way.
16
+ *
17
+ * Five of the 11 were de-flagged in the schema instead, because the flag itself was wrong and
18
+ * enforcing it would revert a deliberate decision: users.invite_user carries an explicit
19
+ * "no longer admin only, but controlled by users.create" and send_invitation_to_existing is its
20
+ * sibling; organizations.create_and_join is the self-service signup path and would 401 every new
21
+ * org (a fresh user has no roles — the handler is what grants Admin); sync_note_to_canvas is
22
+ * designed around `access: 'read'` for non-admin callers; background_errors.mark_read substitutes
23
+ * its own RBAC check that intentionally admits non-admins holding the verb.
24
+ *
25
+ * SAFETY: every probe fails EARLY inside its handler — after the adminOnly gate but before any
26
+ * vendor call. Pre-fix these requests really do reach the handler, and these handlers talk to
27
+ * Twilio, Athena and Canvas:
28
+ * - trigger_events : no `action` key + an absent triggerId => the loop `continue`s (inert)
29
+ * - athena-subscription: frequency 1 trips the `frequency < 5` guard on the handler's first line
30
+ * - sync-athena : 404s on the missing Athena integration (skipped if one exists)
31
+ * - link-twilio : takes NO parameters and can CREATE A REAL TWILIO SUBACCOUNT, so it is
32
+ * probed only when the org already has a twilioSID (handler short-circuits)
33
+ * - twilio-embed : no phoneNumberSid => 404 no-config or 400, both before any Twilio call
34
+ * - handle-autoreply : absent enduserId => `if (!enduser) return` (communications.ts:42)
35
+ * Input validation runs BEFORE the adminOnly gate (routing.ts:921 orders access, then validate),
36
+ * so every probe body must be schema-VALID or the test would prove nothing.
37
+ *
38
+ * RED (pre-fix): the six group-B rows fail — each reaches its handler and returns a non-401.
39
+ * GREEN (post-fix): all six return 401 "Admin access only"; the group-A controls are unchanged.
40
+ */
41
+ export declare const schema_adminonly_enforcement_tests: ({ sdk }: {
42
+ sdk: Session;
43
+ sdkNonAdmin: Session;
44
+ }) => Promise<void>;
45
+ //# sourceMappingURL=schema-adminonly-enforcement.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-adminonly-enforcement.test.d.ts","sourceRoot":"","sources":["../../../../../src/tests/api_tests/security/schema-adminonly-enforcement.test.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAqBtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,kCAAkC;SAA2B,OAAO;iBAAe,OAAO;mBAwMtG,CAAA"}