Fossil SCM

Fix the password reset request form so that it passes CSRF security tests.

drh 2023-10-25 12:19 trunk
Commit ce8598b6c1e1336c88f7bfd40d842a40006baa69e98e5b4101ab84d371bcb4d2
1 file changed +5 -1
+5 -1
--- src/login.c
+++ src/login.c
@@ -2261,13 +2261,17 @@
22612261
return;
22622262
}
22632263
zEAddr = PDT("ea","");
22642264
22652265
/* Verify user imputs */
2266
- if( !cgi_csrf_safe(2) || P("reqpwreset")==0 ){
2266
+ if( !cgi_csrf_safe(1) || P("reqpwreset")==0 ){
22672267
/* This is the initial display of the form. No processing or error
22682268
** checking is to be done. Fall through into the form display
2269
+ **
2270
+ ** cgi_csrf_safe(): Nothing interesting happens on this page without
2271
+ ** a valid captcha solution, so we only need to check referrer and that
2272
+ ** the request is a POST.
22692273
*/
22702274
}else if( (captchaIsCorrect = captcha_is_correct(1))==0 ){
22712275
iErrLine = 2;
22722276
zErr = "Incorrect CAPTCHA";
22732277
}else if( zEAddr[0]==0 ){
22742278
--- src/login.c
+++ src/login.c
@@ -2261,13 +2261,17 @@
2261 return;
2262 }
2263 zEAddr = PDT("ea","");
2264
2265 /* Verify user imputs */
2266 if( !cgi_csrf_safe(2) || P("reqpwreset")==0 ){
2267 /* This is the initial display of the form. No processing or error
2268 ** checking is to be done. Fall through into the form display
 
 
 
 
2269 */
2270 }else if( (captchaIsCorrect = captcha_is_correct(1))==0 ){
2271 iErrLine = 2;
2272 zErr = "Incorrect CAPTCHA";
2273 }else if( zEAddr[0]==0 ){
2274
--- src/login.c
+++ src/login.c
@@ -2261,13 +2261,17 @@
2261 return;
2262 }
2263 zEAddr = PDT("ea","");
2264
2265 /* Verify user imputs */
2266 if( !cgi_csrf_safe(1) || P("reqpwreset")==0 ){
2267 /* This is the initial display of the form. No processing or error
2268 ** checking is to be done. Fall through into the form display
2269 **
2270 ** cgi_csrf_safe(): Nothing interesting happens on this page without
2271 ** a valid captcha solution, so we only need to check referrer and that
2272 ** the request is a POST.
2273 */
2274 }else if( (captchaIsCorrect = captcha_is_correct(1))==0 ){
2275 iErrLine = 2;
2276 zErr = "Incorrect CAPTCHA";
2277 }else if( zEAddr[0]==0 ){
2278

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button