Skip to content

Commit bf4d91b

Browse files
fix: Fixed login CAPTCHA bypass vulnerability (#11185)
1 parent 781155b commit bf4d91b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

core/utils/captcha/captcha.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ import (
1010
var store = base64Captcha.DefaultMemStore
1111

1212
func VerifyCode(codeID string, code string) string {
13-
if codeID == "" {
14-
return "ErrCaptchaCode"
15-
}
1613
vv := store.Get(codeID, true)
1714
vv = strings.TrimSpace(vv)
1815
code = strings.TrimSpace(code)
19-
16+
if codeID == "" || code == "" {
17+
return "ErrCaptchaCode"
18+
}
2019
if strings.EqualFold(vv, code) {
2120
return ""
2221
}

0 commit comments

Comments
 (0)