Skip to content

CHORE: use Server=localhost in dummy test/benchmark connection strings - #703

Merged
Jahnvi Thakkar (jahnvi480) merged 1 commit into
mainfrom
jahnvi/test-connstr-localhost
Aug 5, 2026
Merged

CHORE: use Server=localhost in dummy test/benchmark connection strings#703
Jahnvi Thakkar (jahnvi480) merged 1 commit into
mainfrom
jahnvi/test-connstr-localhost

Conversation

@jahnvi480

@jahnvi480 Jahnvi Thakkar (jahnvi480) commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

The 1ES SQL-credential push-protection detector (SEC101/037 SqlLegacyCredentials) flags dummy UID/PWD connection strings whose Server points at a non-local host, blocking the GitHub → ADO mirror sync. This changes only the flagged occurrences to Server=localhost, which is the repo convention for committed dummy credentials (see .github/copilot-instructions.md).

No behavior change: the affected tests are fully mocked and none of their assertions depend on the server value; the benchmark line is a docstring usage example.

Changed lines (7 total, Server=<host>Server=localhost):

  • tests/test_008_auth.py — 3 lines (1666, 2935, 3339)
  • tests/test_024_bulkcopy_arrow.py — 3 lines (239, 364, 400)
  • benchmarks/bench_bulkcopy_arrow.py — 1 line (23, docstring example)

Identical but unflagged connection strings elsewhere in these files were intentionally left untouched to keep the diff minimal.

AB#46836

The 1ES SQL-credential push-protection detector (SEC101/037) flags dummy UID/PWD connection strings whose Server points at a non-local host, blocking the GitHub->ADO mirror. Change only the flagged occurrences to Server=localhost (repo convention for committed dummy credentials); the affected assertions do not depend on the server value.
Copilot AI lite review requested due to automatic review settings August 5, 2026 11:49
@github-actions github-actions Bot added the pr-size: small Minimal code update label Aug 5, 2026
Comment thread benchmarks/bench_bulkcopy_arrow.py Dismissed
Comment thread tests/test_008_auth.py Dismissed
Comment thread tests/test_008_auth.py Dismissed
Comment thread tests/test_008_auth.py Dismissed
Comment thread tests/test_024_bulkcopy_arrow.py Dismissed
Comment thread tests/test_024_bulkcopy_arrow.py Dismissed
Comment thread tests/test_024_bulkcopy_arrow.py Dismissed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates committed dummy SQL authentication connection strings (those containing UID/PWD) to use Server=localhost, aligning with the repo’s credential-scanning convention and avoiding SEC101/037 SqlLegacyCredentials push-protection blocks during GitHub → ADO mirror sync. The changes are confined to mocked tests and a benchmark docstring example, so runtime behavior should be unchanged.

Changes:

  • Replace Server=<non-local> with Server=localhost in mocked test connection strings in auth and bulkcopy-arrow test suites.
  • Update the benchmark usage example connection string to use Server=localhost.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
tests/test_008_auth.py Adjusts dummy SQL-auth connection strings in unit tests to use Server=localhost.
tests/test_024_bulkcopy_arrow.py Adjusts mocked bulkcopy-arrow unit-test connection strings to use Server=localhost.
benchmarks/bench_bulkcopy_arrow.py Updates the PowerShell usage example connection string to use Server=localhost.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

📊 Code Coverage Report

🔥 Diff Coverage

100%


🎯 Overall Coverage

81%


📈 Total Lines Covered: 7357 out of 8973
📁 Project: mssql-python


Diff Coverage

Diff: main...HEAD, staged and unstaged changes

No lines with coverage information in this diff.


📋 Files Needing Attention

📉 Files with overall lowest coverage (click to expand)
mssql_python.pybind.logger_bridge.cpp: 59.2%
mssql_python.pybind.ddbc_bindings.h: 59.9%
mssql_python.pybind.logger_bridge.hpp: 70.8%
mssql_python.pybind.ddbc_bindings.cpp: 76.2%
mssql_python.__init__.py: 77.6%
mssql_python.row.py: 77.6%
mssql_python.ddbc_bindings.py: 79.6%
mssql_python.pybind.connection.connection_pool.cpp: 81.4%
mssql_python.pybind.connection.connection.cpp: 83.7%
mssql_python.logging.py: 85.5%

🔗 Quick Links

⚙️ Build Summary 📋 Coverage Details

View Azure DevOps Build

Browse Full Coverage Report

@jahnvi480
Jahnvi Thakkar (jahnvi480) merged commit 83d1608 into main Aug 5, 2026
34 checks passed
Jahnvi Thakkar (jahnvi480) added a commit that referenced this pull request Aug 5, 2026
#704)

### Summary

Follow-up to #703. When the GitHub → ADO mirror re-pushes the modified
test blobs, the 1ES SQL-credential push-protection detector (`SEC101/037
SqlLegacyCredentials`) re-scans the whole file and flags the
**remaining** dummy `UID`/`PWD` connection strings whose `Server` points
at a non-local host — not just the 7 lines fixed in #703.

This sanitizes all such strings in the two affected test files to
`Server=localhost`, which is the repo convention for committed dummy
credentials (`.github/copilot-instructions.md`).

No behavior change: every affected test is fully mocked
(`@patch(...ddbc_bindings.Connection)` / `mssql_python.cursor`) and none
of the assertions depend on the server value — they assert on pool keys,
token factories, `connection_str` sanitization, and cleanup.

Scope (15 lines, `Server=<host>` → `Server=localhost`):
- `tests/test_008_auth.py` — 11 strings (`Server=test` / `Server=s`)
- `tests/test_024_bulkcopy_arrow.py` — 4 strings (`Server=testhost`)

Intentionally left unchanged:
- UID-only AD/MSI lines (no password → not a `SqlLegacyCredentials`
match).
- `tests/test_010_*` / `tests/test_012_*` connection-string-parser
tests, where the `tcp:server.database.windows.net` value is integral to
what the parser test exercises.
- Pipeline YAMLs, which use variables (`$(DB_PASSWORD)`, `$SQL_IP`) or
`localhost`/`(localdb)`/`127.0.0.1`.


[AB#46836](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/46836)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-size: small Minimal code update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants