You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f3e34e6
Browse filesBrowse the repository at this point in the historyBrowse files
FIX: Remove credential exposure from CI/CD pipelines (#715)
### Work Item / Issue Reference
<!--
IMPORTANT: Please follow the PR template guidelines below.
For mssql-python maintainers: Insert your ADO Work Item ID below
For external contributors: Insert Github Issue number below
Only one reference is required - either GitHub issue OR ADO Work Item.
-->
<!-- mssql-python maintainers: ADO Work Item -->
>
[AB#46465](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/46465)
<!-- External contributors: GitHub Issue -->
> GitHub Issue: #<ISSUE_NUMBER>
-------------------------------------------------------------------
### Summary
<!-- Insert your summary of changes below. Minimum 10 characters
required. -->
This pull request improves the handling of sensitive credentials and
environment variables for SQL Server setup and testing across
development scripts and CI pipelines. The changes enhance security by
avoiding plaintext password exposure, standardize environment variable
usage, and make scripts more robust and portable.
Temporary credential files now use owner-only permissions, unique names
where applicable, termination-safe cleanup, and fail-closed deletion.
SQL Server setup configuration paths are quoted so temporary directories
containing spaces remain supported.
**Credential Management and Security Improvements:**
* In `.devcontainer/post-create.sh`, SQL Server passwords are now
written to a secure temporary environment file (`umask 077`), and the
credentials are kept in a user-only file (`~/.mssql_python_env`). The
script also removes plaintext credentials from `/etc/environment` and
shell RC files, and ensures credentials are sourced securely in new
shell sessions.
[[1]](diffhunk://#diff-bcf66a848607b49d2a45edfad434f6808017ee9d18f5a20dde6670745010d89aR54-R58)
[[2]](diffhunk://#diff-bcf66a848607b49d2a45edfad434f6808017ee9d18f5a20dde6670745010d89aL88-R102)
* Docker containers for SQL Server in CI pipelines now receive passwords
via environment variables (`MSSQL_SA_PASSWORD`, `SQLCMDPASSWORD`)
instead of command-line arguments, reducing the risk of leaking secrets
in process lists or logs.
[[1]](diffhunk://#diff-3be0faed094a0cc74e9ec006d00e54b2f4178571f1f7eb13de87467df606f86aL202-R215)
[[2]](diffhunk://#diff-3be0faed094a0cc74e9ec006d00e54b2f4178571f1f7eb13de87467df606f86aR229-R230)
[[3]](diffhunk://#diff-0dd29b7d361d605955e0542e840b8f59473bb2f9b623712bf8b3bc5da865ddc6L168-R183)
[[4]](diffhunk://#diff-09b6212130ccaeeb948dc695662528e4480836a4d8dc18f56b1d946060746c5bL260-R277)
**Pipeline and Script Robustness:**
* Shell scripts in CI pipelines (`build-linux-single-stage.yml`,
`stress-test-pipeline.yml`) have been updated to use stricter error
handling (`set -euo pipefail`) for improved reliability and easier
debugging.
[[1]](diffhunk://#diff-3be0faed094a0cc74e9ec006d00e54b2f4178571f1f7eb13de87467df606f86aL139-R139)
[[2]](diffhunk://#diff-3be0faed094a0cc74e9ec006d00e54b2f4178571f1f7eb13de87467df606f86aL173-R173)
[[3]](diffhunk://#diff-3be0faed094a0cc74e9ec006d00e54b2f4178571f1f7eb13de87467df606f86aL184-R184)
[[4]](diffhunk://#diff-3be0faed094a0cc74e9ec006d00e54b2f4178571f1f7eb13de87467df606f86aL259-R261)
[[5]](diffhunk://#diff-3be0faed094a0cc74e9ec006d00e54b2f4178571f1f7eb13de87467df606f86aL272-R275)
[[6]](diffhunk://#diff-3be0faed094a0cc74e9ec006d00e54b2f4178571f1f7eb13de87467df606f86aL340-R343)
[[7]](diffhunk://#diff-3be0faed094a0cc74e9ec006d00e54b2f4178571f1f7eb13de87467df606f86aL421-R423)
[[8]](diffhunk://#diff-09b6212130ccaeeb948dc695662528e4480836a4d8dc18f56b1d946060746c5bL260-R277)
**Cross-Platform and Pipeline Consistency:**
* Windows and Linux pipelines now consistently use environment variables
for passing sensitive information to SQL Server and `sqlcmd`, including
for database and user creation. This includes changes to how PowerShell
scripts interpolate passwords, and how SQL Server is
installed/configured on Windows using a secure configuration file.
[[1]](diffhunk://#diff-b134d9c8339176b133043f7c9407b630a17f96f764c7b88106599f4b27a26d85L172-R172)
[[2]](diffhunk://#diff-09b6212130ccaeeb948dc695662528e4480836a4d8dc18f56b1d946060746c5bL106-R106)
[[3]](diffhunk://#diff-09b6212130ccaeeb948dc695662528e4480836a4d8dc18f56b1d946060746c5bL116-R116)
[[4]](diffhunk://#diff-09b6212130ccaeeb948dc695662528e4480836a4d8dc18f56b1d946060746c5bR157-R171)
[[5]](diffhunk://#diff-09b6212130ccaeeb948dc695662528e4480836a4d8dc18f56b1d946060746c5bL282-R300)
[[6]](diffhunk://#diff-296c8f902bbd70f34ee1c8c32383c8c99165fe4c8e5b0f234f8f22246e56a621L88-R88)
[[7]](diffhunk://#diff-296c8f902bbd70f34ee1c8c32383c8c99165fe4c8e5b0f234f8f22246e56a621L115-R135)
[[8]](diffhunk://#diff-296c8f902bbd70f34ee1c8c32383c8c99165fe4c8e5b0f234f8f22246e56a621R149)
[[9]](diffhunk://#diff-296c8f902bbd70f34ee1c8c32383c8c99165fe4c8e5b0f234f8f22246e56a621L137-R158)
**Backward Compatibility and Cleanup:**
* The devcontainer script now removes legacy plaintext password files
and entries, ensuring no old credentials are left behind after upgrades.
These changes collectively make the development and CI environments more
secure and maintainable by standardizing credential handling and
improving script reliability.
<!--
### PR Title Guide
> For feature requests
FEAT: (short-description)
> For non-feature requests like test case updates, config updates ,
dependency updates etc
CHORE: (short-description)
> For Fix requests
FIX: (short-description)
> For doc update requests
DOC: (short-description)
> For Formatting, indentation, or styling update
STYLE: (short-description)
> For Refactor, without any feature changes
REFACTOR: (short-description)
> For performance improvements
PERF: (short-description)
> For release related changes, without any feature changes
RELEASE: #<RELEASE_VERSION> (short-description)
### Contribution Guidelines
External contributors:
- Create a GitHub issue first:
https://github.com/microsoft/mssql-python/issues/new
- Link the GitHub issue in the "GitHub Issue" section above
- Follow the PR title format and provide a meaningful summary
mssql-python maintainers:
- Create an ADO Work Item following internal processes
- Link the ADO Work Item in the "ADO Work Item" section above
- Follow the PR title format and provide a meaningful summary
-->
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: gargsaumya <192222169+gargsaumya@users.noreply.github.com>
0 commit comments