[misc] apply review feedback
- move setting into clsi.docker namespace - rename the variable for images to allowedImages / ALLOWED_IMAGES - add an additional check for the image name into the DockerRunner Co-Authored-By: Brian Gough <brian.gough@overleaf.com>
This commit is contained in:
@@ -220,8 +220,10 @@ module.exports = CompileController = {
|
||||
const { image } = req.query
|
||||
if (
|
||||
image &&
|
||||
Settings.allowedImageNamesFlat &&
|
||||
Settings.allowedImageNamesFlat.indexOf(image) === -1
|
||||
Settings.clsi &&
|
||||
Settings.clsi.docker &&
|
||||
Settings.clsi.docker.allowedImages &&
|
||||
!Settings.clsi.docker.allowedImages.includes(image)
|
||||
) {
|
||||
return res.status(400).send('invalid image')
|
||||
}
|
||||
|
||||
@@ -91,6 +91,13 @@ module.exports = DockerRunner = {
|
||||
image = `${Settings.texliveImageNameOveride}/${img[2]}`
|
||||
}
|
||||
|
||||
if (
|
||||
Settings.clsi.docker.allowedImages &&
|
||||
!Settings.clsi.docker.allowedImages.includes(image)
|
||||
) {
|
||||
return callback(new Error('image not allowed'))
|
||||
}
|
||||
|
||||
const options = DockerRunner._getContainerOptions(
|
||||
command,
|
||||
image,
|
||||
|
||||
@@ -61,7 +61,13 @@ module.exports = RequestParser = {
|
||||
response.imageName = this._parseAttribute(
|
||||
'imageName',
|
||||
compile.options.imageName,
|
||||
{ type: 'string', validValues: settings.allowedImageNamesFlat }
|
||||
{
|
||||
type: 'string',
|
||||
validValues:
|
||||
settings.clsi &&
|
||||
settings.clsi.docker &&
|
||||
settings.clsi.docker.allowedImages
|
||||
}
|
||||
)
|
||||
response.draft = this._parseAttribute('draft', compile.options.draft, {
|
||||
default: false,
|
||||
|
||||
Reference in New Issue
Block a user