[misc] wordcount: restrict image to an allow list and add tests
This commit is contained in:
@@ -218,6 +218,13 @@ module.exports = CompileController = {
|
||||
const { project_id } = req.params
|
||||
const { user_id } = req.params
|
||||
const { image } = req.query
|
||||
if (
|
||||
image &&
|
||||
Settings.allowedImageNamesFlat &&
|
||||
Settings.allowedImageNamesFlat.indexOf(image) === -1
|
||||
) {
|
||||
return res.status(400).send('invalid image')
|
||||
}
|
||||
logger.log({ image, file, project_id }, 'word count request')
|
||||
|
||||
return CompileManager.wordcount(project_id, user_id, file, image, function(
|
||||
|
||||
Reference in New Issue
Block a user