Skip to content

Commit

Permalink
Merge pull request #5759 from Countly/johnWeak-master
Browse files Browse the repository at this point in the history
Add session check to formdata
  • Loading branch information
ArtursKadikis authored Nov 12, 2024
2 parents b13fd02 + aff4668 commit 4e18341
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ Enterprise fixes:
- [nps] Fixed bug in the editor where the "internal name" field was not mandatory
- [ratings] Fixed UI bug where "Internal name" was not a mandatory field

Security:
- Fixing minor vulnerability that would allow for unauthorized file upload

## Version 24.05.16
Fixes:
- [core] Replaced "Users" with "Sessions" label on technology home widgets
Expand Down
4 changes: 4 additions & 0 deletions frontend/express/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,10 @@ Promise.all([plugins.dbConnection(countlyConfig), plugins.dbConnection("countly_
app.use(function(req, res, next) {
var contentType = req.headers['content-type'];
if (req.method.toLowerCase() === 'post' && contentType && contentType.indexOf('multipart/form-data') >= 0) {
if (!req.session?.uid || Date.now() > req.session?.expires) {
res.status(401).send('Unauthorized');
return;
}
var form = new formidable.IncomingForm();
form.uploadDir = __dirname + '/uploads';
form.parse(req, function(err, fields, files) {
Expand Down

0 comments on commit 4e18341

Please sign in to comment.