summary refs log tree commit diff
diff options
context:
space:
mode:
authorJonathan de Jong <jonathan@automatia.nl>2020-10-19 19:32:24 +0200
committerGitHub <noreply@github.com>2020-10-19 18:32:24 +0100
commit21bb50ca3fd4c414405b03dbbe9124128d0f2613 (patch)
treec241bc24feee6602abb12051a4fa8104d7282b30
parentExpose the experimental appservice login flow to clients. (#8504) (diff)
downloadsynapse-21bb50ca3fd4c414405b03dbbe9124128d0f2613.tar.xz
Fix mypy error: auth handler "checkpw" internal function type mismatch (#8569)
Diffstat (limited to '')
-rw-r--r--changelog.d/8569.misc1
-rw-r--r--synapse/handlers/auth.py8
-rw-r--r--tox.ini1
3 files changed, 6 insertions, 4 deletions
diff --git a/changelog.d/8569.misc b/changelog.d/8569.misc
new file mode 100644
index 0000000000..3b6e0625e5
--- /dev/null
+++ b/changelog.d/8569.misc
@@ -0,0 +1 @@
+Fix mypy not properly checking across the codebase, additionally, fix a typing assertion error in `handlers/auth.py`.
\ No newline at end of file
diff --git a/synapse/handlers/auth.py b/synapse/handlers/auth.py
index 1d1ddc2245..8619fbb982 100644
--- a/synapse/handlers/auth.py
+++ b/synapse/handlers/auth.py
@@ -1122,20 +1122,22 @@ class AuthHandler(BaseHandler):
             Whether self.hash(password) == stored_hash.
         """
 
-        def _do_validate_hash():
+        def _do_validate_hash(checked_hash: bytes):
             # Normalise the Unicode in the password
             pw = unicodedata.normalize("NFKC", password)
 
             return bcrypt.checkpw(
                 pw.encode("utf8") + self.hs.config.password_pepper.encode("utf8"),
-                stored_hash,
+                checked_hash,
             )
 
         if stored_hash:
             if not isinstance(stored_hash, bytes):
                 stored_hash = stored_hash.encode("ascii")
 
-            return await defer_to_thread(self.hs.get_reactor(), _do_validate_hash)
+            return await defer_to_thread(
+                self.hs.get_reactor(), _do_validate_hash, stored_hash
+            )
         else:
             return False
 
diff --git a/tox.ini b/tox.ini
index 4d132eff4c..6d08153782 100644
--- a/tox.ini
+++ b/tox.ini
@@ -158,7 +158,6 @@ commands=
     coverage html
 
 [testenv:mypy]
-skip_install = True
 deps =
     {[base]deps}
     mypy==0.782