forked from claw/flaskpaste
tests: fix mypy type errors in security tests
This commit is contained in:
@@ -565,7 +565,7 @@ def is_trusted_proxy() -> bool:
|
||||
Result is cached per-request in Flask's g object for efficiency.
|
||||
"""
|
||||
if hasattr(g, "_trusted_proxy"):
|
||||
return g._trusted_proxy
|
||||
return bool(g._trusted_proxy)
|
||||
|
||||
expected = current_app.config.get("TRUSTED_PROXY_SECRET", "")
|
||||
if not expected:
|
||||
@@ -573,7 +573,7 @@ def is_trusted_proxy() -> bool:
|
||||
return True
|
||||
provided = request.headers.get("X-Proxy-Secret", "")
|
||||
g._trusted_proxy = hmac.compare_digest(expected, provided)
|
||||
return g._trusted_proxy
|
||||
return bool(g._trusted_proxy)
|
||||
|
||||
|
||||
def get_client_fingerprint() -> str | None:
|
||||
|
||||
Reference in New Issue
Block a user