feat: helmet

This commit is contained in:
Artemy 2023-08-04 15:11:57 +03:00
parent 55a1b757ad
commit 810f618f03
3 changed files with 17 additions and 0 deletions

View file

@ -23,6 +23,7 @@ const path = require("path");
const { Server } = require("socket.io"); const { Server } = require("socket.io");
const rateLimit = require("express-rate-limit"); const rateLimit = require("express-rate-limit");
const { NotesCore } = require("./core"); const { NotesCore } = require("./core");
const helmet = require("helmet");
let core = new NotesCore(); let core = new NotesCore();
@ -81,6 +82,7 @@ io.on("connection", (socket) => {
}); });
}); });
app.use(helmet());
app.use(bodyParser.json()); app.use(bodyParser.json());
app.post("/publish", limiter, async (req, res) => { app.post("/publish", limiter, async (req, res) => {

14
package-lock.json generated
View file

@ -17,6 +17,7 @@
"express": "^4.18.2", "express": "^4.18.2",
"express-rate-limit": "^6.8.0", "express-rate-limit": "^6.8.0",
"fuse.js": "^6.6.2", "fuse.js": "^6.6.2",
"helmet": "^7.0.0",
"js-sha3": "^0.8.0", "js-sha3": "^0.8.0",
"mongodb": "^5.5.0", "mongodb": "^5.5.0",
"openai": "^3.3.0", "openai": "^3.3.0",
@ -3501,6 +3502,14 @@
"url": "https://opencollective.com/unified" "url": "https://opencollective.com/unified"
} }
}, },
"node_modules/helmet": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/helmet/-/helmet-7.0.0.tgz",
"integrity": "sha512-MsIgYmdBh460ZZ8cJC81q4XJknjG567wzEmv46WOBblDb6TUd3z8/GhgmsM9pn8g2B80tAJ4m5/d3Bi1KrSUBQ==",
"engines": {
"node": ">=16.0.0"
}
},
"node_modules/highlight.js": { "node_modules/highlight.js": {
"version": "10.7.3", "version": "10.7.3",
"resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz", "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz",
@ -10059,6 +10068,11 @@
"space-separated-tokens": "^2.0.0" "space-separated-tokens": "^2.0.0"
} }
}, },
"helmet": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/helmet/-/helmet-7.0.0.tgz",
"integrity": "sha512-MsIgYmdBh460ZZ8cJC81q4XJknjG567wzEmv46WOBblDb6TUd3z8/GhgmsM9pn8g2B80tAJ4m5/d3Bi1KrSUBQ=="
},
"highlight.js": { "highlight.js": {
"version": "10.7.3", "version": "10.7.3",
"resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz", "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz",

View file

@ -20,6 +20,7 @@
"express": "^4.18.2", "express": "^4.18.2",
"express-rate-limit": "^6.8.0", "express-rate-limit": "^6.8.0",
"fuse.js": "^6.6.2", "fuse.js": "^6.6.2",
"helmet": "^7.0.0",
"js-sha3": "^0.8.0", "js-sha3": "^0.8.0",
"mongodb": "^5.5.0", "mongodb": "^5.5.0",
"openai": "^3.3.0", "openai": "^3.3.0",