Remove credentials from JDBC connection strings#12712
Conversation
…sources Co-authored-by: sebastienros <1165805+sebastienros@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12712Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 12712" |
Co-authored-by: sebastienros <1165805+sebastienros@users.noreply.github.com>
…ithub.com/dotnet/aspire into copilot/remove-user-password-query-params
This reverts commit 5f51981.
There was a problem hiding this comment.
Pull Request Overview
This PR removes user credentials from JDBC connection strings across all database resources (SQL Server, PostgreSQL, MySQL, Oracle). The JDBC connection strings now only contain the base connection URL, with credentials provided separately via Username and Password connection properties.
Key changes:
- JDBC connection strings simplified to exclude embedded credentials (username/password)
- All affected code, tests, documentation, and manifest files updated consistently
- XML documentation enhanced with explanatory notes about accessing credentials separately
Reviewed Changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/Aspire.Hosting.SqlServer/SqlServerServerResource.cs |
Removed user/password from JDBC string builder, moved trustServerCertificate before database name |
src/Aspire.Hosting.SqlServer/SqlServerDatabaseResource.cs |
Updated XML documentation to reflect new format without credentials |
src/Aspire.Hosting.SqlServer/README.md |
Updated documentation tables with new JDBC format and credential access explanation |
src/Aspire.Hosting.PostgreSQL/PostgresServerResource.cs |
Removed user/password query parameters from JDBC string builder |
src/Aspire.Hosting.PostgreSQL/PostgresDatabaseResource.cs |
Updated XML documentation with new format and GetConnectionProperties reference |
src/Aspire.Hosting.PostgreSQL/README.md |
Updated documentation tables with new JDBC format |
src/Aspire.Hosting.Oracle/OracleDatabaseServerResource.cs |
Removed user/password from JDBC thin client connection string |
src/Aspire.Hosting.Oracle/OracleDatabaseResource.cs |
Updated XML documentation with GetConnectionProperties reference |
src/Aspire.Hosting.Oracle/README.md |
Updated documentation tables with new JDBC format |
src/Aspire.Hosting.MySql/MySqlServerResource.cs |
Removed user/password query parameters from JDBC string builder |
src/Aspire.Hosting.MySql/MySqlDatabaseResource.cs |
Updated XML documentation with GetConnectionProperties reference |
src/Aspire.Hosting.MySql/README.md |
Updated documentation tables with new JDBC format |
tests/Aspire.Hosting.Tests/ManifestGenerationTests.cs |
Updated expected JDBC connection string in snapshot test |
tests/Aspire.Hosting.SqlServer.Tests/ConnectionPropertiesTests.cs |
Updated test assertions to match new JDBC format |
tests/Aspire.Hosting.PostgreSQL.Tests/ConnectionPropertiesTests.cs |
Updated test assertions to match new JDBC format |
tests/Aspire.Hosting.Oracle.Tests/ConnectionPropertiesTests.cs |
Updated test assertions to match new JDBC format |
tests/Aspire.Hosting.MySql.Tests/ConnectionPropertiesTests.cs |
Updated test assertions to match new JDBC format |
playground/mysql/MySqlDb.AppHost/aspire-manifest.json |
Updated manifest snapshot with new JDBC connection strings |
docs/specs/connection-properties.md |
Updated specification with new JDBC formats and explanatory note |
.github/agents/connectionproperties.agent.md |
Updated agent documentation with new JDBC format |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@sebastienros do we need to backport this? |
|
@davidfowl yes, that's why I extracted it from the other PR. Validated with Java app (postgres, including azure) |
|
/backport to release/13.0 |
|
Started backporting to release/13.0: https://github.com/dotnet/aspire/actions/runs/19121676215 |
Description
JDBC connection strings now omit
userandpasswordparameters. Credentials are provided exclusively via separateUsernameandPasswordconnection properties exposed as environment variables.Breaking Change: Applications parsing JDBC connection strings to extract credentials will break. Use the individual connection properties instead:
Changes by Database Provider
PostgreSQL
jdbc:postgresql://{Host}:{Port}[/{Database}]?user={Username}&password={Password}→jdbc:postgresql://{Host}:{Port}[/{Database}]MySQL
jdbc:mysql://{Host}:{Port}[/{Database}]?user={Username}&password={Password}→jdbc:mysql://{Host}:{Port}[/{Database}]SQL Server
jdbc:sqlserver://{Host}:{Port};user={Username};password={Password};trustServerCertificate=true[;databaseName={Database}]→jdbc:sqlserver://{Host}:{Port};trustServerCertificate=true[;databaseName={Database}]Oracle
jdbc:oracle:thin:{Username}/{Password}@//{Host}:{Port}[/{Database}]→jdbc:oracle:thin:@//{Host}:{Port}[/{Database}]Modified Components
MySqlServerResource,PostgresServerResource,SqlServerServerResource,OracleDatabaseServerResourceand their database child resourcesFixes #<issue_number>
Checklist
<remarks />and<code />elements on your triple slash comments?Original prompt
This pull request was created as a result of the following prompt from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.