You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ti...@apache.org on 2021/03/04 03:36:31 UTC

[servicecomb-service-center] branch v1.x updated: change brute force password retry time to 3 (#880)

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

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


The following commit(s) were added to refs/heads/v1.x by this push:
     new 651c362  change brute force password retry time to 3 (#880)
651c362 is described below

commit 651c36298e000643ebd1e000162ca3c794c5761b
Author: Shawn <xi...@gmail.com>
AuthorDate: Thu Mar 4 11:36:21 2021 +0800

    change brute force password retry time to 3 (#880)
    
    # Conflicts:
    #	go.mod
---
 server/service/rbac/blocker.go      |  2 +-
 server/service/rbac/blocker_test.go | 18 ------------------
 2 files changed, 1 insertion(+), 19 deletions(-)

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 6e77746..ce27b68 100644
--- a/server/service/rbac/blocker_test.go
+++ b/server/service/rbac/blocker_test.go
@@ -33,15 +33,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) {
@@ -52,15 +43,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)