Skip to content

Commit

Permalink
Make lockdown even less friendly
Browse files Browse the repository at this point in the history
* Second usage
* Autoban comes much sooner for bad actors


Post OpenUserJS#944 OpenUserJS#1548
  • Loading branch information
Martii committed Dec 4, 2022
1 parent ad7574c commit b1a5e57
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ var installRateLimiter = rateLimit({
}
});

var install1Limiter = lockdown ? installCapLimiter : installRateLimiter;
var install2Limiter = lockdown ? installRateLimiter : installCapLimiter;

var waitRateMetaSec = isDev ? 30 : 60;
var metaRateLimiter = rateLimit({
store: (isDev ? undefined : new MongoStore({
Expand Down Expand Up @@ -450,7 +453,7 @@ module.exports = function (aApp) {
aRes.redirect(301, '/users/' + aReq.params.username + '/scripts'); // NOTE: Watchpoint
});

aApp.route('/install/:username/:scriptname').get(installRateLimiter, installCapLimiter, scriptStorage.unlockScript, scriptStorage.sendScript);
aApp.route('/install/:username/:scriptname').get(install1Limiter, install2Limiter, scriptStorage.unlockScript, scriptStorage.sendScript);

aApp.route('/meta/:username/:scriptname').get(metaRateLimiter, scriptStorage.sendMeta);

Expand All @@ -464,7 +467,7 @@ module.exports = function (aApp) {
aApp.route('/libs/:username/:scriptname/source').get(script.lib(user.editScript));

// Raw source
aApp.route('/src/:type(scripts|libs)/:username/:scriptname').get(installRateLimiter, installCapLimiter, scriptStorage.unlockScript, scriptStorage.sendScript);
aApp.route('/src/:type(scripts|libs)/:username/:scriptname').get(install1Limiter, install2Limiter, scriptStorage.unlockScript, scriptStorage.sendScript);

// Issues routes
aApp.route('/:type(scripts|libs)/:username/:scriptname/issues/:open(open|closed|all)?').get(listRateLimiter, listCapLimiter, issue.list);
Expand Down

0 comments on commit b1a5e57

Please sign in to comment.