Skip to content

Commit c62b794

Browse files
committed
add session check to upload
1 parent b13fd02 commit c62b794

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

frontend/express/app.js

+4
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,10 @@ Promise.all([plugins.dbConnection(countlyConfig), plugins.dbConnection("countly_
603603
app.use(function(req, res, next) {
604604
var contentType = req.headers['content-type'];
605605
if (req.method.toLowerCase() === 'post' && contentType && contentType.indexOf('multipart/form-data') >= 0) {
606+
if (!req.session?.uid || Date.now() > req.session?.expires) {
607+
res.status(401).send('Unauthorized');
608+
return;
609+
}
606610
var form = new formidable.IncomingForm();
607611
form.uploadDir = __dirname + '/uploads';
608612
form.parse(req, function(err, fields, files) {

0 commit comments

Comments
 (0)