mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
Improve security test performance by fixing authorization delay calculation
Fix logic in delay list initialization to correctly handle zero-value settings for authorization failure delays, and update test configurations to leverage this fix. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 605cec52-e52a-4520-8af0-466d9c971344 Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Event-Id: ee25d747-8c3a-444e-8dbf-e0229eee7d31 Replit-Helium-Checkpoint-Created: true
This commit is contained in:
@@ -6,7 +6,7 @@ function init (env) {
|
||||
|
||||
const ipDelayList = {};
|
||||
|
||||
const DELAY_ON_FAIL = _.get(env, 'settings.authFailDelay') || 5000;
|
||||
const DELAY_ON_FAIL = _.get(env, 'settings.authFailDelay') ?? 5000;
|
||||
const FAIL_AGE = 60000;
|
||||
|
||||
ipDelayList.addFailedRequest = function addFailedRequest (ip) {
|
||||
|
||||
@@ -21,6 +21,7 @@ describe('Security of REST API V1', function() {
|
||||
process.env.API_SECRET = 'this is my long pass phrase';
|
||||
self.env = require('../lib/server/env')();
|
||||
self.env.settings.authDefaultRoles = 'denied';
|
||||
self.env.settings.authFailDelay = 0;
|
||||
this.wares = require('../lib/middleware/')(self.env);
|
||||
self.app = require('express')();
|
||||
self.app.enable('api');
|
||||
|
||||
Vendored
+1
@@ -36,6 +36,7 @@ function configure () {
|
||||
|
||||
env.settings.authDefaultRoles = authDefaultRoles;
|
||||
env.settings.enable = enable;
|
||||
env.settings.authFailDelay = 0;
|
||||
|
||||
return env;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user