Skip to content
Snippets Groups Projects
Commit d4837dbd authored by Jesus Galaz's avatar Jesus Galaz
Browse files

Revert "Trying to fix vulnerability issues"

This reverts commit 53b64634.
parent 53b64634
No related branches found
No related tags found
Loading
Pipeline #15727 passed
...@@ -2,7 +2,6 @@ const express = require('express'); ...@@ -2,7 +2,6 @@ const express = require('express');
const path = require('path'); const path = require('path');
const connectDB = require('./mongodb'); const connectDB = require('./mongodb');
const session = require('express-session'); const session = require('express-session');
const url = require('url');
const app = express(); const app = express();
...@@ -10,20 +9,6 @@ const app = express(); ...@@ -10,20 +9,6 @@ const app = express();
app.use(express.json()); app.use(express.json());
app.use(express.static(path.join(__dirname, 'public'))); app.use(express.static(path.join(__dirname, 'public')));
// Allow only localhost for SSRF protection
function validateLocalhost(req, res, next) {
const remoteAddress = req.connection.remoteAddress;
// Allow requests only from localhost (IPv4 and IPv6)
if (remoteAddress !== '127.0.0.1' && remoteAddress !== '::1') {
return res.status(403).send('External requests are forbidden');
}
next();
}
app.use(validateLocalhost); // Add the middleware
// Session configuration // Session configuration
app.use( app.use(
session({ session({
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment