-
Notifications
You must be signed in to change notification settings - Fork 2.1k
PrismaMssql does not respect value escaping in connection string #28932
Description
Bug description
Before migrating to v7 and using the PrismaMssql adapter, my connection string worked with an escaped password. Since migrating the password failed as it was interpreting the {} as password characters.
My production database password has a semicolon in it, I could request that it be changed to one without ; or = as these are the characters I believe are causing the parsing error, but it was working before and the docs still recommend escaping (https://www.prisma.io/docs/orm/overview/databases/sql-server#connection-details).
Severity
Reproduction
Scenario 1
- Attempt to configure a database connection with the Mssql driver adapter with an escaped password
{password} - Observe that a password with no special characters fails to authenticate
- Unescape the password and observe successful authentication
Scenario 2
- Attempt to configure a database connection with the Mssql driver adapter with an escaped password containing a semicolon
{pass;word} - Observe an error trying to
.trim()undefined as the code here (https://github.com/prisma/prisma/blob/main/packages/adapter-mssql/src/connection-string.ts#L57) does not respect the escape syntax before attempting to parse the string
Expected vs. Actual Behavior
Expected: Connection string with format sqlserver://domain:3342;database=database-name;user=prod-user;password={pass;word};encrypt=true;trustServerCertificate=true should work as it did in v6.
Actual: a password with no semicolon simply fails to authenticate. A password with a semicolon causes an error here https://github.com/prisma/prisma/blob/main/packages/adapter-mssql/src/connection-string.ts#L88
Frequency
Consistently reproducible
Does this occur in development or production?
Both development and production
Is this a regression?
Yes, worked in v6.
Workaround
Change password or use config object (would require I create env vars for the connection string for defineConfig and then duplicate them separated for PrismaClient).
Prisma Schema & Queries
Not relevant
Prisma Config
import { defineConfig } from 'prisma/config';
export default defineConfig({
schema: 'prisma/schema.prisma',
datasource: {
url: process.env.DATABASE_URL!,
},
});Logs & Debug Info
// Debug logs here
Environment & Setup
- OS: Linux
- Database: Mssql
- Node.js version: 24
Prisma Version
7.1.0