MySQL: with use_tls=False, 2.3.6 needs the cryptography package to log in to MySQL 8
Los mantenedores suelen responder en 5 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 74/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- mysql, python
- Área
- build-system, documentation
Línea de trabajo
Comienza en pyproject.toml, donde se declara pymysql>=1.1.1, y reemplázalo por pymysql[rsa]>=1.2.4; revisa también setup.py/setup.cfg si los metadatos están ahí. Luego añade la entrada de las notas de la versión 2.3.7 que explique que use_tls=False significa que no hay TLS desde 2.3.6 y que los inicios de sesión de MySQL 8 ahora necesitan cryptography más PyMySQL 1.2.4+. Refleja el pin en la receta de conda-forge. Terminado cuando una instalación nueva sin cryptography se conecte a un contenedor mysql:8.0 con use_tls=False y la nota esté publicada.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
Since 2.3.6, use_tls=False turns TLS off on MySQL; in 2.3.5 the connection still used TLS. Without TLS, PyMySQL needs the cryptography package to log in with MySQL 8's default authentication (caching_sha2_password) whenever the server has no cached login for the account. datajoint does not depend on cryptography, so after upgrading to 2.3.6 such a connection fails:
RuntimeError: 'cryptography' package is required for sha256_password or caching_sha2_password auth methods
The server caches a login after the account's first login over TLS or a local socket, so the error is intermittent in practice: it appears after a server restart, FLUSH PRIVILEGES, a password change, or for a new account.
Reproduction
A fresh mysql:8.0 container, use_tls = False, and a check of the session's cipher:
import datajoint as dj
dj.config["database.use_tls"] = False
conn = dj.conn(reset=True)
conn.query("SHOW SESSION STATUS LIKE 'Ssl_cipher'").fetchall()
| DataJoint | Ssl_cipher |
|---|---|
| 2.3.5 | TLS_AES_256_GCM_SHA384: TLS was used although use_tls=False |
| 2.3.6 | empty: no TLS, as configured |
The test suite of https://github.com/datajoint/dj-png-codecs shows the effect. It sets use_tls = False against a fresh MySQL 8.0 container. With datajoint 2.3.5, all tests pass. With 2.3.6, the first connection raises the RuntimeError above (https://github.com/datajoint/dj-png-codecs/pull/9).
PostgreSQL connections are not affected.
Expected
use_tls=False keeps working after an upgrade, without a dependency the user has to discover from a PyMySQL error.
PyMySQL 1.2.1 to 1.2.3
With cryptography installed, the same login still fails on PyMySQL 1.2.1, 1.2.2 and 1.2.3:
AttributeError: 'NoneType' object has no attribute 'is_auth_switch_request'
In those releases, caching_sha2_password_auth (pymysql/_auth.py) sends the RSA-encrypted password but does not return the server's reply. PyMySQL 1.2.0 and 1.2.4 return it, and the login succeeds. The dj-png-codecs suite with datajoint 2.3.6 and cryptography passes on PyMySQL 1.1.2, 1.2.0 and 1.2.4, and fails on 1.2.1 to 1.2.3.
Proposed fix
- Depend on
pymysql[rsa]>=1.2.4instead ofpymysql>=1.1.1. Thersaextra installscryptography, which PyMySQL documents as required forcaching_sha2_passwordandsha256_passwordwithout TLS. The floor leaves out 1.2.1 to 1.2.3, and keeps the fix for CVE-2024-36039 that the current floor is for. - Say in the 2.3.7 release notes that
use_tls=Falsedisables TLS since 2.3.6, and that such connections to MySQL 8 needcryptographyand PyMySQL 1.2.4 or later, which 2.3.7 installs. - Apply the same requirements in the conda-forge recipe.
- Lenguaje dominante
- Python
- Estrellas
- 198
- Forks
- 103
- Merge medio
- 5 d 1 h
- PR fusionados (30 d)
- 12
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de datajoint/datajoint-python
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
datajoint/datajoint-python#1747 ·
Los mantenedores suelen responder en 5 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
datajoint/datajoint-python#1712 ·
Los mantenedores suelen responder en 5 días
-
Decoding a <blob> value in an unknown format returns None instead of raising an errorPosiblemente ocupada @godara-alt la tomó hace 3 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
datajoint/datajoint-python#1703 ·
Los mantenedores suelen responder en 5 días
-
Character matrices with more than one row come back transposed from <blob>Posiblemente ocupada @godara-alt la tomó hace 2 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
datajoint/datajoint-python#1702 ·
Los mantenedores suelen responder en 5 días
-
staged_insert1 stores object paths with the class name and an empty store name, so garbage collection can delete its objectsPosiblemente ocupada @godara-alt la tomó hace 3 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
datajoint/datajoint-python#1701 ·
Los mantenedores suelen responder en 5 días
Todos los issues de datajoint/datajoint-python
Issues similares
-
bug game: 0100FF500E34A000 game: 0400FF500E34A001 mac packing
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 2 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
jxxghp/MoviePilot#7576 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
jbaruch/software-factory#266 ·
Los mantenedores suelen responder en 1 día
-
cron: raise a distinct error when next_fire finds no match in its search bound (from #813 item 5)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día