chore(auth): allow six-byte internal passwords

This commit is contained in:
QiuSW
2026-07-27 15:02:44 +08:00
parent 4533df7abc
commit 2bed09eccd
7 changed files with 12 additions and 9 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ const (
MaxUsernameBytes = 128
MaxDeviceNameBytes = 128
MaxVersionBytes = 128
MinPasswordBytes = 12
MinPasswordBytes = 6
MaxPasswordBytes = 72
)
@@ -40,12 +40,15 @@ func TestBcryptRejectsInvalidCostAndOversizedPasswords(t *testing.T) {
t.Fatalf("NewBcrypt() error = %v", err)
}
oversized := strings.Repeat("x", 73)
if _, err := manager.Hash("too-short"); !errors.Is(
if _, err := manager.Hash("short"); !errors.Is(
err,
ErrInvalidPassword,
) {
t.Fatalf("Hash(short) error = %v", err)
}
if _, err := manager.Hash("sixsix"); err != nil {
t.Fatalf("Hash(six-byte password) error = %v", err)
}
if _, err := manager.Hash(oversized); !errors.Is(
err,
ErrInvalidPassword,