Add back checkBlacklist middleware

This commit is contained in:
MICHAEL JACKSON
2017-08-16 23:03:28 -07:00
parent 1173f91091
commit b9c6c0fc61
3 changed files with 28 additions and 7 deletions

View File

@ -0,0 +1,12 @@
function checkBlacklist(blacklist) {
return function (req, res, next) {
// Do not allow packages that have been blacklisted.
if (blacklist.includes(req.packageName)) {
res.status(403).type('text').send(`Package "${req.packageName}" is blacklisted`)
} else {
next()
}
}
}
module.exports = checkBlacklist