Implement constant time equal check for admin, 2fa recover and 2fa remember tokens

This commit is contained in:
Daniel García committed 2019-02-11 23:45:55 +01:00
1 parent bbe2a1b264
commit 9636f33fdb
4 files changed
+13 -3

No files matched your search

+1 -1
View File
@@ -89,7 +89,7 @@ fn post_admin_login(data: Form<LoginForm>, mut cookies: Cookies, ip: ClientIp) -
fn _validate_token(token: &str) -> bool {
match CONFIG.admin_token().as_ref() {
None => false,
Some(t) => t == token,
Some(t) => crate::crypto::ct_eq(t, token),
}
}