Skip to content

Commit 5dceab4

Browse files
authored
check debugger timeout consistently (#3020)
2 parents 44393bb + c7d2b8b commit 5dceab4

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Version 3.1.4
55

66
Unreleased
77

8+
- The debugger pin fails after 10 attempts instead of 11. :pr:`3020`
9+
810

911
Version 3.1.3
1012
-------------

src/werkzeug/debug/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,11 @@ def check_pin_trust(self, environ: WSGIEnvironment) -> bool | None:
441441
"""
442442
if self.pin is None:
443443
return True
444+
445+
# If we failed too many times, then we're locked out.
446+
if self._failed_pin_auth.value >= 10:
447+
return False
448+
444449
val = parse_cookie(environ).get(self.pin_cookie_name)
445450
if not val or "|" not in val:
446451
return False
@@ -490,7 +495,7 @@ def pin_auth(self, request: Request) -> Response:
490495
auth = True
491496

492497
# If we failed too many times, then we're locked out.
493-
elif self._failed_pin_auth.value > 10:
498+
elif self._failed_pin_auth.value >= 10:
494499
exhausted = True
495500

496501
# Otherwise go through pin based authentication

0 commit comments

Comments
 (0)