Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/eff-212-secure-mssql-transport.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@effect/sql-mssql": patch
---

**Breaking:** Secure Microsoft SQL Server connections by default by enabling encryption and validating server certificates.

Users connecting to SQL Server instances without TLS must now explicitly set `encrypt: false`. Users connecting with untrusted or self-signed certificates must explicitly set `trustServer: true`.
10 changes: 8 additions & 2 deletions packages/sql/mssql/src/MssqlClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,13 @@ export interface MssqlClientConfig {
readonly domain?: string | undefined
readonly server: string
readonly instanceName?: string | undefined
/**
* Whether to encrypt traffic between the client and server. Defaults to `true`. Setting this to `false` disables transport encryption and transmits credentials in cleartext.
*/
readonly encrypt?: boolean | undefined
/**
* Whether to trust the server certificate without validating it. Defaults to `false`. Setting this to `true` disables TLS certificate validation.
*/
readonly trustServer?: boolean | undefined
readonly port?: number | undefined
readonly authType?: string | undefined
Expand Down Expand Up @@ -284,15 +290,15 @@ export const make = (
options: {
port: options.port,
database: options.database,
trustServerCertificate: options.trustServer ?? true,
trustServerCertificate: options.trustServer ?? false,
multiSubnetFailover: options.multiSubnetFailover,
connectTimeout: options.connectTimeout
? Duration.toMillis(Duration.fromInputUnsafe(options.connectTimeout))
: undefined,
rowCollectionOnRequestCompletion: true,
useColumnNames: false,
instanceName: options.instanceName,
encrypt: options.encrypt ?? false,
encrypt: options.encrypt ?? true,
cancelTimeout: options.cancelTimeout
? Duration.toMillis(Duration.fromInputUnsafe(options.cancelTimeout))
: undefined,
Expand Down
Loading