Add back checkBlacklist middleware
This commit is contained in:
12
server/middleware/checkBlacklist.js
Normal file
12
server/middleware/checkBlacklist.js
Normal 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
|
Reference in New Issue
Block a user