@tellescope/sdk 1.251.0 → 1.252.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/tests/api_tests/calendar_event_webhook_template.test.d.ts +6 -0
- package/lib/cjs/tests/api_tests/calendar_event_webhook_template.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/calendar_event_webhook_template.test.js +337 -0
- package/lib/cjs/tests/api_tests/calendar_event_webhook_template.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/enduser_login_rate_limits.test.d.ts +6 -0
- package/lib/cjs/tests/api_tests/enduser_login_rate_limits.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/enduser_login_rate_limits.test.js +287 -0
- package/lib/cjs/tests/api_tests/enduser_login_rate_limits.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/push_forms_to_portal_group_completion.test.d.ts.map +1 -1
- package/lib/cjs/tests/api_tests/push_forms_to_portal_group_completion.test.js +234 -198
- package/lib/cjs/tests/api_tests/push_forms_to_portal_group_completion.test.js.map +1 -1
- package/lib/cjs/tests/api_tests/security/F-0001-data-sync-redaction-bypass.test.d.ts +28 -0
- package/lib/cjs/tests/api_tests/security/F-0001-data-sync-redaction-bypass.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/security/F-0001-data-sync-redaction-bypass.test.js +349 -0
- package/lib/cjs/tests/api_tests/security/F-0001-data-sync-redaction-bypass.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/security/F-0005-ai-conversations-rbac.test.d.ts +28 -0
- package/lib/cjs/tests/api_tests/security/F-0005-ai-conversations-rbac.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/security/F-0005-ai-conversations-rbac.test.js +247 -0
- package/lib/cjs/tests/api_tests/security/F-0005-ai-conversations-rbac.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/security/F-0007-invite-user-enumeration.test.d.ts +29 -0
- package/lib/cjs/tests/api_tests/security/F-0007-invite-user-enumeration.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/security/F-0007-invite-user-enumeration.test.js +278 -0
- package/lib/cjs/tests/api_tests/security/F-0007-invite-user-enumeration.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/security/F-0008-handle-incoming-communication-cross-tenant.test.d.ts +24 -0
- package/lib/cjs/tests/api_tests/security/F-0008-handle-incoming-communication-cross-tenant.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/security/F-0008-handle-incoming-communication-cross-tenant.test.js +201 -0
- package/lib/cjs/tests/api_tests/security/F-0008-handle-incoming-communication-cross-tenant.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/security/F-0013-sanitize-user-html.test.d.ts +2 -0
- package/lib/cjs/tests/api_tests/security/F-0013-sanitize-user-html.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/security/F-0013-sanitize-user-html.test.js +148 -0
- package/lib/cjs/tests/api_tests/security/F-0013-sanitize-user-html.test.js.map +1 -0
- package/lib/cjs/tests/api_tests/security/F-0016-prototype-pollution.test.d.ts +2 -0
- package/lib/cjs/tests/api_tests/security/F-0016-prototype-pollution.test.d.ts.map +1 -0
- package/lib/cjs/tests/api_tests/security/F-0016-prototype-pollution.test.js +88 -0
- package/lib/cjs/tests/api_tests/security/F-0016-prototype-pollution.test.js.map +1 -0
- package/lib/cjs/tests/tests.d.ts.map +1 -1
- package/lib/cjs/tests/tests.js +186 -151
- package/lib/cjs/tests/tests.js.map +1 -1
- package/lib/esm/tests/api_tests/calendar_event_webhook_template.test.d.ts +6 -0
- package/lib/esm/tests/api_tests/calendar_event_webhook_template.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/calendar_event_webhook_template.test.js +333 -0
- package/lib/esm/tests/api_tests/calendar_event_webhook_template.test.js.map +1 -0
- package/lib/esm/tests/api_tests/enduser_login_rate_limits.test.d.ts +6 -0
- package/lib/esm/tests/api_tests/enduser_login_rate_limits.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/enduser_login_rate_limits.test.js +280 -0
- package/lib/esm/tests/api_tests/enduser_login_rate_limits.test.js.map +1 -0
- package/lib/esm/tests/api_tests/push_forms_to_portal_group_completion.test.d.ts.map +1 -1
- package/lib/esm/tests/api_tests/push_forms_to_portal_group_completion.test.js +235 -199
- package/lib/esm/tests/api_tests/push_forms_to_portal_group_completion.test.js.map +1 -1
- package/lib/esm/tests/api_tests/security/F-0001-data-sync-redaction-bypass.test.d.ts +28 -0
- package/lib/esm/tests/api_tests/security/F-0001-data-sync-redaction-bypass.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/security/F-0001-data-sync-redaction-bypass.test.js +345 -0
- package/lib/esm/tests/api_tests/security/F-0001-data-sync-redaction-bypass.test.js.map +1 -0
- package/lib/esm/tests/api_tests/security/F-0005-ai-conversations-rbac.test.d.ts +28 -0
- package/lib/esm/tests/api_tests/security/F-0005-ai-conversations-rbac.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/security/F-0005-ai-conversations-rbac.test.js +243 -0
- package/lib/esm/tests/api_tests/security/F-0005-ai-conversations-rbac.test.js.map +1 -0
- package/lib/esm/tests/api_tests/security/F-0007-invite-user-enumeration.test.d.ts +29 -0
- package/lib/esm/tests/api_tests/security/F-0007-invite-user-enumeration.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/security/F-0007-invite-user-enumeration.test.js +271 -0
- package/lib/esm/tests/api_tests/security/F-0007-invite-user-enumeration.test.js.map +1 -0
- package/lib/esm/tests/api_tests/security/F-0008-handle-incoming-communication-cross-tenant.test.d.ts +24 -0
- package/lib/esm/tests/api_tests/security/F-0008-handle-incoming-communication-cross-tenant.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/security/F-0008-handle-incoming-communication-cross-tenant.test.js +194 -0
- package/lib/esm/tests/api_tests/security/F-0008-handle-incoming-communication-cross-tenant.test.js.map +1 -0
- package/lib/esm/tests/api_tests/security/F-0013-sanitize-user-html.test.d.ts +2 -0
- package/lib/esm/tests/api_tests/security/F-0013-sanitize-user-html.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/security/F-0013-sanitize-user-html.test.js +144 -0
- package/lib/esm/tests/api_tests/security/F-0013-sanitize-user-html.test.js.map +1 -0
- package/lib/esm/tests/api_tests/security/F-0016-prototype-pollution.test.d.ts +2 -0
- package/lib/esm/tests/api_tests/security/F-0016-prototype-pollution.test.d.ts.map +1 -0
- package/lib/esm/tests/api_tests/security/F-0016-prototype-pollution.test.js +84 -0
- package/lib/esm/tests/api_tests/security/F-0016-prototype-pollution.test.js.map +1 -0
- package/lib/esm/tests/tests.d.ts.map +1 -1
- package/lib/esm/tests/tests.js +186 -151
- package/lib/esm/tests/tests.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -10
- package/src/tests/api_tests/calendar_event_webhook_template.test.ts +204 -0
- package/src/tests/api_tests/enduser_login_rate_limits.test.ts +178 -0
- package/src/tests/api_tests/push_forms_to_portal_group_completion.test.ts +113 -88
- package/src/tests/api_tests/security/F-0001-data-sync-redaction-bypass.test.ts +236 -0
- package/src/tests/api_tests/security/F-0005-ai-conversations-rbac.test.ts +154 -0
- package/src/tests/api_tests/security/F-0007-invite-user-enumeration.test.ts +198 -0
- package/src/tests/api_tests/security/F-0008-handle-incoming-communication-cross-tenant.test.ts +130 -0
- package/src/tests/api_tests/security/F-0013-sanitize-user-html.test.ts +109 -0
- package/src/tests/api_tests/security/F-0016-prototype-pollution.test.ts +50 -0
- package/src/tests/tests.ts +19 -2
- package/test_generated.pdf +0 -0
|
@@ -0,0 +1,148 @@
|
|
|
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_xss_tests = void 0;
|
|
40
|
+
var utilities_1 = require("@tellescope/utilities");
|
|
41
|
+
// Regression test for F-0013 / F-0014 (pattern 06 — XSS via dangerouslySetInnerHTML).
|
|
42
|
+
// sanitize_user_html is the canonical render-time sanitizer that replaced remove_script_tags
|
|
43
|
+
// at every dangerouslySetInnerHTML sink. This asserts it neutralizes XSS vectors (incl. encoded /
|
|
44
|
+
// whitespace / mixed-case / iframe-srcdoc bypass variants) while preserving legitimate
|
|
45
|
+
// customization HTML (tables, headings, lists, links, images, inline styles).
|
|
46
|
+
//
|
|
47
|
+
// Pure-function test — no Session needed. Runs as part of the main suite and standalone:
|
|
48
|
+
// ./build_cjs.sh && cd packages/public/sdk && node -r dotenv/config lib/cjs/tests/api_tests/security/F-0013-sanitize-user-html.test.js
|
|
49
|
+
var fail = function (msg) { throw new Error(msg); };
|
|
50
|
+
var has_no_executable_vector = function (out) {
|
|
51
|
+
var o = out.toLowerCase();
|
|
52
|
+
// A handler smuggled into an attribute VALUE (e.g. title="<img onerror=...>") is inert
|
|
53
|
+
// text — strip quoted values before checking for *live* on*= attributes to avoid false positives.
|
|
54
|
+
var withoutValues = o.replace(/"[^"]*"/g, '""').replace(/'[^']*'/g, "''");
|
|
55
|
+
return !/\son[a-z]+\s*=/.test(withoutValues) // no live on*= event-handler attribute
|
|
56
|
+
&& !o.includes('javascript:') // dropped schemes never appear in safe output
|
|
57
|
+
&& !o.includes('vbscript:')
|
|
58
|
+
&& !o.includes('<script') // literal dangerous tags (encoded <script is fine)
|
|
59
|
+
&& !o.includes('<iframe')
|
|
60
|
+
&& !o.includes('<svg')
|
|
61
|
+
&& !o.includes('<math')
|
|
62
|
+
&& !o.includes('<object')
|
|
63
|
+
&& !o.includes('<embed')
|
|
64
|
+
&& !o.includes('<form')
|
|
65
|
+
&& !o.includes('<noscript')
|
|
66
|
+
&& !o.includes('<template');
|
|
67
|
+
};
|
|
68
|
+
var sanitize_user_html_xss_tests = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
69
|
+
var xssPayloads, _i, xssPayloads_1, _a, name_1, payload, out, clobber, heading, table, list, link, img, dataimg, fmt, mixed;
|
|
70
|
+
return __generator(this, function (_b) {
|
|
71
|
+
console.log("Running F-0013/F-0014 sanitize_user_html XSS regression tests");
|
|
72
|
+
xssPayloads = [
|
|
73
|
+
['img onerror', "<img src=x onerror=\"alert(document.domain)\">"],
|
|
74
|
+
['svg onload', "<svg onload=\"alert(1)\"></svg>"],
|
|
75
|
+
['svg animate onbegin', "<svg><animate onbegin=\"alert(1)\" attributeName=\"x\" dur=\"1s\"></svg>"],
|
|
76
|
+
['details ontoggle', "<details open ontoggle=\"alert(1)\"></details>"],
|
|
77
|
+
['input onfocus autofocus', "<input autofocus onfocus=\"alert(1)\">"],
|
|
78
|
+
['body onpageshow', "<body onpageshow=\"alert(1)\">"],
|
|
79
|
+
['a javascript scheme', "<a href=\"javascript:alert(1)\">x</a>"],
|
|
80
|
+
['a javascript entity-encoded', "<a href=\"jav	ascript:alert(1)\">x</a>"],
|
|
81
|
+
['iframe javascript src', "<iframe src=\"javascript:alert(1)\"></iframe>"],
|
|
82
|
+
['iframe srcdoc nested', "<iframe srcdoc=\"<img src=x onerror=alert(1)>\"></iframe>"],
|
|
83
|
+
['script tag', "<script>alert(1)</script>"],
|
|
84
|
+
['onerror newline before =', "<img src=x onerror\n=\"alert(1)\">"],
|
|
85
|
+
['onerror mixed case', "<IMG SRC=x OnErRoR=\"alert(1)\">"],
|
|
86
|
+
['marquee onstart', "<marquee onstart=\"alert(1)\">x</marquee>"],
|
|
87
|
+
// mutation / namespace confusion — svg/math/noscript/template must be stripped
|
|
88
|
+
['mathml mglyph style mxss', "<math><mtext><table><mglyph><style><!--</style><img src=x onerror=alert(1)>"],
|
|
89
|
+
['svg foreignObject', "<svg><foreignObject><img src=x onerror=alert(1)></foreignObject></svg>"],
|
|
90
|
+
['noscript context confusion', "<noscript><p title=\"</noscript><img src=x onerror=alert(1)>\">"],
|
|
91
|
+
['template content', "<template><img src=x onerror=alert(1)></template>"],
|
|
92
|
+
// comment / CDATA confusion
|
|
93
|
+
['comment confusion', "<!--><img src=x onerror=alert(1)>-->"],
|
|
94
|
+
['cdata confusion', "<![CDATA[<img src=x onerror=alert(1)>]]>"],
|
|
95
|
+
// markup smuggled inside an attribute value must stay inert
|
|
96
|
+
['markup inside attr value', "<img src=\"x\" alt=\"<script>alert(1)</script>\">"],
|
|
97
|
+
// protocol obfuscation
|
|
98
|
+
['vbscript scheme', "<a href=\"vbscript:msgbox(1)\">x</a>"],
|
|
99
|
+
['data text/html href', "<a href=\"data:text/html,<script>alert(1)</script>\">x</a>"],
|
|
100
|
+
['javascript decimal entity', "<a href=\"Javascript:alert(1)\">x</a>"],
|
|
101
|
+
['javascript newline entity', "<a href=\"jav
ascript:alert(1)\">x</a>"],
|
|
102
|
+
];
|
|
103
|
+
for (_i = 0, xssPayloads_1 = xssPayloads; _i < xssPayloads_1.length; _i++) {
|
|
104
|
+
_a = xssPayloads_1[_i], name_1 = _a[0], payload = _a[1];
|
|
105
|
+
out = (0, utilities_1.sanitize_user_html)(payload);
|
|
106
|
+
if (!has_no_executable_vector(out))
|
|
107
|
+
fail("XSS not neutralized [".concat(name_1, "] -> ").concat(out));
|
|
108
|
+
}
|
|
109
|
+
clobber = (0, utilities_1.sanitize_user_html)("<a id=\"x\" name=\"getElementById\">link</a><img name=\"y\">");
|
|
110
|
+
if (/\b(id|name)\s*=/.test(clobber))
|
|
111
|
+
fail("id/name not stripped (DOM clobbering): ".concat(clobber));
|
|
112
|
+
heading = (0, utilities_1.sanitize_user_html)("<h1>Welcome</h1><h3 style=\"color:#333\">Sub</h3>");
|
|
113
|
+
if (!(heading.includes('<h1>') && heading.includes('<h3') && heading.toLowerCase().includes('color')))
|
|
114
|
+
fail("headings/style stripped: ".concat(heading));
|
|
115
|
+
table = (0, utilities_1.sanitize_user_html)("<table><thead><tr><th>H</th></tr></thead><tbody><tr><td style=\"padding:4px\" colspan=\"2\">cell</td></tr></tbody></table>");
|
|
116
|
+
if (!(table.includes('<table') && table.includes('<td') && table.includes('colspan')))
|
|
117
|
+
fail("table stripped: ".concat(table));
|
|
118
|
+
list = (0, utilities_1.sanitize_user_html)("<ul><li>a</li></ul><ol start=\"3\"><li>c</li></ol>");
|
|
119
|
+
if (!(list.includes('<ul') && list.includes('<li') && list.includes('<ol')))
|
|
120
|
+
fail("list stripped: ".concat(list));
|
|
121
|
+
link = (0, utilities_1.sanitize_user_html)("<a href=\"https://example.com\">link</a>");
|
|
122
|
+
if (!link.includes('href="https://example.com"'))
|
|
123
|
+
fail("safe link stripped: ".concat(link));
|
|
124
|
+
if (!link.toLowerCase().includes('noopener'))
|
|
125
|
+
fail("external link not hardened: ".concat(link));
|
|
126
|
+
img = (0, utilities_1.sanitize_user_html)("<img src=\"https://cdn.example.com/a.png\" alt=\"pic\" width=\"200\">");
|
|
127
|
+
if (!(img.includes('src="https://cdn.example.com/a.png"') && img.includes('alt="pic"')))
|
|
128
|
+
fail("http image stripped: ".concat(img));
|
|
129
|
+
dataimg = (0, utilities_1.sanitize_user_html)("<img src=\"data:image/png;base64,iVBORw0KGgo=\">");
|
|
130
|
+
if (!dataimg.includes('data:image/png'))
|
|
131
|
+
fail("data: image stripped: ".concat(dataimg));
|
|
132
|
+
fmt = (0, utilities_1.sanitize_user_html)("<p><strong>b</strong> <em>i</em> <span style=\"font-size:14px\">s</span></p><blockquote>q</blockquote>");
|
|
133
|
+
if (!(fmt.includes('<strong>') && fmt.includes('<span') && fmt.toLowerCase().includes('font-size')))
|
|
134
|
+
fail("formatting stripped: ".concat(fmt));
|
|
135
|
+
mixed = (0, utilities_1.sanitize_user_html)("<p>Hello <b>name</b></p><img src=x onerror=\"steal()\">");
|
|
136
|
+
if (!(mixed.includes('<b>name</b>') && !/\son[a-z]+\s*=/.test(mixed.toLowerCase())))
|
|
137
|
+
fail("mixed content not handled: ".concat(mixed));
|
|
138
|
+
console.log("✅ F-0013/F-0014 sanitize_user_html XSS regression tests passed");
|
|
139
|
+
return [2 /*return*/];
|
|
140
|
+
});
|
|
141
|
+
}); };
|
|
142
|
+
exports.sanitize_user_html_xss_tests = sanitize_user_html_xss_tests;
|
|
143
|
+
if (require.main === module) {
|
|
144
|
+
(0, exports.sanitize_user_html_xss_tests)()
|
|
145
|
+
.then(function () { console.log("✅ suite completed"); process.exit(0); })
|
|
146
|
+
.catch(function (err) { console.error("❌ suite failed:", err); process.exit(1); });
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=F-0013-sanitize-user-html.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"F-0013-sanitize-user-html.test.js","sourceRoot":"","sources":["../../../../../src/tests/api_tests/security/F-0013-sanitize-user-html.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAA0D;AAE1D,sFAAsF;AACtF,6FAA6F;AAC7F,kGAAkG;AAClG,uFAAuF;AACvF,8EAA8E;AAC9E,EAAE;AACF,yFAAyF;AACzF,yIAAyI;AAEzI,IAAM,IAAI,GAAG,UAAC,GAAW,IAAO,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAA,CAAC,CAAC,CAAA;AAEtD,IAAM,wBAAwB,GAAG,UAAC,GAAW;IAC3C,IAAM,CAAC,GAAG,GAAG,CAAC,WAAW,EAAE,CAAA;IAC3B,6FAA6F;IAC7F,kGAAkG;IAClG,IAAM,aAAa,GAAG,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,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":"","sources":["../../../../../src/tests/api_tests/security/F-0016-prototype-pollution.test.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,yBAAyB,qBAgCrC,CAAA"}
|
|
@@ -0,0 +1,88 @@
|
|
|
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.prototype_pollution_tests = void 0;
|
|
40
|
+
var utilities_1 = require("@tellescope/utilities");
|
|
41
|
+
// Regression test for F-0016 (pattern 17 — prototype pollution).
|
|
42
|
+
// add_value_for_dotted_key must NOT write through __proto__/constructor/prototype path segments
|
|
43
|
+
// (which would pollute Object.prototype process-wide), while still performing legitimate dotted assignment.
|
|
44
|
+
//
|
|
45
|
+
// Pure-function test — no Session needed. Runs in the main suite and standalone:
|
|
46
|
+
// ./build_cjs.sh && cd packages/public/sdk && node -r dotenv/config lib/cjs/tests/api_tests/security/F-0016-prototype-pollution.test.js
|
|
47
|
+
var fail = function (msg) { throw new Error(msg); };
|
|
48
|
+
var prototype_pollution_tests = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
49
|
+
var leakedA, leakedB, leakedC, obj, flat;
|
|
50
|
+
return __generator(this, function (_a) {
|
|
51
|
+
console.log("Running F-0016 prototype-pollution regression tests");
|
|
52
|
+
// 1. __proto__ path must not pollute Object.prototype
|
|
53
|
+
(0, utilities_1.add_value_for_dotted_key)({ insurance: {} }, 'insurance.__proto__.__pp_a__', 'polluted');
|
|
54
|
+
leakedA = {}.__pp_a__;
|
|
55
|
+
delete Object.prototype.__pp_a__; // clean up regardless, so a failure here can't contaminate the rest of the suite
|
|
56
|
+
if (leakedA !== undefined)
|
|
57
|
+
fail('Object.prototype polluted via __proto__ path');
|
|
58
|
+
// 2. constructor.prototype path must not pollute
|
|
59
|
+
(0, utilities_1.add_value_for_dotted_key)({ insurance: {} }, 'insurance.constructor.prototype.__pp_b__', 'polluted');
|
|
60
|
+
leakedB = {}.__pp_b__;
|
|
61
|
+
delete Object.prototype.__pp_b__;
|
|
62
|
+
if (leakedB !== undefined)
|
|
63
|
+
fail('Object.prototype polluted via constructor.prototype path');
|
|
64
|
+
// 3. a leading __proto__ segment must not pollute either
|
|
65
|
+
(0, utilities_1.add_value_for_dotted_key)({}, '__proto__.__pp_c__', 'polluted');
|
|
66
|
+
leakedC = {}.__pp_c__;
|
|
67
|
+
delete Object.prototype.__pp_c__;
|
|
68
|
+
if (leakedC !== undefined)
|
|
69
|
+
fail('Object.prototype polluted via leading __proto__ segment');
|
|
70
|
+
obj = { a: { b: {} } };
|
|
71
|
+
(0, utilities_1.add_value_for_dotted_key)(obj, 'a.b.c', 42);
|
|
72
|
+
if (obj.a.b.c !== 42)
|
|
73
|
+
fail('legitimate dotted assignment broke');
|
|
74
|
+
flat = {};
|
|
75
|
+
(0, utilities_1.add_value_for_dotted_key)(flat, 'name', 'ok');
|
|
76
|
+
if (flat.name !== 'ok')
|
|
77
|
+
fail('single-key assignment broke');
|
|
78
|
+
console.log("✅ F-0016 prototype-pollution regression tests passed");
|
|
79
|
+
return [2 /*return*/];
|
|
80
|
+
});
|
|
81
|
+
}); };
|
|
82
|
+
exports.prototype_pollution_tests = prototype_pollution_tests;
|
|
83
|
+
if (require.main === module) {
|
|
84
|
+
(0, exports.prototype_pollution_tests)()
|
|
85
|
+
.then(function () { console.log("✅ suite completed"); process.exit(0); })
|
|
86
|
+
.catch(function (err) { console.error("❌ suite failed:", err); process.exit(1); });
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=F-0016-prototype-pollution.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"F-0016-prototype-pollution.test.js","sourceRoot":"","sources":["../../../../../src/tests/api_tests/security/F-0016-prototype-pollution.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAgE;AAEhE,iEAAiE;AACjE,gGAAgG;AAChG,4GAA4G;AAC5G,EAAE;AACF,iFAAiF;AACjF,0IAA0I;AAE1I,IAAM,IAAI,GAAG,UAAC,GAAW,IAAO,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAA,CAAC,CAAC,CAAA;AAE/C,IAAM,yBAAyB,GAAG;;;QACvC,OAAO,CAAC,GAAG,CAAC,qDAAqD,CAAC,CAAA;QAElE,sDAAsD;QACtD,IAAA,oCAAwB,EAAC,EAAE,SAAS,EAAE,EAAE,EAAS,EAAE,8BAA8B,EAAE,UAAU,CAAC,CAAA;QACxF,OAAO,GAAI,EAAU,CAAC,QAAQ,CAAA;QACpC,OAAQ,MAAM,CAAC,SAAiB,CAAC,QAAQ,CAAA,CAAC,iFAAiF;QAC3H,IAAI,OAAO,KAAK,SAAS;YAAE,IAAI,CAAC,8CAA8C,CAAC,CAAA;QAE/E,iDAAiD;QACjD,IAAA,oCAAwB,EAAC,EAAE,SAAS,EAAE,EAAE,EAAS,EAAE,0CAA0C,EAAE,UAAU,CAAC,CAAA;QACpG,OAAO,GAAI,EAAU,CAAC,QAAQ,CAAA;QACpC,OAAQ,MAAM,CAAC,SAAiB,CAAC,QAAQ,CAAA;QACzC,IAAI,OAAO,KAAK,SAAS;YAAE,IAAI,CAAC,0DAA0D,CAAC,CAAA;QAE3F,yDAAyD;QACzD,IAAA,oCAAwB,EAAC,EAAS,EAAE,oBAAoB,EAA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ests.d.ts","sourceRoot":"","sources":["../../../src/tests/tests.ts"],"names":[],"mappings":"AA6yEA,eAAO,MAAM,kCAAkC,qBAgJ9C,CAAA;AAED,eAAO,MAAM,mCAAmC,qBA2K/C,CAAA;AAGD,eAAO,MAAM,oBAAoB,qBAoHhC,CAAA;AAED,eAAO,MAAM,+BAA+B,qBAsF3C,CAAA;AAID,eAAO,MAAM,0BAA0B,qBAqCtC,CAAA;AA8vED,eAAO,MAAM,cAAc,qBAqC1B,CAAA;AAotBD,eAAO,MAAM,0BAA0B,qBAmFtC,CAAA;AAqED,eAAO,MAAM,eAAe,qBAmD3B,CAAA;AAED,eAAO,MAAM,oBAAoB,6BAsBhC,CAAA;AAED,eAAO,MAAM,oCAAoC,qBAylBhD,CAAA;AAED,eAAO,MAAM,mCAAmC,qBAkE/C,CAAA;AAw7CD,eAAO,MAAM,yBAAyB,qBA0DrC,CAAA;AAED,eAAO,MAAM,kBAAkB,qBAmK9B,CAAA;AAED,eAAO,MAAM,sBAAsB,qBA0BlC,CAAA;AAGD,eAAO,MAAM,mBAAmB,qBAmC/B,CAAA;AAED,eAAO,MAAM,gCAAgC,mCA2C5C,CAAA;AAED,eAAO,MAAM,cAAc,qBAwb1B,CAAA;AAGD,eAAO,MAAM,oBAAoB,uBAuBhC,CAAA;AA4wBD,eAAO,MAAM,4BAA4B,qBAoExC,CAAA;AAED,eAAO,MAAM,+BAA+B,qBA4U3C,CAAA;AAED,eAAO,MAAM,gDAAgD,qBAwC5D,CAAA;AAED,eAAO,MAAM,qBAAqB,qBAwIjC,CAAA"}
|