mirror of
https://github.com/sasjs/server.git
synced 2026-01-09 15:30:05 +00:00
chore: quick fix
This commit is contained in:
@@ -24,8 +24,12 @@ LDAP_BIND_PASSWORD = <password>
|
|||||||
LDAP_USERS_BASE_DN = <ou=users,dc=cloudron>
|
LDAP_USERS_BASE_DN = <ou=users,dc=cloudron>
|
||||||
LDAP_GROUPS_BASE_DN = <ou=groups,dc=cloudron>
|
LDAP_GROUPS_BASE_DN = <ou=groups,dc=cloudron>
|
||||||
|
|
||||||
MAX_WRONG_ATTEMPTS_BY_IP_PER_DAY=[100] default value is 100
|
|
||||||
MAX_CONSECUTIVE_FAILS_BY_USERNAME_AND_IP=[10] default value is 10
|
MAX_WRONG_ATTEMPTS_BY_IP_PER_DAY=100
|
||||||
|
#default value is 100
|
||||||
|
|
||||||
|
MAX_CONSECUTIVE_FAILS_BY_USERNAME_AND_IP=10
|
||||||
|
#default value is 10
|
||||||
|
|
||||||
RUN_TIMES=[sas,js,py | js,py | sas | sas,js] default considered as sas
|
RUN_TIMES=[sas,js,py | js,py | sas | sas,js] default considered as sas
|
||||||
SAS_PATH=/opt/sas/sas9/SASHome/SASFoundation/9.4/sas
|
SAS_PATH=/opt/sas/sas9/SASHome/SASFoundation/9.4/sas
|
||||||
|
|||||||
@@ -63,12 +63,12 @@ export class RateLimiter {
|
|||||||
// Check if IP or Username + IP is already blocked
|
// Check if IP or Username + IP is already blocked
|
||||||
if (
|
if (
|
||||||
resSlowByIP !== null &&
|
resSlowByIP !== null &&
|
||||||
resSlowByIP.consumedPoints >= this.maxWrongAttemptsByIpPerDay
|
resSlowByIP.consumedPoints > this.maxWrongAttemptsByIpPerDay
|
||||||
) {
|
) {
|
||||||
return Math.ceil(resSlowByIP.msBeforeNext / 1000)
|
return Math.ceil(resSlowByIP.msBeforeNext / 1000)
|
||||||
} else if (
|
} else if (
|
||||||
resUsernameAndIP !== null &&
|
resUsernameAndIP !== null &&
|
||||||
resUsernameAndIP.consumedPoints >= this.maxConsecutiveFailsByUsernameAndIp
|
resUsernameAndIP.consumedPoints > this.maxConsecutiveFailsByUsernameAndIp
|
||||||
) {
|
) {
|
||||||
return Math.ceil(resUsernameAndIP.msBeforeNext / 1000)
|
return Math.ceil(resUsernameAndIP.msBeforeNext / 1000)
|
||||||
}
|
}
|
||||||
@@ -98,6 +98,10 @@ export class RateLimiter {
|
|||||||
if (rlRejected instanceof Error) {
|
if (rlRejected instanceof Error) {
|
||||||
throw rlRejected
|
throw rlRejected
|
||||||
} else {
|
} else {
|
||||||
|
// based upon the implementation of consume method of RateLimiterMongo
|
||||||
|
// we are sure that rlRejected will contain msBeforeNext
|
||||||
|
// for further reference,
|
||||||
|
// see https://github.com/animir/node-rate-limiter-flexible/wiki/Overall-example#login-endpoint-protection
|
||||||
return Math.ceil(rlRejected.msBeforeNext / 1000)
|
return Math.ceil(rlRejected.msBeforeNext / 1000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user