@joystick.js/node-canary 0.0.0-canary.32 → 0.0.0-canary.34
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.
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import getBrowserSafeUser from "./accounts/getBrowserSafeUser";
|
|
2
|
+
import escapeHTML from "../lib/escapeHTML.js";
|
|
2
3
|
var getBrowserSafeRequest_default = (req = {}) => {
|
|
3
4
|
const browserSafeRequest = {};
|
|
4
|
-
browserSafeRequest.params = req.params;
|
|
5
|
-
browserSafeRequest.query = req.query;
|
|
5
|
+
browserSafeRequest.params = escapeHTML(req.params);
|
|
6
|
+
browserSafeRequest.query = escapeHTML(req.query);
|
|
6
7
|
browserSafeRequest.context = {
|
|
7
8
|
user: getBrowserSafeUser(req.context.user)
|
|
8
9
|
};
|
|
@@ -8,6 +8,7 @@ import generateErrorPage from "../../lib/generateErrorPage.js";
|
|
|
8
8
|
import replaceFileProtocol from "../../lib/replaceFileProtocol.js";
|
|
9
9
|
import replaceBackslashesWithForwardSlashes from "../../lib/replaceBackslashesWithForwardSlashes.js";
|
|
10
10
|
import getBuildPath from "../../lib/getBuildPath.js";
|
|
11
|
+
import escapeHTML from "../../lib/escapeHTML.js";
|
|
11
12
|
const generateHash = (input = "") => {
|
|
12
13
|
return crypto.createHash("sha256").update(input).digest("hex");
|
|
13
14
|
};
|
|
@@ -65,10 +66,10 @@ const getCachedHTML = ({ cachePath, cacheFileName, currentDiff }) => {
|
|
|
65
66
|
const getUrl = (request = {}) => {
|
|
66
67
|
const [path = null] = request.url?.split("?");
|
|
67
68
|
return {
|
|
68
|
-
params: request.params,
|
|
69
|
-
query: request.query,
|
|
70
|
-
route: request.route.path,
|
|
71
|
-
path
|
|
69
|
+
params: escapeHTML(request.params),
|
|
70
|
+
query: escapeHTML(request.query),
|
|
71
|
+
route: escapeHTML(request.route.path),
|
|
72
|
+
path: escapeHTML(path)
|
|
72
73
|
};
|
|
73
74
|
};
|
|
74
75
|
const getFile = async (buildPath = "") => {
|
|
@@ -14,11 +14,6 @@ var sanitizeRequestParameters_default = (req, res, next) => {
|
|
|
14
14
|
if (req?.route?.path) {
|
|
15
15
|
req.route.path = escapeHTML(req?.route?.path);
|
|
16
16
|
}
|
|
17
|
-
console.log({
|
|
18
|
-
params: req?.params,
|
|
19
|
-
query: req?.query,
|
|
20
|
-
route: req?.route
|
|
21
|
-
});
|
|
22
17
|
next();
|
|
23
18
|
};
|
|
24
19
|
export {
|