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
2 changes: 1 addition & 1 deletion .github/workflows/build-engine-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
name: Build
strategy:
matrix:
os: [ubuntu-latest, macos-14, windows-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
needs: parseCommand
if: ${{ needs.parseCommand.outputs.branchName != '' }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-14, windows-latest]
os: [macos-latest, windows-latest]
node: ['20.19.0']
shard: ['1/2', '2/2']
if: |
Expand Down Expand Up @@ -1044,7 +1044,7 @@ jobs:
env:
# allow Node.js to allocate at most 14GB of heap on macOS and 7GB on Windows
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
NODE_OPTIONS: "${{ matrix.os == 'macos-14' && '--max-old-space-size=14336' || '--max-old-space-size=7168' }}"
NODE_OPTIONS: "${{ matrix.os == 'macos-latest' && '--max-old-space-size=14336' || '--max-old-space-size=7168' }}"
JEST_JUNIT_SUITE_NAME: 'client/functional'
JEST_JUNIT_UNIQUE_OUTPUT_NAME: true

Expand Down Expand Up @@ -1073,7 +1073,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-14, windows-latest]
os: [macos-latest, windows-latest]
node: ['20.19.0']
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
Expand Down Expand Up @@ -1118,7 +1118,7 @@ jobs:
# Allow Node.js to allocate at most a certain amount heap on macOS and a different amount on Windows
# Note that this value should be lower than the total amount of RAM available
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
NODE_OPTIONS: "${{ matrix.os == 'macos-14' && '--max-old-space-size=14336' || '--max-old-space-size=3072' }}"
NODE_OPTIONS: "${{ matrix.os == 'macos-latest' && '--max-old-space-size=14336' || '--max-old-space-size=3072' }}"
JEST_JUNIT_SUITE_NAME: 'client/old'
JEST_JUNIT_UNIQUE_OUTPUT_NAME: true

Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-mariadb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"sideEffects": false,
"dependencies": {
"@prisma/driver-adapter-utils": "workspace:*",
"mariadb": "3.5.3"
"mariadb": "3.5.4"
},
"devDependencies": {
"@prisma/debug": "workspace:*"
Expand Down
8 changes: 4 additions & 4 deletions packages/adapter-mariadb/src/ipv6.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import { describe, expect, test } from 'vitest'
import { PrismaMariaDbAdapterFactory, rewriteConnectionString } from './mariadb'

describe('IPv6 connection strings', () => {
test('are rejected by the driver verbatim, but accepted once rewritten', () => {
test('are accepted by the driver', () => {
const connectionString = 'mariadb://user:pass@[2001:db8::1]:3306/db'

// `createPool` does not connect, but it does parse the connection string eagerly, so it
// fails on a host the driver's grammar rejects.
expect(() => mariadb.createPool(connectionString)).toThrow(/error parsing connection string/)
expect(() => mariadb.createPool(rewriteConnectionString(new URL(connectionString)).toString())).not.toThrow()
// throws on a host the driver's grammar rejects.
const pool = mariadb.createPool(rewriteConnectionString(new URL(connectionString)).toString())
void pool.end()
})

test('reach a server listening on ::1', async () => {
Expand Down
9 changes: 4 additions & 5 deletions packages/adapter-mariadb/src/mariadb.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,13 @@ describe('rewriteConnectionString', () => {
})

test.each([
['mariadb://user:pass@[::1]:3306/db', 'mariadb://user:pass@%3A%3A1:3306/db'],
['mariadb://user:pass@[::1]/db', 'mariadb://user:pass@%3A%3A1/db'],
['mysql://user:pass@[::1]:3306/db', 'mariadb://user:pass@%3A%3A1:3306/db'],
['mariadb://user:pass@[::1]:3306/db', 'mariadb://user:pass@[::1]:3306/db'],
['mysql://user:pass@[::1]:3306/db', 'mariadb://user:pass@[::1]:3306/db'],
[
'mariadb://user:pass@[2001:db8::1]:3306/db?connectionLimit=10&ssl=true',
'mariadb://user:pass@2001%3Adb8%3A%3A1:3306/db?connectionLimit=10&ssl=true',
'mariadb://user:pass@[2001:db8::1]:3306/db?connectionLimit=10&ssl=true',
],
])('should percent-encode the IPv6 host of %s', (input, expected) => {
])('should keep the bracketed IPv6 host of %s', (input, expected) => {
expect(rewriteConnectionString(new URL(input)).toString()).toBe(expected)
})
})
Expand Down
14 changes: 2 additions & 12 deletions packages/adapter-mariadb/src/mariadb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,24 +368,14 @@ export function inferCapabilities(version: unknown): Capabilities {
}

/**
* Rewrites a connection string into the form the mariadb driver's own parser accepts:
*
* - `mysql://` is rewritten to `mariadb://`, so that users can point the MariaDB adapter
* at a `mysql://` connection string.
* - The colons of a bracketed IPv6 host are percent-encoded. The driver's connection
* string grammar forbids colons in the host, so `[::1]` never matches and the whole
* string is rejected; it does run the host through `decodeURIComponent`, so an encoded
* host round-trips to the correct address.
* Rewrites `mysql://` to `mariadb://`, so that users can point the MariaDB adapter at a
* `mysql://` connection string.
*/
export function rewriteConnectionString(url: URL): URL {
if (url.protocol === 'mysql:') {
url.protocol = 'mariadb:'
}

if (url.hostname.startsWith('[') && url.hostname.endsWith(']')) {
url.hostname = encodeURIComponent(url.hostname.slice(1, -1))
}

return url
}

Expand Down
31 changes: 12 additions & 19 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ overrides:
'@azure/msal-node>uuid': '>=14.0.0'
fast-uri@<3.1.6: '>=3.1.6 <4'
ws@>=8.0.0 <8.20.1: '>=8.20.1'
source-map-js@<1.2.2: '>=1.2.2 <2'

# No patched release exists. Neither is reachable with attacker input: fast-glob in client-generator-ts only expands the
# user's own output path, and tedious only passes its own constant format strings to sprintf-js.
auditConfig:
ignoreGhsas:
- GHSA-vfj7-8cjw-p6xm # braces
- GHSA-hp3w-g68c-fv3c # sprintf-js

peerDependencyRules:
allowedVersions:
Expand Down
Loading