@tellescope/sdk 1.255.18 → 1.256.0
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.
- package/lib/cjs/sdk.d.ts +7 -2
- package/lib/cjs/sdk.d.ts.map +1 -1
- package/lib/cjs/sdk.js +1 -0
- package/lib/cjs/sdk.js.map +1 -1
- package/lib/cjs/tests/api_tests/auto_merge_form_submission.test.d.ts.map +1 -1
- package/lib/cjs/tests/api_tests/auto_merge_form_submission.test.js +18 -8
- package/lib/cjs/tests/api_tests/auto_merge_form_submission.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/custom_dashboards.test.d.ts.map +1 -1
- package/lib/cjs/tests/api_tests/custom_dashboards.test.js +99 -8
- package/lib/cjs/tests/api_tests/custom_dashboards.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/default_summary_journey.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/default_summary_journey.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/file_download_unicode_names.test.d.ts +6 -0
- package/lib/cjs/tests/api_tests/file_download_unicode_names.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/file_download_unicode_names.test.js +278 -0
- package/lib/cjs/tests/api_tests/file_download_unicode_names.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/healthie_multi_integration.test.d.ts.map +1 -1
- package/lib/cjs/tests/api_tests/healthie_multi_integration.test.js +203 -72
- package/lib/cjs/tests/api_tests/healthie_multi_integration.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/openloop_webhooks.test.d.ts.map +1 -1
- package/lib/cjs/tests/api_tests/openloop_webhooks.test.js +212 -33
- package/lib/cjs/tests/api_tests/openloop_webhooks.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/phone_calls_cold_transfer.test.d.ts.map +1 -1
- package/lib/cjs/tests/api_tests/phone_calls_cold_transfer.test.js +85 -9
- package/lib/cjs/tests/api_tests/phone_calls_cold_transfer.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/phone_calls_conference_hold.test.d.ts +6 -0
- package/lib/cjs/tests/api_tests/phone_calls_conference_hold.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/phone_calls_conference_hold.test.js +102 -0
- package/lib/cjs/tests/api_tests/phone_calls_conference_hold.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/scoped_api_keys.test.d.ts.map +1 -1
- package/lib/cjs/tests/api_tests/scoped_api_keys.test.js +84 -81
- package/lib/cjs/tests/api_tests/scoped_api_keys.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/security/F-0013-sanitize-user-html-with-iframes.test.d.ts +2 -0
- package/lib/cjs/tests/api_tests/security/F-0013-sanitize-user-html-with-iframes.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/security/F-0013-sanitize-user-html-with-iframes.test.js +242 -0
- package/lib/cjs/tests/api_tests/security/F-0013-sanitize-user-html-with-iframes.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/security/F-0015-webhook-outbound-ssrf.test.d.ts +29 -0
- package/lib/cjs/tests/api_tests/security/F-0015-webhook-outbound-ssrf.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/security/F-0015-webhook-outbound-ssrf.test.js +443 -0
- package/lib/cjs/tests/api_tests/security/F-0015-webhook-outbound-ssrf.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/security/F-0025-proxy-image-unauth-ssrf.test.d.ts +35 -0
- package/lib/cjs/tests/api_tests/security/F-0025-proxy-image-unauth-ssrf.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/security/F-0025-proxy-image-unauth-ssrf.test.js +231 -0
- package/lib/cjs/tests/api_tests/security/F-0025-proxy-image-unauth-ssrf.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/security/F-0106-F-0110-enduser-write-restrictions.test.d.ts.map +1 -1
- package/lib/cjs/tests/api_tests/security/F-0106-F-0110-enduser-write-restrictions.test.js +121 -78
- package/lib/cjs/tests/api_tests/security/F-0106-F-0110-enduser-write-restrictions.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/security/F-0166-allowed-paths-wildcard-bypass.test.d.ts +6 -0
- package/lib/cjs/tests/api_tests/security/F-0166-allowed-paths-wildcard-bypass.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/security/F-0166-allowed-paths-wildcard-bypass.test.js +1003 -0
- package/lib/cjs/tests/api_tests/security/F-0166-allowed-paths-wildcard-bypass.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/security/enduser-ai-summary-trust-gate.test.d.ts +17 -0
- package/lib/cjs/tests/api_tests/security/enduser-ai-summary-trust-gate.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/security/enduser-ai-summary-trust-gate.test.js +215 -0
- package/lib/cjs/tests/api_tests/security/enduser-ai-summary-trust-gate.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/security/formsort_webhook_auth_field_lock.test.d.ts +6 -0
- package/lib/cjs/tests/api_tests/security/formsort_webhook_auth_field_lock.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/security/formsort_webhook_auth_field_lock.test.js +1200 -0
- package/lib/cjs/tests/api_tests/security/formsort_webhook_auth_field_lock.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/security/public_endpoint_auth_field_lock.test.d.ts +6 -0
- package/lib/cjs/tests/api_tests/security/public_endpoint_auth_field_lock.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/security/public_endpoint_auth_field_lock.test.js +2330 -0
- package/lib/cjs/tests/api_tests/security/public_endpoint_auth_field_lock.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/tickets_bulk_assign_care_team.test.d.ts +6 -0
- package/lib/cjs/tests/api_tests/tickets_bulk_assign_care_team.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/tickets_bulk_assign_care_team.test.js +204 -0
- package/lib/cjs/tests/api_tests/tickets_bulk_assign_care_team.test.js.map +1 -0
- package/lib/cjs/tests/tests.d.ts.map +1 -1
- package/lib/cjs/tests/tests.js +489 -255
- package/lib/cjs/tests/tests.js.map +1 -1
- package/lib/esm/enduser.d.ts +0 -1
- package/lib/esm/enduser.d.ts.map +1 -1
- package/lib/esm/sdk.d.ts +9 -5
- package/lib/esm/sdk.d.ts.map +1 -1
- package/lib/esm/sdk.js +1 -0
- package/lib/esm/sdk.js.map +1 -1
- package/lib/esm/session.d.ts +0 -1
- package/lib/esm/session.d.ts.map +1 -1
- package/lib/esm/tests/api_tests/auto_merge_form_submission.test.d.ts.map +1 -1
- package/lib/esm/tests/api_tests/auto_merge_form_submission.test.js +18 -8
- package/lib/esm/tests/api_tests/auto_merge_form_submission.test.js.map +1 -1
- package/lib/esm/tests/api_tests/custom_dashboards.test.d.ts.map +1 -1
- package/lib/esm/tests/api_tests/custom_dashboards.test.js +99 -8
- package/lib/esm/tests/api_tests/custom_dashboards.test.js.map +1 -1
- package/lib/esm/tests/api_tests/default_summary_journey.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/default_summary_journey.test.js.map +1 -0
- package/lib/esm/tests/api_tests/file_download_unicode_names.test.d.ts +6 -0
- package/lib/esm/tests/api_tests/file_download_unicode_names.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/file_download_unicode_names.test.js +248 -0
- package/lib/esm/tests/api_tests/file_download_unicode_names.test.js.map +1 -0
- package/lib/esm/tests/api_tests/healthie_multi_integration.test.d.ts.map +1 -1
- package/lib/esm/tests/api_tests/healthie_multi_integration.test.js +205 -74
- package/lib/esm/tests/api_tests/healthie_multi_integration.test.js.map +1 -1
- package/lib/esm/tests/api_tests/openloop_webhooks.test.d.ts.map +1 -1
- package/lib/esm/tests/api_tests/openloop_webhooks.test.js +213 -34
- package/lib/esm/tests/api_tests/openloop_webhooks.test.js.map +1 -1
- package/lib/esm/tests/api_tests/phone_calls_cold_transfer.test.d.ts.map +1 -1
- package/lib/esm/tests/api_tests/phone_calls_cold_transfer.test.js +85 -9
- package/lib/esm/tests/api_tests/phone_calls_cold_transfer.test.js.map +1 -1
- package/lib/esm/tests/api_tests/phone_calls_conference_hold.test.d.ts +6 -0
- package/lib/esm/tests/api_tests/phone_calls_conference_hold.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/phone_calls_conference_hold.test.js +98 -0
- package/lib/esm/tests/api_tests/phone_calls_conference_hold.test.js.map +1 -0
- package/lib/esm/tests/api_tests/scoped_api_keys.test.d.ts.map +1 -1
- package/lib/esm/tests/api_tests/scoped_api_keys.test.js +84 -81
- package/lib/esm/tests/api_tests/scoped_api_keys.test.js.map +1 -1
- package/lib/esm/tests/api_tests/security/F-0013-sanitize-user-html-with-iframes.test.d.ts +2 -0
- package/lib/esm/tests/api_tests/security/F-0013-sanitize-user-html-with-iframes.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/security/F-0013-sanitize-user-html-with-iframes.test.js +238 -0
- package/lib/esm/tests/api_tests/security/F-0013-sanitize-user-html-with-iframes.test.js.map +1 -0
- package/lib/esm/tests/api_tests/security/F-0015-webhook-outbound-ssrf.test.d.ts +29 -0
- package/lib/esm/tests/api_tests/security/F-0015-webhook-outbound-ssrf.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/security/F-0015-webhook-outbound-ssrf.test.js +436 -0
- package/lib/esm/tests/api_tests/security/F-0015-webhook-outbound-ssrf.test.js.map +1 -0
- package/lib/esm/tests/api_tests/security/F-0025-proxy-image-unauth-ssrf.test.d.ts +35 -0
- package/lib/esm/tests/api_tests/security/F-0025-proxy-image-unauth-ssrf.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/security/F-0025-proxy-image-unauth-ssrf.test.js +224 -0
- package/lib/esm/tests/api_tests/security/F-0025-proxy-image-unauth-ssrf.test.js.map +1 -0
- package/lib/esm/tests/api_tests/security/F-0106-F-0110-enduser-write-restrictions.test.d.ts.map +1 -1
- package/lib/esm/tests/api_tests/security/F-0106-F-0110-enduser-write-restrictions.test.js +121 -78
- package/lib/esm/tests/api_tests/security/F-0106-F-0110-enduser-write-restrictions.test.js.map +1 -1
- package/lib/esm/tests/api_tests/security/F-0166-allowed-paths-wildcard-bypass.test.d.ts +6 -0
- package/lib/esm/tests/api_tests/security/F-0166-allowed-paths-wildcard-bypass.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/security/F-0166-allowed-paths-wildcard-bypass.test.js +996 -0
- package/lib/esm/tests/api_tests/security/F-0166-allowed-paths-wildcard-bypass.test.js.map +1 -0
- package/lib/esm/tests/api_tests/security/enduser-ai-summary-trust-gate.test.d.ts +17 -0
- package/lib/esm/tests/api_tests/security/enduser-ai-summary-trust-gate.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/security/enduser-ai-summary-trust-gate.test.js +211 -0
- package/lib/esm/tests/api_tests/security/enduser-ai-summary-trust-gate.test.js.map +1 -0
- package/lib/esm/tests/api_tests/security/formsort_webhook_auth_field_lock.test.d.ts +6 -0
- package/lib/esm/tests/api_tests/security/formsort_webhook_auth_field_lock.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/security/formsort_webhook_auth_field_lock.test.js +1193 -0
- package/lib/esm/tests/api_tests/security/formsort_webhook_auth_field_lock.test.js.map +1 -0
- package/lib/esm/tests/api_tests/security/public_endpoint_auth_field_lock.test.d.ts +6 -0
- package/lib/esm/tests/api_tests/security/public_endpoint_auth_field_lock.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/security/public_endpoint_auth_field_lock.test.js +2323 -0
- package/lib/esm/tests/api_tests/security/public_endpoint_auth_field_lock.test.js.map +1 -0
- package/lib/esm/tests/api_tests/tickets_bulk_assign_care_team.test.d.ts +6 -0
- package/lib/esm/tests/api_tests/tickets_bulk_assign_care_team.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/tickets_bulk_assign_care_team.test.js +200 -0
- package/lib/esm/tests/api_tests/tickets_bulk_assign_care_team.test.js.map +1 -0
- package/lib/esm/tests/tests.d.ts.map +1 -1
- package/lib/esm/tests/tests.js +489 -255
- package/lib/esm/tests/tests.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -10
- package/src/sdk.ts +4 -0
- package/src/tests/api_tests/auto_merge_form_submission.test.ts +13 -4
- package/src/tests/api_tests/custom_dashboards.test.ts +92 -0
- package/src/tests/api_tests/file_download_unicode_names.test.ts +223 -0
- package/src/tests/api_tests/healthie_multi_integration.test.ts +103 -5
- package/src/tests/api_tests/openloop_webhooks.test.ts +138 -0
- package/src/tests/api_tests/phone_calls_cold_transfer.test.ts +54 -0
- package/src/tests/api_tests/phone_calls_conference_hold.test.ts +62 -0
- package/src/tests/api_tests/scoped_api_keys.test.ts +5 -0
- package/src/tests/api_tests/security/F-0013-sanitize-user-html-with-iframes.test.ts +215 -0
- package/src/tests/api_tests/security/F-0106-F-0110-enduser-write-restrictions.test.ts +38 -4
- package/src/tests/api_tests/security/F-0166-allowed-paths-wildcard-bypass.test.ts +721 -0
- package/src/tests/api_tests/security/enduser-ai-summary-trust-gate.test.ts +125 -0
- package/src/tests/api_tests/security/formsort_webhook_auth_field_lock.test.ts +753 -0
- package/src/tests/api_tests/security/public_endpoint_auth_field_lock.test.ts +1707 -0
- package/src/tests/api_tests/tickets_bulk_assign_care_team.test.ts +132 -0
- package/src/tests/tests.ts +232 -2
- package/test_generated.pdf +0 -0
- package/.env +0 -13
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.sanitize_user_html_with_iframes_tests = void 0;
|
|
40
|
+
var utilities_1 = require("@tellescope/utilities");
|
|
41
|
+
// Companion to F-0013-sanitize-user-html.test.ts (pattern 06 — XSS via dangerouslySetInnerHTML).
|
|
42
|
+
//
|
|
43
|
+
// sanitize_user_html_with_iframes is the variant used by the live form's field description, so
|
|
44
|
+
// admins can embed video / scheduling widgets. It permits <iframe> and NOTHING else beyond what
|
|
45
|
+
// sanitize_user_html allows. This asserts:
|
|
46
|
+
// 1. permitting iframe did not reopen any of the F-0013 vectors (the full payload list is re-run)
|
|
47
|
+
// 2. only absolute https iframes survive — relative, protocol-relative, http, javascript:, data:
|
|
48
|
+
// and srcdoc frames are dropped, along with their fallback content
|
|
49
|
+
// 3. the restrictive sandbox is forced, but an author-supplied sandbox is honored
|
|
50
|
+
// 4. sanitize_user_html itself still strips iframes (the boundary between the two functions)
|
|
51
|
+
//
|
|
52
|
+
// Pure-function test — no Session needed. Runs as part of the main suite and standalone:
|
|
53
|
+
// ./build_cjs.sh && cd packages/public/sdk && node -r dotenv/config lib/cjs/tests/api_tests/security/F-0013-sanitize-user-html-with-iframes.test.js
|
|
54
|
+
var fail = function (msg) { throw new Error(msg); };
|
|
55
|
+
// Same as has_no_executable_vector in the F-0013 test, minus the '<iframe' clause (iframes are
|
|
56
|
+
// expected in this function's output). Everything else must still be neutralized.
|
|
57
|
+
var has_no_executable_vector_allowing_iframe = function (out) {
|
|
58
|
+
var o = out.toLowerCase();
|
|
59
|
+
var withoutValues = o.replace(/"[^"]*"/g, '""').replace(/'[^']*'/g, "''");
|
|
60
|
+
return !/\son[a-z]+\s*=/.test(withoutValues) // no live on*= event-handler attribute
|
|
61
|
+
&& !o.includes('javascript:')
|
|
62
|
+
&& !o.includes('vbscript:')
|
|
63
|
+
&& !o.includes('<script')
|
|
64
|
+
&& !o.includes('<svg')
|
|
65
|
+
&& !o.includes('<math')
|
|
66
|
+
&& !o.includes('<object')
|
|
67
|
+
&& !o.includes('<embed')
|
|
68
|
+
&& !o.includes('<form')
|
|
69
|
+
&& !o.includes('<noscript')
|
|
70
|
+
&& !o.includes('<template')
|
|
71
|
+
&& !o.includes('srcdoc'); // an inline document is arbitrary markup
|
|
72
|
+
};
|
|
73
|
+
// Tokens that must NEVER appear in the forced default. allow-top-navigation is the important one:
|
|
74
|
+
// it is what stops a hostile embed from redirecting the patient's form page to a phishing site.
|
|
75
|
+
var FORBIDDEN_SANDBOX_TOKENS = [
|
|
76
|
+
'allow-top-navigation',
|
|
77
|
+
'allow-downloads',
|
|
78
|
+
'allow-modals',
|
|
79
|
+
'allow-pointer-lock',
|
|
80
|
+
'allow-orientation-lock',
|
|
81
|
+
];
|
|
82
|
+
var sanitize_user_html_with_iframes_tests = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
83
|
+
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;
|
|
84
|
+
return __generator(this, function (_e) {
|
|
85
|
+
console.log("Running sanitize_user_html_with_iframes XSS regression tests");
|
|
86
|
+
xssPayloads = [
|
|
87
|
+
['img onerror', "<img src=x onerror=\"alert(document.domain)\">"],
|
|
88
|
+
['svg onload', "<svg onload=\"alert(1)\"></svg>"],
|
|
89
|
+
['svg animate onbegin', "<svg><animate onbegin=\"alert(1)\" attributeName=\"x\" dur=\"1s\"></svg>"],
|
|
90
|
+
['details ontoggle', "<details open ontoggle=\"alert(1)\"></details>"],
|
|
91
|
+
['input onfocus autofocus', "<input autofocus onfocus=\"alert(1)\">"],
|
|
92
|
+
['body onpageshow', "<body onpageshow=\"alert(1)\">"],
|
|
93
|
+
['a javascript scheme', "<a href=\"javascript:alert(1)\">x</a>"],
|
|
94
|
+
['a javascript entity-encoded', "<a href=\"jav	ascript:alert(1)\">x</a>"],
|
|
95
|
+
['script tag', "<script>alert(1)</script>"],
|
|
96
|
+
['onerror newline before =', "<img src=x onerror\n=\"alert(1)\">"],
|
|
97
|
+
['onerror mixed case', "<IMG SRC=x OnErRoR=\"alert(1)\">"],
|
|
98
|
+
['marquee onstart', "<marquee onstart=\"alert(1)\">x</marquee>"],
|
|
99
|
+
['mathml mglyph style mxss', "<math><mtext><table><mglyph><style><!--</style><img src=x onerror=alert(1)>"],
|
|
100
|
+
['svg foreignObject', "<svg><foreignObject><img src=x onerror=alert(1)></foreignObject></svg>"],
|
|
101
|
+
['noscript context confusion', "<noscript><p title=\"</noscript><img src=x onerror=alert(1)>\">"],
|
|
102
|
+
['template content', "<template><img src=x onerror=alert(1)></template>"],
|
|
103
|
+
['comment confusion', "<!--><img src=x onerror=alert(1)>-->"],
|
|
104
|
+
['cdata confusion', "<![CDATA[<img src=x onerror=alert(1)>]]>"],
|
|
105
|
+
['markup inside attr value', "<img src=\"x\" alt=\"<script>alert(1)</script>\">"],
|
|
106
|
+
['vbscript scheme', "<a href=\"vbscript:msgbox(1)\">x</a>"],
|
|
107
|
+
['data text/html href', "<a href=\"data:text/html,<script>alert(1)</script>\">x</a>"],
|
|
108
|
+
['javascript decimal entity', "<a href=\"Javascript:alert(1)\">x</a>"],
|
|
109
|
+
['javascript newline entity', "<a href=\"jav
ascript:alert(1)\">x</a>"],
|
|
110
|
+
];
|
|
111
|
+
for (_i = 0, xssPayloads_1 = xssPayloads; _i < xssPayloads_1.length; _i++) {
|
|
112
|
+
_a = xssPayloads_1[_i], name_1 = _a[0], payload = _a[1];
|
|
113
|
+
out = (0, utilities_1.sanitize_user_html_with_iframes)(payload);
|
|
114
|
+
if (!has_no_executable_vector_allowing_iframe(out))
|
|
115
|
+
fail("XSS not neutralized [".concat(name_1, "] -> ").concat(out));
|
|
116
|
+
}
|
|
117
|
+
badSrcs = [
|
|
118
|
+
['javascript scheme', "javascript:alert(1)"],
|
|
119
|
+
['data text/html', "data:text/html,<script>alert(1)</script>"],
|
|
120
|
+
['http (not https)', "http://evil.example"],
|
|
121
|
+
// sanitize-html does NOT reject protocol-relative iframe srcs on its own when
|
|
122
|
+
// allowProtocolRelative is set — this is the self-origin framing vector and the reason the
|
|
123
|
+
// sanitizer does its own absolute-https check.
|
|
124
|
+
['protocol-relative', "//app.tellescope.com/"],
|
|
125
|
+
['root-relative', "/portal/settings"],
|
|
126
|
+
['bare relative', "settings"],
|
|
127
|
+
['whitespace-obfuscated', " https:/\\/\\evil"],
|
|
128
|
+
['tab-entity javascript', "jav	ascript:alert(1)"],
|
|
129
|
+
['scheme-only', "https://"],
|
|
130
|
+
['empty', ""],
|
|
131
|
+
];
|
|
132
|
+
for (_b = 0, badSrcs_1 = badSrcs; _b < badSrcs_1.length; _b++) {
|
|
133
|
+
_c = badSrcs_1[_b], name_2 = _c[0], src = _c[1];
|
|
134
|
+
out = (0, utilities_1.sanitize_user_html_with_iframes)("<iframe src=\"".concat(src, "\"></iframe>"));
|
|
135
|
+
if (out.toLowerCase().includes('<iframe'))
|
|
136
|
+
fail("bad iframe src survived [".concat(name_2, "] -> ").concat(out));
|
|
137
|
+
}
|
|
138
|
+
fallback = (0, utilities_1.sanitize_user_html_with_iframes)("<iframe src=\"/x\">FALLBACK-TEXT</iframe>");
|
|
139
|
+
if (fallback.includes('FALLBACK-TEXT'))
|
|
140
|
+
fail("dropped iframe leaked its fallback text: ".concat(fallback));
|
|
141
|
+
if (fallback.toLowerCase().includes('<iframe'))
|
|
142
|
+
fail("dropped iframe survived: ".concat(fallback));
|
|
143
|
+
srcdoc = (0, utilities_1.sanitize_user_html_with_iframes)("<iframe src=\"https://ok.example\" srcdoc=\"<img src=x onerror=alert(1)>\"></iframe>");
|
|
144
|
+
if (srcdoc.toLowerCase().includes('srcdoc'))
|
|
145
|
+
fail("srcdoc not stripped: ".concat(srcdoc));
|
|
146
|
+
if (!srcdoc.toLowerCase().includes('<iframe'))
|
|
147
|
+
fail("valid iframe dropped alongside srcdoc: ".concat(srcdoc));
|
|
148
|
+
handlers = (0, utilities_1.sanitize_user_html_with_iframes)("<iframe src=\"https://ok.example\" onload=\"alert(1)\" id=\"x\" name=\"getElementById\"></iframe>");
|
|
149
|
+
if (!handlers.toLowerCase().includes('<iframe'))
|
|
150
|
+
fail("valid iframe dropped: ".concat(handlers));
|
|
151
|
+
if (/\son[a-z]+\s*=/.test(handlers.toLowerCase()))
|
|
152
|
+
fail("iframe event handler survived: ".concat(handlers));
|
|
153
|
+
if (/\b(id|name)\s*=/.test(handlers))
|
|
154
|
+
fail("iframe id/name not stripped (DOM clobbering): ".concat(handlers));
|
|
155
|
+
yt = (0, utilities_1.sanitize_user_html_with_iframes)("<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/abc\" frameBorder=\"0\"></iframe>");
|
|
156
|
+
if (!yt.includes('src="https://www.youtube.com/embed/abc"'))
|
|
157
|
+
fail("youtube embed src stripped: ".concat(yt));
|
|
158
|
+
if (!(yt.includes('width="560"') && yt.includes('height="315"')))
|
|
159
|
+
fail("iframe dimensions stripped: ".concat(yt));
|
|
160
|
+
if (!yt.toLowerCase().includes('frameborder'))
|
|
161
|
+
fail("frameborder stripped: ".concat(yt));
|
|
162
|
+
// forced containment
|
|
163
|
+
if (!yt.includes("sandbox=\"".concat(utilities_1.DEFAULT_IFRAME_SANDBOX, "\"")))
|
|
164
|
+
fail("sandbox not forced: ".concat(yt));
|
|
165
|
+
if (!yt.toLowerCase().includes('referrerpolicy='))
|
|
166
|
+
fail("referrerpolicy not set: ".concat(yt));
|
|
167
|
+
for (_d = 0, FORBIDDEN_SANDBOX_TOKENS_1 = FORBIDDEN_SANDBOX_TOKENS; _d < FORBIDDEN_SANDBOX_TOKENS_1.length; _d++) {
|
|
168
|
+
token = FORBIDDEN_SANDBOX_TOKENS_1[_d];
|
|
169
|
+
if (utilities_1.DEFAULT_IFRAME_SANDBOX.includes(token))
|
|
170
|
+
fail("forced sandbox must not grant ".concat(token, ": ").concat(utilities_1.DEFAULT_IFRAME_SANDBOX));
|
|
171
|
+
}
|
|
172
|
+
// allow-same-origin IS granted — required for real embeds (a Loom embed renders blank without it)
|
|
173
|
+
// and harmless because the src is guaranteed cross-origin by the check asserted above.
|
|
174
|
+
if (!utilities_1.DEFAULT_IFRAME_SANDBOX.includes('allow-same-origin'))
|
|
175
|
+
fail("forced sandbox must grant allow-same-origin so real embeds render: ".concat(utilities_1.DEFAULT_IFRAME_SANDBOX));
|
|
176
|
+
authorSandbox = (0, utilities_1.sanitize_user_html_with_iframes)("<iframe src=\"https://ok.example\" sandbox=\"allow-scripts\"></iframe>");
|
|
177
|
+
if (!authorSandbox.includes('sandbox="allow-scripts"'))
|
|
178
|
+
fail("author sandbox not honored: ".concat(authorSandbox));
|
|
179
|
+
emptySandbox = (0, utilities_1.sanitize_user_html_with_iframes)("<iframe src=\"https://ok.example\" sandbox=\"\"></iframe>");
|
|
180
|
+
if (emptySandbox.includes('allow-'))
|
|
181
|
+
fail("empty sandbox was replaced with the permissive default: ".concat(emptySandbox));
|
|
182
|
+
if (!/\ssandbox(\s|>)/.test(emptySandbox))
|
|
183
|
+
fail("empty sandbox attribute lost entirely: ".concat(emptySandbox));
|
|
184
|
+
noref = (0, utilities_1.sanitize_user_html_with_iframes)("<iframe src=\"https://ok.example\" referrerpolicy=\"no-referrer\"></iframe>");
|
|
185
|
+
if (!noref.includes('referrerpolicy="no-referrer"'))
|
|
186
|
+
fail("author referrerpolicy not honored: ".concat(noref));
|
|
187
|
+
allowAttr = (0, utilities_1.sanitize_user_html_with_iframes)("<iframe src=\"https://ok.example\" allow=\"autoplay; encrypted-media\" allowfullscreen></iframe>");
|
|
188
|
+
if (!allowAttr.includes('allow="autoplay; encrypted-media"'))
|
|
189
|
+
fail("allow attribute stripped: ".concat(allowAttr));
|
|
190
|
+
heading = (0, utilities_1.sanitize_user_html_with_iframes)("<h1>Welcome</h1><h3 style=\"color:#333\">Sub</h3>");
|
|
191
|
+
if (!(heading.includes('<h1>') && heading.includes('<h3') && heading.toLowerCase().includes('color')))
|
|
192
|
+
fail("headings/style stripped: ".concat(heading));
|
|
193
|
+
table = (0, utilities_1.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>");
|
|
194
|
+
if (!(table.includes('<table') && table.includes('<td') && table.includes('colspan')))
|
|
195
|
+
fail("table stripped: ".concat(table));
|
|
196
|
+
list = (0, utilities_1.sanitize_user_html_with_iframes)("<ul><li>a</li></ul><ol start=\"3\"><li>c</li></ol>");
|
|
197
|
+
if (!(list.includes('<ul') && list.includes('<li') && list.includes('<ol')))
|
|
198
|
+
fail("list stripped: ".concat(list));
|
|
199
|
+
link = (0, utilities_1.sanitize_user_html_with_iframes)("<a href=\"https://example.com\">link</a>");
|
|
200
|
+
if (!link.includes('href="https://example.com"'))
|
|
201
|
+
fail("safe link stripped: ".concat(link));
|
|
202
|
+
if (!link.toLowerCase().includes('noopener'))
|
|
203
|
+
fail("external link not hardened: ".concat(link));
|
|
204
|
+
img = (0, utilities_1.sanitize_user_html_with_iframes)("<img src=\"https://cdn.example.com/a.png\" alt=\"pic\" width=\"200\">");
|
|
205
|
+
if (!(img.includes('src="https://cdn.example.com/a.png"') && img.includes('alt="pic"')))
|
|
206
|
+
fail("image stripped: ".concat(img));
|
|
207
|
+
dataimg = (0, utilities_1.sanitize_user_html_with_iframes)("<img src=\"data:image/png;base64,iVBORw0KGgo=\">");
|
|
208
|
+
if (!dataimg.includes('data:image/png'))
|
|
209
|
+
fail("data: image stripped: ".concat(dataimg));
|
|
210
|
+
fmt = (0, utilities_1.sanitize_user_html_with_iframes)("<p><strong>b</strong> <em>i</em> <span style=\"font-size:14px\">s</span></p><blockquote>q</blockquote>");
|
|
211
|
+
if (!(fmt.includes('<strong>') && fmt.includes('<span') && fmt.toLowerCase().includes('font-size')))
|
|
212
|
+
fail("formatting stripped: ".concat(fmt));
|
|
213
|
+
shared = (0, utilities_1.sanitize_user_html)("<iframe src=\"https://www.youtube.com/embed/abc\"></iframe>");
|
|
214
|
+
if (shared.toLowerCase().includes('<iframe'))
|
|
215
|
+
fail("sanitize_user_html must still strip iframes: ".concat(shared));
|
|
216
|
+
adminTemplate = "<p>Hi {{enduser.fname}}, watch this:</p><iframe src=\"https://www.youtube.com/embed/abc\"></iframe>";
|
|
217
|
+
templated = (0, utilities_1.replace_form_field_template_values)(adminTemplate, {
|
|
218
|
+
enduser: { fname: "<iframe src=\"https://evil.example/phish\"></iframe>" },
|
|
219
|
+
responses: [],
|
|
220
|
+
escapeNewlinesAsHTMLBreaks: true,
|
|
221
|
+
escapeHTMLValues: true,
|
|
222
|
+
});
|
|
223
|
+
endToEnd = (0, utilities_1.sanitize_user_html_with_iframes)(templated);
|
|
224
|
+
if (!endToEnd.includes('src="https://www.youtube.com/embed/abc"'))
|
|
225
|
+
fail("admin's own iframe did not survive: ".concat(endToEnd));
|
|
226
|
+
// The patient's markup must survive only as inert escaped text — so 'evil.example' may still
|
|
227
|
+
// appear as visible characters, but there must be exactly one LIVE frame (the admin's).
|
|
228
|
+
if (!endToEnd.includes('<iframe'))
|
|
229
|
+
fail("patient markup not escaped to inert text: ".concat(endToEnd));
|
|
230
|
+
if ((endToEnd.toLowerCase().match(/<iframe/g) || []).length !== 1)
|
|
231
|
+
fail("patient-injected iframe became a live frame: ".concat(endToEnd));
|
|
232
|
+
console.log("✅ sanitize_user_html_with_iframes XSS regression tests passed");
|
|
233
|
+
return [2 /*return*/];
|
|
234
|
+
});
|
|
235
|
+
}); };
|
|
236
|
+
exports.sanitize_user_html_with_iframes_tests = sanitize_user_html_with_iframes_tests;
|
|
237
|
+
if (require.main === module) {
|
|
238
|
+
(0, exports.sanitize_user_html_with_iframes_tests)()
|
|
239
|
+
.then(function () { console.log("✅ suite completed"); process.exit(0); })
|
|
240
|
+
.catch(function (err) { console.error("❌ suite failed:", err); process.exit(1); });
|
|
241
|
+
}
|
|
242
|
+
//# sourceMappingURL=F-0013-sanitize-user-html-with-iframes.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"F-0013-sanitize-user-html-with-iframes.test.js","sourceRoot":"","sources":["../../../../../src/tests/api_tests/security/F-0013-sanitize-user-html-with-iframes.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAuJ;AAEvJ,iGAAiG;AACjG,EAAE;AACF,+FAA+F;AAC/F,gGAAgG;AAChG,2CAA2C;AAC3C,oGAAoG;AACpG,mGAAmG;AACnG,wEAAwE;AACxE,oFAAoF;AACpF,+FAA+F;AAC/F,EAAE;AACF,yFAAyF;AACzF,sJAAsJ;AAEtJ,IAAM,IAAI,GAAG,UAAC,GAAW,IAAO,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAA,CAAC,CAAC,CAAA;AAEtD,+FAA+F;AAC/F,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,IAAI,CAAC,CAAA;IAC3E,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAG,uCAAuC;WAC/E,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC;WAC1B,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC;WACxB,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC;WACtB,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;WACnB,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;WACpB,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC;WACtB,CAAC,CAAC,CA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|
|
4
|
+
* (security-audit/findings/F-0015-webhook-outbound-ssrf.md).
|
|
5
|
+
*
|
|
6
|
+
* Outbound webhooks request customer-configured URLs that are validated only for SYNTAX
|
|
7
|
+
* (urlValidator -> validator.isURL, which happily accepts http://10.0.0.1/). Four call sites are
|
|
8
|
+
* affected: api/modules/webhooks.ts:145, :214, :270, and the five-method block at api/v1/api.ts:9723.
|
|
9
|
+
*
|
|
10
|
+
* Two properties make this worse than a blind SSRF:
|
|
11
|
+
* - A non-2xx response body is stored in log.response, and webhook_logs is surfaced to customers for
|
|
12
|
+
* debugging — so an internal endpoint's error body is readable by the tenant that configured it.
|
|
13
|
+
* - The automation send-webhook action builds its URL at runtime through five nested template
|
|
14
|
+
* replacers over action.info.url, so patient-controlled field values can reach the destination.
|
|
15
|
+
*
|
|
16
|
+
* And critically: axios@0.30.2 follows redirects by default (maxRedirects: 5). A pre-flight check on
|
|
17
|
+
* the configured URL is therefore NOT sufficient — a receiver can simply 302 to an internal address
|
|
18
|
+
* after validation has already passed. T4 exists to prove exactly that, which is why the fix has to
|
|
19
|
+
* validate at connect time (a guarded agent) rather than as a string check.
|
|
20
|
+
*
|
|
21
|
+
* Each test below asserts ABSENCE ("the sentinel was never contacted"), which passes trivially if the
|
|
22
|
+
* request never happened at all — a missing allowlist entry, a webhook that never fired, a broken
|
|
23
|
+
* subscription. So each is paired with a positive control that proves the attempt really was made.
|
|
24
|
+
*/
|
|
25
|
+
export declare const webhook_outbound_ssrf_tests: ({ sdk }: {
|
|
26
|
+
sdk: Session;
|
|
27
|
+
sdkNonAdmin: Session;
|
|
28
|
+
}) => Promise<void>;
|
|
29
|
+
//# sourceMappingURL=F-0015-webhook-outbound-ssrf.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"F-0015-webhook-outbound-ssrf.test.d.ts","sourceRoot":"","sources":["../../../../../src/tests/api_tests/security/F-0015-webhook-outbound-ssrf.test.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAyEtC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,2BAA2B;SAA2B,OAAO;iBAAe,OAAO;mBA0K/F,CAAA"}
|