@wooksjs/event-http 0.7.9 → 0.7.11
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/index.cjs +15 -3
- package/dist/index.mjs +15 -3
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -1446,10 +1446,22 @@ function error_tl_default(ctx) {
|
|
|
1446
1446
|
`;
|
|
1447
1447
|
}
|
|
1448
1448
|
|
|
1449
|
+
//#endregion
|
|
1450
|
+
//#region packages/event-http/src/utils/escape-html.ts
|
|
1451
|
+
/**
|
|
1452
|
+
* Escapes a value for safe interpolation into HTML text and attribute contexts.
|
|
1453
|
+
*
|
|
1454
|
+
* Use at the boundary between untrusted data (e.g. attacker-controlled URL
|
|
1455
|
+
* parameters, error messages, user input) and rendered HTML responses.
|
|
1456
|
+
*/
|
|
1457
|
+
function escapeHtml(value) {
|
|
1458
|
+
return String(value).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1449
1461
|
//#endregion
|
|
1450
1462
|
//#region packages/event-http/src/response/wooks-http-response.ts
|
|
1451
1463
|
let framework = {
|
|
1452
|
-
version: "0.7.
|
|
1464
|
+
version: "0.7.10",
|
|
1453
1465
|
poweredBy: "wooksjs",
|
|
1454
1466
|
link: "https://wooks.moost.org/",
|
|
1455
1467
|
image: "https://wooks.moost.org/wooks-full-logo.svg"
|
|
@@ -1496,8 +1508,8 @@ function renderErrorHtml(data) {
|
|
|
1496
1508
|
icon,
|
|
1497
1509
|
statusCode: data.statusCode,
|
|
1498
1510
|
statusMessage: httpStatusCodes[data.statusCode],
|
|
1499
|
-
message: data.message,
|
|
1500
|
-
details: hasDetails ? JSON.stringify(data, null, " ") : "",
|
|
1511
|
+
message: escapeHtml(data.message),
|
|
1512
|
+
details: hasDetails ? escapeHtml(JSON.stringify(data, null, " ")) : "",
|
|
1501
1513
|
version: framework.version,
|
|
1502
1514
|
poweredBy: framework.poweredBy,
|
|
1503
1515
|
link: framework.link,
|
package/dist/index.mjs
CHANGED
|
@@ -1423,10 +1423,22 @@ function error_tl_default(ctx) {
|
|
|
1423
1423
|
`;
|
|
1424
1424
|
}
|
|
1425
1425
|
|
|
1426
|
+
//#endregion
|
|
1427
|
+
//#region packages/event-http/src/utils/escape-html.ts
|
|
1428
|
+
/**
|
|
1429
|
+
* Escapes a value for safe interpolation into HTML text and attribute contexts.
|
|
1430
|
+
*
|
|
1431
|
+
* Use at the boundary between untrusted data (e.g. attacker-controlled URL
|
|
1432
|
+
* parameters, error messages, user input) and rendered HTML responses.
|
|
1433
|
+
*/
|
|
1434
|
+
function escapeHtml(value) {
|
|
1435
|
+
return String(value).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1426
1438
|
//#endregion
|
|
1427
1439
|
//#region packages/event-http/src/response/wooks-http-response.ts
|
|
1428
1440
|
let framework = {
|
|
1429
|
-
version: "0.7.
|
|
1441
|
+
version: "0.7.10",
|
|
1430
1442
|
poweredBy: "wooksjs",
|
|
1431
1443
|
link: "https://wooks.moost.org/",
|
|
1432
1444
|
image: "https://wooks.moost.org/wooks-full-logo.svg"
|
|
@@ -1473,8 +1485,8 @@ function renderErrorHtml(data) {
|
|
|
1473
1485
|
icon,
|
|
1474
1486
|
statusCode: data.statusCode,
|
|
1475
1487
|
statusMessage: httpStatusCodes[data.statusCode],
|
|
1476
|
-
message: data.message,
|
|
1477
|
-
details: hasDetails ? JSON.stringify(data, null, " ") : "",
|
|
1488
|
+
message: escapeHtml(data.message),
|
|
1489
|
+
details: hasDetails ? escapeHtml(JSON.stringify(data, null, " ")) : "",
|
|
1478
1490
|
version: framework.version,
|
|
1479
1491
|
poweredBy: framework.poweredBy,
|
|
1480
1492
|
link: framework.link,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wooksjs/event-http",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.11",
|
|
4
4
|
"description": "@wooksjs/event-http",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"typescript": "^5.9.3",
|
|
44
44
|
"vitest": "^3.2.4",
|
|
45
|
-
"@wooksjs/event-core": "^0.7.
|
|
46
|
-
"wooks": "^0.7.
|
|
45
|
+
"@wooksjs/event-core": "^0.7.11",
|
|
46
|
+
"wooks": "^0.7.11"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@prostojs/logger": "^0.4.3",
|
|
50
50
|
"@prostojs/router": "^0.3.3",
|
|
51
|
-
"@wooksjs/event-core": "^0.7.
|
|
52
|
-
"wooks": "^0.7.
|
|
51
|
+
"@wooksjs/event-core": "^0.7.11",
|
|
52
|
+
"wooks": "^0.7.11"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "rolldown -c ../../rolldown.config.mjs"
|