@digilogiclabs/platform-core 1.17.2 → 1.18.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/dist/auth.d.mts +20 -1
- package/dist/auth.d.ts +20 -1
- package/dist/auth.js +30 -0
- package/dist/auth.js.map +1 -1
- package/dist/auth.mjs +28 -0
- package/dist/auth.mjs.map +1 -1
- package/dist/email-templates.d.mts +1 -1
- package/dist/email-templates.d.ts +1 -1
- package/dist/email-templates.js.map +1 -1
- package/dist/email-templates.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -0
- package/dist/index.mjs.map +1 -1
- package/dist/{security-BvLXaQkv.d.mts → security-DMUNYqQI.d.mts} +42 -1
- package/dist/{security-BvLXaQkv.d.ts → security-DMUNYqQI.d.ts} +42 -1
- package/package.json +1 -1
package/dist/auth.mjs
CHANGED
|
@@ -359,6 +359,29 @@ function containsHtml(str) {
|
|
|
359
359
|
function stripHtml(str) {
|
|
360
360
|
return str.replace(/<[^>]*>/g, "");
|
|
361
361
|
}
|
|
362
|
+
function stripNullBytes(value) {
|
|
363
|
+
if (value === null || value === void 0) return value;
|
|
364
|
+
return value.replace(/\u0000/g, "");
|
|
365
|
+
}
|
|
366
|
+
function stripNullBytesDeep(value, depth = 8) {
|
|
367
|
+
if (depth <= 0) {
|
|
368
|
+
throw new Error("stripNullBytesDeep: max depth exceeded (circular?)");
|
|
369
|
+
}
|
|
370
|
+
if (typeof value === "string") {
|
|
371
|
+
return value.replace(/\u0000/g, "");
|
|
372
|
+
}
|
|
373
|
+
if (Array.isArray(value)) {
|
|
374
|
+
return value.map((v) => stripNullBytesDeep(v, depth - 1));
|
|
375
|
+
}
|
|
376
|
+
if (value !== null && typeof value === "object") {
|
|
377
|
+
const out = {};
|
|
378
|
+
for (const [k, v] of Object.entries(value)) {
|
|
379
|
+
out[k] = stripNullBytesDeep(v, depth - 1);
|
|
380
|
+
}
|
|
381
|
+
return out;
|
|
382
|
+
}
|
|
383
|
+
return value;
|
|
384
|
+
}
|
|
362
385
|
function constantTimeEqual(a, b) {
|
|
363
386
|
try {
|
|
364
387
|
const aBuf = Buffer.from(a, "utf-8");
|
|
@@ -1575,6 +1598,9 @@ function createSecureHandlerFactory(factoryConfig) {
|
|
|
1575
1598
|
const ct = request.headers.get("content-type");
|
|
1576
1599
|
input = ct?.includes("application/json") ? await request.json() : {};
|
|
1577
1600
|
}
|
|
1601
|
+
if (factoryConfig.sanitizeNullBytes !== false) {
|
|
1602
|
+
input = stripNullBytesDeep(input);
|
|
1603
|
+
}
|
|
1578
1604
|
const result = routeConfig.validate.safeParse(input);
|
|
1579
1605
|
if (!result.success) {
|
|
1580
1606
|
const fieldErrors = result.error?.flatten ? result.error.flatten().fieldErrors : void 0;
|
|
@@ -1897,6 +1923,8 @@ export {
|
|
|
1897
1923
|
sanitizeApiError,
|
|
1898
1924
|
storeBetaCode,
|
|
1899
1925
|
stripHtml,
|
|
1926
|
+
stripNullBytes,
|
|
1927
|
+
stripNullBytesDeep,
|
|
1900
1928
|
validateBetaCode,
|
|
1901
1929
|
validateEnvVars,
|
|
1902
1930
|
verifyCronAuth,
|