--- /dev/null
+.. change::
+ :tags: bug, mssql
+ :tickets: 5373
+
+ Fixed issue with assembling the ODBC connection string for the pyodbc
+ DBAPI. Tokens containing semicolons and/or braces "{}" were not being
+ correctly escaped, causing the ODBC driver to misinterpret the
+ connection string attributes.
\ No newline at end of file
def test_pyodbc_token_injection(self):
token1 = "someuser%3BPORT%3D50001"
- token2 = "somepw%3BPORT%3D50001"
+ token2 = "some{strange}pw%3BPORT%3D50001"
token3 = "somehost%3BPORT%3D50001"
token4 = "somedb%3BPORT%3D50001"
[
[
"DRIVER={foob};Server=somehost%3BPORT%3D50001;"
- "Database=somedb%3BPORT%3D50001;UID='someuser;PORT=50001';"
- "PWD='somepw;PORT=50001'"
+ "Database=somedb%3BPORT%3D50001;UID={someuser;PORT=50001};"
+ "PWD={some{strange}}pw;PORT=50001}"
],
{},
],