parameter check on project_id

This commit is contained in:
Brian Gough 2016-03-31 12:12:25 +01:00
parent 01d7a59dfd
commit 2f15adaf47

View file

@ -36,6 +36,12 @@ app.use (req, res, next) ->
res.setTimeout TIMEOUT res.setTimeout TIMEOUT
next() next()
app.param 'project_id', (req, res, next, project_id) ->
if project_id?.match /^[a-zA-Z0-9_-]+$/
next()
else
next new Error("invalid project id")
app.post "/project/:project_id/compile", bodyParser.json(limit: "5mb"), CompileController.compile app.post "/project/:project_id/compile", bodyParser.json(limit: "5mb"), CompileController.compile
app.delete "/project/:project_id", CompileController.clearCache app.delete "/project/:project_id", CompileController.clearCache