Increase entropy for MFA secret (#14290)
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
50821d1a34
Коммит
ad68af10df
@@ -4,7 +4,6 @@
|
||||
package mfa
|
||||
|
||||
import (
|
||||
b32 "encoding/base32"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@@ -18,6 +17,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// This will result in 160 bits of entropy (base32 encoded), as recommended by rfc4226.
|
||||
MFA_SECRET_SIZE = 20
|
||||
)
|
||||
|
||||
@@ -58,7 +58,7 @@ func (m *Mfa) GenerateSecret(user *model.User) (string, []byte, *model.AppError)
|
||||
|
||||
issuer := getIssuerFromUrl(*m.ConfigService.Config().ServiceSettings.SiteURL)
|
||||
|
||||
secret := b32.StdEncoding.EncodeToString([]byte(model.NewRandomString(MFA_SECRET_SIZE)))
|
||||
secret := model.NewRandomBase32String(MFA_SECRET_SIZE)
|
||||
|
||||
authLink := fmt.Sprintf("otpauth://totp/%s:%s?secret=%s&issuer=%s", issuer, user.Email, secret, issuer)
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user