pr_19293.patch 783 B

1234567891011121314151617
  1. --- a/services/clsi/app/js/StaticServerForbidSymlinks.js
  2. +++ b/services/clsi/app/js/StaticServerForbidSymlinks.js
  3. @@ -25,9 +25,13 @@ module.exports = ForbidSymlinks = function (staticFn, root, options) {
  4. let file, projectId, result
  5. const path = req.url
  6. // check that the path is of the form /project_id_or_name/path/to/file.log
  7. - if ((result = path.match(/^\/?([a-zA-Z0-9_-]+)\/(.*)/))) {
  8. + if ((result = path.match(/^\/([a-zA-Z0-9_-]+)\/(.*)$/s))) {
  9. projectId = result[1]
  10. file = result[2]
  11. + if (path !== `/${projectId}/${file}`) {
  12. + logger.warn({ path }, 'unrecognized file request')
  13. + return res.sendStatus(404)
  14. + }
  15. } else {
  16. logger.warn({ path }, 'unrecognized file request')
  17. return res.sendStatus(404)