Skip to content

Commit fb7b5c3

Browse files
authored
FIX: Connection String Param for Authentication (#368)
### Work Item / Issue Reference <!-- IMPORTANT: Please follow the PR template guidelines below. For mssql-python maintainers: Insert your ADO Work Item ID below (e.g. AB#37452) For external contributors: Insert Github Issue number below (e.g. #149) Only one reference is required - either GitHub issue OR ADO Work Item. --> <!-- mssql-python maintainers: ADO Work Item --> > [AB#40945](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/40945) <!-- External contributors: GitHub Issue --> > GitHub Issue: #362 ------------------------------------------------------------------- ### Summary This pull request updates the logic for filtering sensitive parameters in the authentication module. The main change is that the function now removes `Trusted_Connection` instead of `Encrypt` and `TrustServerCertificate`, and the corresponding test has been updated to reflect this new behavior. Sensitive parameter filtering update: * In `mssql_python/auth.py`, the `remove_sensitive_params` function now excludes `trusted_connection` instead of `encrypt` and `trustservercertificate` when filtering parameters. Test updates for new filtering logic: * In `tests/test_008_auth.py`, the test for `remove_sensitive_params` has been updated to expect that `Encrypt` and `TrustServerCertificate` are no longer removed, while `Trusted_Connection` is now excluded.
1 parent 907b364 commit fb7b5c3

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

mssql_python/auth.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ def remove_sensitive_params(parameters: List[str]) -> List[str]:
165165
exclude_keys = [
166166
"uid=",
167167
"pwd=",
168-
"encrypt=",
169-
"trustservercertificate=",
168+
"trusted_connection=",
170169
"authentication=",
171170
]
172171
result = [

tests/test_008_auth.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,15 +309,17 @@ def test_remove_sensitive_parameters(self):
309309
"Encrypt=yes",
310310
"TrustServerCertificate=yes",
311311
"Authentication=ActiveDirectoryDefault",
312+
"Trusted_Connection=yes",
312313
"Database=testdb",
313314
]
314315
filtered_params = remove_sensitive_params(params)
315316
assert "Server=test" in filtered_params
316317
assert "Database=testdb" in filtered_params
317318
assert "UID=user" not in filtered_params
318319
assert "PWD=password" not in filtered_params
319-
assert "Encrypt=yes" not in filtered_params
320-
assert "TrustServerCertificate=yes" not in filtered_params
320+
assert "Encrypt=yes" in filtered_params
321+
assert "TrustServerCertificate=yes" in filtered_params
322+
assert "Trusted_Connection=yes" not in filtered_params
321323
assert "Authentication=ActiveDirectoryDefault" not in filtered_params
322324

323325

0 commit comments

Comments
 (0)