This is an automated email from the ASF dual-hosted git repository.

robotljw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-service-center.git


The following commit(s) were added to refs/heads/master by this push:
     new 9cd4425  change brute force password retry time to 3
     new 73af862  Merge pull request #879 from tianxiaoliang/master
9cd4425 is described below

commit 9cd4425318ed1818d3d341c5888f690ac0a61fcd
Author: tian <[email protected]>
AuthorDate: Wed Mar 3 09:51:12 2021 +0800

    change brute force password retry time to 3
---
 go.mod                              |  8 ++++----
 server/service/rbac/blocker.go      |  2 +-
 server/service/rbac/blocker_test.go | 18 ------------------
 3 files changed, 5 insertions(+), 23 deletions(-)

diff --git a/go.mod b/go.mod
index 665e8c4..36914e2 100644
--- a/go.mod
+++ b/go.mod
@@ -17,12 +17,12 @@ require (
        github.com/dgrijalva/jwt-go v3.2.0+incompatible
        github.com/dustin/go-humanize v1.0.0 // indirect
        github.com/ghodss/yaml v1.0.0
-       github.com/go-chassis/cari v0.0.2-0.20210208095358-3bccdf2ce456
-       github.com/go-chassis/foundation v0.2.2
+       github.com/go-chassis/cari v0.2.0
+       github.com/go-chassis/foundation v0.3.0
        github.com/go-chassis/go-archaius v1.4.0
        github.com/go-chassis/go-chassis/v2 v2.1.1-0.20210218100404-85e04ad6bd31
-       github.com/go-chassis/kie-client v0.0.0-20210122061843-eee856b0a9af
-       github.com/golang/protobuf v1.4.2
+       github.com/go-chassis/kie-client v0.1.0
+       github.com/golang/protobuf v1.4.2 // indirect
        github.com/google/go-cmp v0.5.4 // indirect
        github.com/gorilla/websocket v1.4.2
        github.com/grpc-ecosystem/go-grpc-middleware v1.2.2 // indirect
diff --git a/server/service/rbac/blocker.go b/server/service/rbac/blocker.go
index 8d94b46..265e4dd 100644
--- a/server/service/rbac/blocker.go
+++ b/server/service/rbac/blocker.go
@@ -25,7 +25,7 @@ import (
 )
 
 const (
-       MaxAttempts = 5
+       MaxAttempts = 2
 
        BlockInterval = 1 * time.Hour
 )
diff --git a/server/service/rbac/blocker_test.go 
b/server/service/rbac/blocker_test.go
index 0111072..82e21ce 100644
--- a/server/service/rbac/blocker_test.go
+++ b/server/service/rbac/blocker_test.go
@@ -34,15 +34,6 @@ func TestCountFailure(t *testing.T) {
        assert.False(t, rbac.IsBanned("1"))
 
        rbac.CountFailure("1")
-       assert.False(t, rbac.IsBanned("1"))
-
-       rbac.CountFailure("1")
-       assert.False(t, rbac.IsBanned("1"))
-
-       rbac.CountFailure("1")
-       assert.False(t, rbac.IsBanned("1"))
-
-       rbac.CountFailure("1")
        assert.True(t, rbac.IsBanned("1"))
 
        t.Run("ban 1 more", func(t *testing.T) {
@@ -53,15 +44,6 @@ func TestCountFailure(t *testing.T) {
                assert.False(t, rbac.IsBanned("2"))
 
                rbac.CountFailure("2")
-               assert.False(t, rbac.IsBanned("2"))
-
-               rbac.CountFailure("2")
-               assert.False(t, rbac.IsBanned("2"))
-
-               rbac.CountFailure("2")
-               assert.False(t, rbac.IsBanned("2"))
-
-               rbac.CountFailure("2")
                assert.True(t, rbac.IsBanned("2"))
        })
        t.Log(rbac.BannedList()[0].ReleaseAt)

Reply via email to