diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 1aae36233..000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: CI - -on: [push, pull_request] - -permissions: - contents: read - -jobs: - lint: - timeout-minutes: 5 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Setup node - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: yarn - - run: yarn install --frozen-lockfile - - run: yarn lint - build: - timeout-minutes: 15 - needs: lint - services: - postgres: - image: ghcr.io/railwayapp-templates/postgres-ssl - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_HOST_AUTH_METHOD: 'md5' - POSTGRES_DB: ci_db_test - ports: - - 5432:5432 - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - strategy: - fail-fast: false - matrix: - node: - - '16' - - '18' - - '20' - - '22' - - '24' - - '26' - os: - - ubuntu-latest - name: Node.js ${{ matrix.node }} - runs-on: ubuntu-latest - env: - PGUSER: postgres - PGPASSWORD: postgres - PGHOST: localhost - PGDATABASE: ci_db_test - PGTESTNOSSL: 'true' - SCRAM_TEST_PGUSER: scram_test - SCRAM_TEST_PGPASSWORD: test4scram - steps: - - name: Show OS - run: | - uname -a - - run: | - psql \ - -c "SET password_encryption = 'scram-sha-256'" \ - -c "CREATE ROLE scram_test LOGIN PASSWORD 'test4scram'" - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Setup node - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - cache: yarn - - run: yarn install --frozen-lockfile - - run: yarn test diff --git a/.github/workflows/deploy-pg-protocol.yml b/.github/workflows/deploy-pg-protocol.yml new file mode 100644 index 000000000..79401deda --- /dev/null +++ b/.github/workflows/deploy-pg-protocol.yml @@ -0,0 +1,66 @@ +name: Deploy pg-protocol package + +on: + push: + branches: + - master + paths: + - 'packages/pg-protocol/**' + - '.github/workflows/deploy-pg-protocol.yml' + workflow_dispatch: + inputs: + version: + description: 'Version to publish (optional)' + required: false + type: string + +permissions: + contents: read + id-token: write + +jobs: + deploy: + runs-on: ubuntu-latest + # IMPORTANT: install/build/publish strictly inside packages/pg-protocol/ + # to avoid touching the workspace root. The root yarn.lock contains the + # `pg-protocol: npm:@supabase/pg-protocol@^X.Y.Z` alias, which would fail + # resolution any time we bump pg-protocol's version (the new version is + # not on npm yet — that's exactly what this workflow is publishing). + # pg-protocol has no runtime deps and only TS toolchain devDeps, so + # `npm install` inside the package directory is fully self-contained. + defaults: + run: + working-directory: packages/pg-protocol + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Setup Node.js + uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 + with: + node-version: '20' + registry-url: 'https://registry.npmjs.org' + + - name: Install pg-protocol devDependencies (isolated, no workspace root) + # --workspaces=false + --prefix . is required to stop npm from + # walking up to the workspace root package.json. Without it, npm + # tries to resolve every workspace package's deps and trips on + # the unpublished `@supabase/pg-protocol@^X.Y.Z` alias in pg. + # --ignore-scripts skips lifecycle hooks (we run build explicitly + # below) so a stale tsbuildinfo can never produce an empty dist/. + run: yarn install --no-package-lock --no-audit --no-fund --workspaces=false --ignore-scripts --prefix . + + - name: Build package (clean rebuild) + # `npm run build` triggers `prebuild` which removes any stale + # `dist/` and `tsconfig.tsbuildinfo`. Without the clean step a + # checked-in tsbuildinfo (or one left by a previous run) would + # make `tsc --incremental` exit successfully with zero output — + # producing a broken tarball with no compiled code. See the + # 1.13.1 incident. + run: yarn run build + + # Ensure npm 11.5.1 or later is installed for trusted publishing support + - name: Update npm + run: npm install -g npm@latest + + - name: Publish to npm + run: npm publish diff --git a/.github/workflows/deploy-pg.yml b/.github/workflows/deploy-pg.yml new file mode 100644 index 000000000..29af67afe --- /dev/null +++ b/.github/workflows/deploy-pg.yml @@ -0,0 +1,49 @@ +name: Deploy pg package + +on: + push: + branches: + - master + paths: + - 'packages/pg/**' + - '.github/workflows/deploy-pg.yml' + workflow_dispatch: + inputs: + version: + description: 'Version to publish (optional)' + required: false + type: string + +permissions: + contents: read + id-token: write + +jobs: + deploy: + runs-on: ubuntu-latest + # IMPORTANT: do NOT run a workspace-root install here. pg's + # package.json declares `pg-protocol: npm:@supabase/pg-protocol@^X.Y.Z`, + # and any time we bump pg-protocol's version this workflow would fire + # before that version is on npm (deploy-pg-protocol.yml runs in + # parallel on the same merge commit). Workspace install would then + # fail at resolution. pg is plain JavaScript (no build step, no TS + # compile), so `npm publish` can pack the source files listed under + # the `files` field directly without resolving any dependencies. + defaults: + run: + working-directory: packages/pg + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Setup Node.js + uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 + with: + node-version: '20' + registry-url: 'https://registry.npmjs.org' + + # Ensure npm 11.5.1 or later is installed for trusted publishing support + - name: Update npm + run: npm install -g npm@latest + + - name: Publish to npm + run: npm publish diff --git a/.gitignore b/.gitignore index 8e242c10d..678070639 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ dist /.eslintcache .vscode/ manually-test-on-heroku.js +*.tsbuildinfo diff --git a/package.json b/package.json index 9285ad142..e28fa6e3b 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { - "name": "node-postgres", + "name": "@supabase/node-postgres", "description": "node postgres monorepo", "main": "index.js", "private": true, - "repository": "git@github.com:brianc/node-postgres.git", + "repository": "git@github.com:supabase/node-postgres.git", "author": "Brian M. Carlson ", "license": "MIT", "workspaces": [ @@ -39,5 +39,6 @@ "arrowParens": "always", "trailingComma": "es5", "singleQuote": true - } + }, + "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" } diff --git a/packages/pg-cloudflare/package.json b/packages/pg-cloudflare/package.json index ac68bb22e..3c95253bc 100644 --- a/packages/pg-cloudflare/package.json +++ b/packages/pg-cloudflare/package.json @@ -27,7 +27,7 @@ }, "repository": { "type": "git", - "url": "git://github.com/brianc/node-postgres.git", + "url": "git://github.com/supabase/node-postgres.git", "directory": "packages/pg-cloudflare" }, "files": [ diff --git a/packages/pg-connection-string/package.json b/packages/pg-connection-string/package.json index d02588a6c..80d519e31 100644 --- a/packages/pg-connection-string/package.json +++ b/packages/pg-connection-string/package.json @@ -18,7 +18,7 @@ }, "repository": { "type": "git", - "url": "git://github.com/brianc/node-postgres.git", + "url": "git://github.com/supabase/node-postgres.git", "directory": "packages/pg-connection-string" }, "keywords": [ @@ -30,9 +30,9 @@ "author": "Blaine Bublitz (http://iceddev.com/)", "license": "MIT", "bugs": { - "url": "https://github.com/brianc/node-postgres/issues" + "url": "https://github.com/supabase/node-postgres/issues" }, - "homepage": "https://github.com/brianc/node-postgres/tree/master/packages/pg-connection-string", + "homepage": "https://github.com/supabase/node-postgres/tree/master/packages/pg-connection-string", "devDependencies": { "@types/pg": "^8.12.0", "chai": "^4.1.1", diff --git a/packages/pg-cursor/package.json b/packages/pg-cursor/package.json index 332e51a2f..a290589bf 100644 --- a/packages/pg-cursor/package.json +++ b/packages/pg-cursor/package.json @@ -18,7 +18,7 @@ }, "repository": { "type": "git", - "url": "git://github.com/brianc/node-postgres.git", + "url": "git://github.com/supabase/node-postgres.git", "directory": "packages/pg-cursor" }, "author": "Brian M. Carlson", diff --git a/packages/pg-native/package.json b/packages/pg-native/package.json index b75b2ffdb..c51c23929 100644 --- a/packages/pg-native/package.json +++ b/packages/pg-native/package.json @@ -20,7 +20,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/brianc/node-postgres.git" + "url": "https://github.com/supabase/node-postgres.git" }, "keywords": [ "postgres", @@ -30,11 +30,11 @@ "author": "Brian M. Carlson", "license": "MIT", "bugs": { - "url": "https://github.com/brianc/node-postgres/issues" + "url": "https://github.com/supabase/node-postgres/issues" }, - "homepage": "https://github.com/brianc/node-postgres/tree/master/packages/pg-native", + "homepage": "https://github.com/supabase/node-postgres/tree/master/packages/pg-native", "dependencies": { - "libpq": "^1.11.0", + "libpq": "^1.8.15", "pg-types": "2.2.0" }, "devDependencies": { diff --git a/packages/pg-pool/package.json b/packages/pg-pool/package.json index 7ac434f97..a53ff8b5d 100644 --- a/packages/pg-pool/package.json +++ b/packages/pg-pool/package.json @@ -18,7 +18,7 @@ }, "repository": { "type": "git", - "url": "git://github.com/brianc/node-postgres.git", + "url": "git://github.com/supabase/node-postgres.git", "directory": "packages/pg-pool" }, "keywords": [ @@ -30,9 +30,9 @@ "author": "Brian M. Carlson", "license": "MIT", "bugs": { - "url": "https://github.com/brianc/node-postgres/issues" + "url": "https://github.com/supabase/node-postgres/issues" }, - "homepage": "https://github.com/brianc/node-postgres/tree/master/packages/pg-pool#readme", + "homepage": "https://github.com/supabase/node-postgres/tree/master/packages/pg-pool#readme", "devDependencies": { "bluebird": "3.7.2", "co": "4.6.0", diff --git a/packages/pg-protocol/package.json b/packages/pg-protocol/package.json index d3326bdbc..6a6ab05e8 100644 --- a/packages/pg-protocol/package.json +++ b/packages/pg-protocol/package.json @@ -1,6 +1,6 @@ { - "name": "pg-protocol", - "version": "1.13.0", + "name": "@supabase/pg-protocol", + "version": "1.13.2", "description": "The postgres client/server binary protocol, implemented in TypeScript", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -26,6 +26,8 @@ }, "scripts": { "test": "mocha dist/**/*.test.js", + "clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true});require('fs').rmSync('tsconfig.tsbuildinfo',{force:true})\"", + "prebuild": "npm run clean", "build": "tsc", "build:watch": "tsc --watch", "prepublish": "yarn build", @@ -33,7 +35,7 @@ }, "repository": { "type": "git", - "url": "git://github.com/brianc/node-postgres.git", + "url": "git://github.com/supabase/node-postgres.git", "directory": "packages/pg-protocol" }, "files": [ diff --git a/packages/pg-protocol/src/parser.ts b/packages/pg-protocol/src/parser.ts index 998077a00..223ed224e 100644 --- a/packages/pg-protocol/src/parser.ts +++ b/packages/pg-protocol/src/parser.ts @@ -157,80 +157,86 @@ export class Parser { private handlePacket(offset: number, code: number, length: number, bytes: Buffer): BackendMessage { const { reader } = this - // NOTE: This undesirably retains the buffer in `this.reader` if the `parse*Message` calls below throw. However, those should only throw in the case of a protocol error, which normally results in the reader being discarded. + // NOTE: This undesirably retains the buffer in `this.reader` if the `parse*Message` calls below throw. The try/catch below ensures the reader is always released, even on protocol errors, and surfaces the failure as a DatabaseError to the consumer instead of an uncatchable exception in the parse stream. reader.setBuffer(offset, bytes) let message: BackendMessage - switch (code) { - case MessageCodes.BindComplete: - message = bindComplete - break - case MessageCodes.ParseComplete: - message = parseComplete - break - case MessageCodes.CloseComplete: - message = closeComplete - break - case MessageCodes.NoData: - message = noData - break - case MessageCodes.PortalSuspended: - message = portalSuspended - break - case MessageCodes.CopyDone: - message = copyDone - break - case MessageCodes.ReplicationStart: - message = replicationStart - break - case MessageCodes.EmptyQuery: - message = emptyQuery - break - case MessageCodes.DataRow: - message = parseDataRowMessage(reader) - break - case MessageCodes.CommandComplete: - message = parseCommandCompleteMessage(reader) - break - case MessageCodes.ReadyForQuery: - message = parseReadyForQueryMessage(reader) - break - case MessageCodes.NotificationResponse: - message = parseNotificationMessage(reader) - break - case MessageCodes.AuthenticationResponse: - message = parseAuthenticationResponse(reader, length) - break - case MessageCodes.ParameterStatus: - message = parseParameterStatusMessage(reader) - break - case MessageCodes.BackendKeyData: - message = parseBackendKeyData(reader) - break - case MessageCodes.ErrorMessage: - message = parseErrorMessage(reader, 'error') - break - case MessageCodes.NoticeMessage: - message = parseErrorMessage(reader, 'notice') - break - case MessageCodes.RowDescriptionMessage: - message = parseRowDescriptionMessage(reader) - break - case MessageCodes.ParameterDescriptionMessage: - message = parseParameterDescriptionMessage(reader) - break - case MessageCodes.CopyIn: - message = parseCopyInMessage(reader) - break - case MessageCodes.CopyOut: - message = parseCopyOutMessage(reader) - break - case MessageCodes.CopyData: - message = parseCopyData(reader, length) - break - default: - return new DatabaseError('received invalid response: ' + code.toString(16), length, 'error') + try { + switch (code) { + case MessageCodes.BindComplete: + message = bindComplete + break + case MessageCodes.ParseComplete: + message = parseComplete + break + case MessageCodes.CloseComplete: + message = closeComplete + break + case MessageCodes.NoData: + message = noData + break + case MessageCodes.PortalSuspended: + message = portalSuspended + break + case MessageCodes.CopyDone: + message = copyDone + break + case MessageCodes.ReplicationStart: + message = replicationStart + break + case MessageCodes.EmptyQuery: + message = emptyQuery + break + case MessageCodes.DataRow: + message = parseDataRowMessage(reader) + break + case MessageCodes.CommandComplete: + message = parseCommandCompleteMessage(reader) + break + case MessageCodes.ReadyForQuery: + message = parseReadyForQueryMessage(reader) + break + case MessageCodes.NotificationResponse: + message = parseNotificationMessage(reader) + break + case MessageCodes.AuthenticationResponse: + message = parseAuthenticationResponse(reader, length) + break + case MessageCodes.ParameterStatus: + message = parseParameterStatusMessage(reader) + break + case MessageCodes.BackendKeyData: + message = parseBackendKeyData(reader) + break + case MessageCodes.ErrorMessage: + message = parseErrorMessage(reader, 'error') + break + case MessageCodes.NoticeMessage: + message = parseErrorMessage(reader, 'notice') + break + case MessageCodes.RowDescriptionMessage: + message = parseRowDescriptionMessage(reader) + break + case MessageCodes.ParameterDescriptionMessage: + message = parseParameterDescriptionMessage(reader) + break + case MessageCodes.CopyIn: + message = parseCopyInMessage(reader) + break + case MessageCodes.CopyOut: + message = parseCopyOutMessage(reader) + break + case MessageCodes.CopyData: + message = parseCopyData(reader, length) + break + default: + reader.setBuffer(0, emptyBuffer) + return new DatabaseError('received invalid response: ' + code.toString(16), length, 'error') + } + } catch (error) { + reader.setBuffer(0, emptyBuffer) + return new DatabaseError(`exception received while handling packet: ${error}`, length, 'error') } reader.setBuffer(0, emptyBuffer) diff --git a/packages/pg-query-stream/package.json b/packages/pg-query-stream/package.json index 42ef8f268..1345ff694 100644 --- a/packages/pg-query-stream/package.json +++ b/packages/pg-query-stream/package.json @@ -16,7 +16,7 @@ }, "repository": { "type": "git", - "url": "git://github.com/brianc/node-postgres.git", + "url": "git://github.com/supabase/node-postgres.git", "directory": "packages/pg-query-stream" }, "keywords": [ @@ -34,7 +34,7 @@ "author": "Brian M. Carlson", "license": "MIT", "bugs": { - "url": "https://github.com/brianc/node-postgres/issues" + "url": "https://github.com/supabase/node-postgres/issues" }, "devDependencies": { "@types/chai": "^4.2.13", diff --git a/packages/pg/README.md b/packages/pg/README.md index 75242374c..be3d94dfe 100644 --- a/packages/pg/README.md +++ b/packages/pg/README.md @@ -9,7 +9,7 @@ Non-blocking PostgreSQL client for Node.js. Pure JavaScript and optional native ## Install ```sh -$ npm install pg +$ npm install @supabase/pg ``` --- diff --git a/packages/pg/lib/client.js b/packages/pg/lib/client.js index bb5e6d5f0..ecbc61b92 100644 --- a/packages/pg/lib/client.js +++ b/packages/pg/lib/client.js @@ -82,6 +82,7 @@ class Client extends EventEmitter { keepAlive: c.keepAlive || false, keepAliveInitialDelayMillis: c.keepAliveInitialDelayMillis || 0, encoding: this.connectionParameters.client_encoding || 'utf8', + maxResultSize: c.maxResultSize, }) this._queryQueue = [] this.binary = c.binary || defaults.binary diff --git a/packages/pg/lib/connection.js b/packages/pg/lib/connection.js index 027f93935..1b59d766f 100644 --- a/packages/pg/lib/connection.js +++ b/packages/pg/lib/connection.js @@ -26,6 +26,8 @@ class Connection extends EventEmitter { this.ssl = config.ssl || false this._ending = false this._emitMessage = false + this._maxResultSize = config.maxResultSize + this._currentResultSize = 0 const self = this this.on('newListener', function (eventName) { if (eventName === 'message') { @@ -107,8 +109,53 @@ class Connection extends EventEmitter { } attachListeners(stream) { + // Use the appropriate implementation based on whether maxResultSize is enabled + if (this._maxResultSize && this._maxResultSize > 0) { + this._attachListenersWithSizeLimit(stream) + } else { + this._attachListenersStandard(stream) + } + } + + // Original implementation with no overhead + _attachListenersStandard(stream) { + parse(stream, (msg) => { + const eventName = msg.name === 'error' ? 'errorMessage' : msg.name + if (this._emitMessage) { + this.emit('message', msg) + } + this.emit(eventName, msg) + }) + } + + // Implementation with size limiting logic + _attachListenersWithSizeLimit(stream) { parse(stream, (msg) => { const eventName = msg.name === 'error' ? 'errorMessage' : msg.name + + // Only track data row messages for result size + if (msg.name === 'dataRow') { + // Approximate size by using message length + const msgSize = msg.length || 1024 // Default to 1KB if we don't have length info + this._currentResultSize += msgSize + + // Check if we've exceeded the max result size + if (this._currentResultSize > this._maxResultSize) { + const error = new Error('Query result size exceeded the configured limit') + error.code = 'RESULT_SIZE_EXCEEDED' + error.resultSize = this._currentResultSize + error.maxResultSize = this._maxResultSize + this.emit('errorMessage', error) + this.end() // Terminate the connection + return + } + } + + // Reset counter on query completion + if (msg.name === 'readyForQuery') { + this._currentResultSize = 0 + } + if (this._emitMessage) { this.emit('message', msg) } diff --git a/packages/pg/lib/crypto/sasl.js b/packages/pg/lib/crypto/sasl.js index a782ae48a..39af4e4cf 100644 --- a/packages/pg/lib/crypto/sasl.js +++ b/packages/pg/lib/crypto/sasl.js @@ -2,6 +2,34 @@ const crypto = require('./utils') const { signatureAlgorithmHashFromCertificate } = require('./cert-signatures') +// SASLprep (RFC 4013) — minimal in-tree implementation. +// +// Per RFC 5802 §2.2, the SCRAM-SHA-256 client must normalize the password via +// SASLprep before feeding it into PBKDF2. PostgreSQL's server applies the same +// SASLprep when computing the stored verifier, and libpq does the same client +// side, so passwords whose NFKC form differs from the raw form +// would otherwise authenticate against psql/libpq but fail against pg with `28P01`. +// +// We deliberately implement only the three steps that change the byte content: +// 1. RFC 3454 Table C.1.2 (non-ASCII space) → U+0020 SPACE. +// 2. RFC 3454 Table B.1 (commonly mapped to nothing) → empty. +// 3. NFKC normalization. +// We skip the prohibition (RFC 4013 §2.3) and bidi (RFC 3454 §6) checks. +// libpq is forgiving on those paths and Postgres's own SASLprep matches that +// leniency for legacy roles, so omitting the rejection logic keeps existing +// roles working without adding complexity. +function saslprep(password) { + // RFC 3454 Table C.1.2 — non-ASCII space characters, mapped to U+0020. + const nonAsciiSpace = /[\u00A0\u1680\u2000-\u200B\u202F\u205F\u3000]/g + // RFC 3454 Table B.1 — "commonly mapped to nothing". The set intentionally + // contains zero-width joiners and variation selectors — the very characters + // ESLint's no-misleading-character-class warns about — because they combine + // with their neighbors and the RFC strips them for that reason. + // eslint-disable-next-line no-misleading-character-class + const mappedToNothing = /[\u00AD\u034F\u1806\u180B\u180C\u180D\u200C\u200D\u2060\uFE00-\uFE0F\uFEFF]/g + return password.replace(nonAsciiSpace, ' ').replace(mappedToNothing, '').normalize('NFKC') +} + function startSession(mechanisms, stream) { const candidates = ['SCRAM-SHA-256'] if (stream) candidates.unshift('SCRAM-SHA-256-PLUS') // higher-priority, so placed first @@ -70,7 +98,7 @@ async function continueSession(session, password, serverData, stream) { const authMessage = clientFirstMessageBare + ',' + serverFirstMessage + ',' + clientFinalMessageWithoutProof const saltBytes = Buffer.from(sv.salt, 'base64') - const saltedPassword = await crypto.deriveKey(password, saltBytes, sv.iteration) + const saltedPassword = await crypto.deriveKey(saslprep(password), saltBytes, sv.iteration) const clientKey = await crypto.hmacSha256(saltedPassword, 'Client Key') const storedKey = await crypto.sha256(clientKey) const clientSignature = await crypto.hmacSha256(storedKey, authMessage) diff --git a/packages/pg/lib/defaults.js b/packages/pg/lib/defaults.js index 673696f79..f09d9c0de 100644 --- a/packages/pg/lib/defaults.js +++ b/packages/pg/lib/defaults.js @@ -77,6 +77,9 @@ module.exports = { keepalives: 1, keepalives_idle: 0, + + // maxResultSize limit of a request before erroring out + maxResultSize: undefined, } const pgTypes = require('pg-types') diff --git a/packages/pg/lib/native/client.js b/packages/pg/lib/native/client.js index 6df471b83..4f73426a9 100644 --- a/packages/pg/lib/native/client.js +++ b/packages/pg/lib/native/client.js @@ -31,6 +31,9 @@ const Client = (module.exports = function (config) { types: this._types, }) + // Store maxResultSize configuration + this._maxResultSize = config.maxResultSize + this._queryQueue = [] this._ending = false this._connecting = false @@ -105,6 +108,9 @@ Client.prototype._connect = function (cb) { // set internal states to connected self._connected = true + // Add a reference to the client for error bubbling + self.native.connection = self + // handle connection errors from the native layer self.native.on('error', function (err) { self._queryable = false diff --git a/packages/pg/lib/native/query.js b/packages/pg/lib/native/query.js index e02294f63..215aa30e7 100644 --- a/packages/pg/lib/native/query.js +++ b/packages/pg/lib/native/query.js @@ -55,6 +55,17 @@ NativeQuery.prototype.handleError = function (err) { err[normalizedFieldName] = fields[key] } } + + // For maxResultSize exceeded errors, make sure we emit the error to the client too + if (err.code === 'RESULT_SIZE_EXCEEDED') { + if (this.native && this.native.connection) { + // Need to emit the error on the client/connection level too + process.nextTick(() => { + this.native.connection.emit('error', err) + }) + } + } + if (this.callback) { this.callback(err) } else { @@ -88,6 +99,9 @@ NativeQuery.prototype.submit = function (client) { this.native = client.native client.native.arrayMode = this._arrayMode + // Get the maxResultSize from the client if it's set + this._maxResultSize = client._maxResultSize + let after = function (err, rows, results) { client.native.arrayMode = false setImmediate(function () { @@ -99,6 +113,30 @@ NativeQuery.prototype.submit = function (client) { return self.handleError(err) } + // Check the result size if maxResultSize is configured + if (self._maxResultSize) { + // Calculate result size (rough approximation) + let resultSize = 0 + + // For multiple result sets + if (results.length > 1) { + for (let i = 0; i < rows.length; i++) { + resultSize += self._calculateResultSize(rows[i]) + } + } else if (rows.length > 0) { + resultSize = self._calculateResultSize(rows) + } + + // If the size limit is exceeded, generate an error + if (resultSize > self._maxResultSize) { + const error = new Error('Query result size exceeded the configured limit') + error.code = 'RESULT_SIZE_EXCEEDED' + error.resultSize = resultSize + error.maxResultSize = self._maxResultSize + return self.handleError(error) + } + } + // emit row events for each row in the result if (self._emitRowEvents) { if (results.length > 1) { @@ -163,3 +201,59 @@ NativeQuery.prototype.submit = function (client) { client.native.query(this.text, after) } } + +// Helper method to estimate the size of a result set +NativeQuery.prototype._calculateResultSize = function (rows) { + let size = 0 + + // For empty results, return 0 + if (!rows || rows.length === 0) { + return 0 + } + + // For array mode, calculate differently + if (this._arrayMode) { + // Just use a rough approximation based on number of rows + return rows.length * 100 + } + + // For each row, approximate its size + for (let i = 0; i < rows.length; i++) { + const row = rows[i] + + // Add base row size + size += 24 // Overhead per row + + // Add size of each column + for (const key in row) { + if (Object.prototype.hasOwnProperty.call(row, key)) { + const value = row[key] + + // Add key size + size += key.length * 2 // Assume 2 bytes per character + + // Add value size based on type + if (value === null || value === undefined) { + size += 8 + } else if (typeof value === 'string') { + size += value.length * 2 // Assume 2 bytes per character + } else if (typeof value === 'number') { + size += 8 + } else if (typeof value === 'boolean') { + size += 4 + } else if (value instanceof Date) { + size += 8 + } else if (Buffer.isBuffer(value)) { + size += value.length + } else if (Array.isArray(value)) { + size += 16 + value.length * 8 + } else { + // For objects, use a rough estimate + size += 32 + JSON.stringify(value).length * 2 + } + } + } + } + + return size +} diff --git a/packages/pg/package.json b/packages/pg/package.json index d14e448d6..c566df69c 100644 --- a/packages/pg/package.json +++ b/packages/pg/package.json @@ -1,6 +1,6 @@ { - "name": "pg", - "version": "8.20.0", + "name": "@supabase/pg", + "version": "8.21.1", "description": "PostgreSQL client - pure javascript & libpq with the same API", "keywords": [ "database", @@ -11,10 +11,10 @@ "postgresql", "rdbms" ], - "homepage": "https://github.com/brianc/node-postgres", + "homepage": "https://github.com/supabase/node-postgres", "repository": { "type": "git", - "url": "git://github.com/brianc/node-postgres.git", + "url": "git://github.com/supabase/node-postgres.git", "directory": "packages/pg" }, "author": "Brian Carlson ", @@ -34,7 +34,7 @@ "dependencies": { "pg-connection-string": "^2.12.0", "pg-pool": "^3.13.0", - "pg-protocol": "^1.13.0", + "pg-protocol": "npm:@supabase/pg-protocol@^1.13.1", "pg-types": "2.2.0", "pgpass": "1.0.5" }, diff --git a/packages/pg/test/integration/client/max-result-size-tests.js b/packages/pg/test/integration/client/max-result-size-tests.js new file mode 100644 index 000000000..e37ba3a94 --- /dev/null +++ b/packages/pg/test/integration/client/max-result-size-tests.js @@ -0,0 +1,131 @@ +'use strict' +const helper = require('../test-helper') +const pg = helper.pg +const assert = require('assert') + +process.on('unhandledRejection', function (e) { + console.error(e, e.stack) + process.exit(1) +}) + +const suite = new helper.Suite() + +suite.test('maxResultSize limit triggers error', (cb) => { + // Check if we're running with the native client + const isNative = helper.args.native + console.log(isNative ? 'Testing with native client' : 'Testing with JavaScript client') + + // Create a pool with a very small result size limit + const pool = new pg.Pool({ + maxResultSize: 100, // Very small limit (100 bytes) + ...helper.args, + }) + + let sizeExceededErrorSeen = false + + pool.on('error', (err) => { + console.log('Pool error:', err.message, err.code) + }) + + pool + .connect() + .then((client) => { + // Set up client error listener for error events + client.on('error', (err) => { + console.log('Client error event:', err.message, err.code) + + // If we get any size exceeded error, mark it + if (err.code === 'RESULT_SIZE_EXCEEDED' || err.message === 'Query result size exceeded the configured limit') { + sizeExceededErrorSeen = true + } + }) + + return client + .query('CREATE TEMP TABLE large_result_test(id SERIAL, data TEXT)') + .then(() => { + // Insert rows that will exceed the size limit when queried + const insertPromises = [] + for (let i = 0; i < 20; i++) { + // Each row will have enough data to eventually exceed our limit + const data = 'x'.repeat(50) + insertPromises.push(client.query('INSERT INTO large_result_test(data) VALUES($1)', [data])) + } + return Promise.all(insertPromises) + }) + .then(() => { + console.log('Running query that should exceed size limit...') + + return client + .query('SELECT * FROM large_result_test') + .then(() => { + throw new Error('Query should have failed due to size limit') + }) + .catch((err) => { + console.log('Query error caught:', err.message, err.code) + + // Both implementations should throw an error with this code + assert.equal(err.code, 'RESULT_SIZE_EXCEEDED', 'Error should have RESULT_SIZE_EXCEEDED code') + + // Give time for error events to propagate + return new Promise((resolve) => setTimeout(resolve, 100)).then(() => { + // Verify we saw the error event + assert(sizeExceededErrorSeen, 'Should have seen the size exceeded error event') + + return client.query('DROP TABLE IF EXISTS large_result_test').catch(() => { + /* ignore cleanup errors */ + }) + }) + }) + }) + .then(() => { + client.release() + pool.end(cb) + }) + .catch((err) => { + console.error('Test error:', err.message) + client.release() + pool.end(() => cb(err)) + }) + }) + .catch((err) => { + console.error('Connection error:', err.message) + pool.end(() => cb(err)) + }) +}) + +suite.test('results under maxResultSize limit work correctly', (cb) => { + // Create a pool with a reasonably large limit + const pool = new pg.Pool({ + maxResultSize: 10 * 1024, // 10KB is plenty for small results + ...helper.args, + }) + + pool + .connect() + .then((client) => { + return client + .query('CREATE TEMP TABLE small_result_test(id SERIAL, data TEXT)') + .then(() => { + return client.query('INSERT INTO small_result_test(data) VALUES($1)', ['small_data']) + }) + .then(() => { + return client.query('SELECT * FROM small_result_test').then((result) => { + assert.equal(result.rows.length, 1, 'Should get 1 row') + assert.equal(result.rows[0].data, 'small_data', 'Data should match') + + return client.query('DROP TABLE small_result_test') + }) + }) + .then(() => { + client.release() + pool.end(cb) + }) + .catch((err) => { + client.release() + pool.end(() => cb(err)) + }) + }) + .catch((err) => { + pool.end(() => cb(err)) + }) +}) diff --git a/packages/pg/test/integration/client/promise-api-tests.js b/packages/pg/test/integration/client/promise-api-tests.js index 9e2ffec0c..8c3cd076b 100644 --- a/packages/pg/test/integration/client/promise-api-tests.js +++ b/packages/pg/test/integration/client/promise-api-tests.js @@ -13,13 +13,6 @@ suite.test('valid connection completes promise', () => { }) }) -suite.test('valid connection completes promise', () => { - const client = new pg.Client() - return client.connect().then(() => { - return client.end().then(() => {}) - }) -}) - suite.test('valid connection returns the client in a promise', () => { const client = new pg.Client() return client.connect().then((clientInside) => { @@ -28,25 +21,7 @@ suite.test('valid connection returns the client in a promise', () => { }) }) -suite.test('invalid connection rejects promise', (done) => { +suite.test('invalid connection rejects promise', async () => { const client = new pg.Client({ host: 'alksdjflaskdfj', port: 1234 }) - return client.connect().catch((e) => { - assert(e instanceof Error) - done() - }) -}) - -suite.test('connected client does not reject promise after connection', (done) => { - const client = new pg.Client() - return client.connect().then(() => { - setTimeout(() => { - client.on('error', (e) => { - assert(e instanceof Error) - client.end() - done() - }) - // manually kill the connection - client.emit('error', new Error('something bad happened...but not really')) - }, 50) - }) + await assert.rejects(client.connect(), Error) }) diff --git a/packages/pg/test/integration/client/sasl-scram-tests.js b/packages/pg/test/integration/client/sasl-scram-tests.js index 85bf2cd34..bf1dfcb0d 100644 --- a/packages/pg/test/integration/client/sasl-scram-tests.js +++ b/packages/pg/test/integration/client/sasl-scram-tests.js @@ -108,3 +108,82 @@ suite.test('sasl/scram fails when password is empty', async () => { ) assert.ok(usingSasl, 'Should be using SASL for authentication') }) + +/** + * SASLprep regression coverage. RFC 5802 / RFC 4013 require the SCRAM client + * to normalize the password (B.1 mapping → NFKC → prohibition + bidi check) + * before feeding it into PBKDF2. PostgreSQL's server applies the same + * SASLprep when computing the verifier, so any password whose NFKC form + * differs from the raw form would otherwise authenticate against psql/libpq + * but fail against pg with `28P01`. + * + * To exercise these tests, provision a role whose password contains an + * NFKC-asymmetric character. For example, in psql: + * + * SET password_encryption = 'scram-sha-256'; + * CREATE ROLE scram_unicode_test LOGIN PASSWORD U&'IX-\2168'; + * + * `\2168` is ROMAN NUMERAL IX; the server SASLprep-normalizes this to + * `IX-IX` when computing the verifier. Then export: + * + * SCRAM_TEST_PGUSER_UNICODE=scram_unicode_test + * SCRAM_TEST_PGPASSWORD_UNICODE='IX-\u2168' (i.e. the raw form) + * + * If either env var is unset the suite is skipped, matching the convention + * of the ASCII SCRAM block above. + */ +const unicodeConfig = { + user: process.env.SCRAM_TEST_PGUSER_UNICODE, + password: process.env.SCRAM_TEST_PGPASSWORD_UNICODE, + host: process.env.SCRAM_TEST_PGHOST, + port: process.env.SCRAM_TEST_PGPORT, + database: process.env.SCRAM_TEST_PGDATABASE, +} + +if (!unicodeConfig.user || !unicodeConfig.password) { + suite.test('skipping SCRAM unicode tests (missing env)', () => {}) +} else { + suite.test('sasl/scram authenticates a password requiring SASLprep (raw form)', async () => { + const client = new pg.Client(unicodeConfig) + let usingSasl = false + client.connection.once('authenticationSASL', () => { + usingSasl = true + }) + await client.connect() + assert.ok(usingSasl, 'Should be using SASL for authentication') + await client.end() + }) + + suite.test('sasl/scram authenticates the NFKC-equivalent ASCII form of the same password', async () => { + // The unicode password contains a codepoint that NFKC-decomposes to ASCII + // (e.g. U+2168 → "IX"). The server stored the verifier from the + // SASLprep'd ASCII form, so feeding the client the ASCII form directly + // must also authenticate. This proves that the prep step is symmetric: + // any NFKC-equivalent representation reaches the same PBKDF2 input. + const client = new pg.Client({ + ...unicodeConfig, + password: unicodeConfig.password.normalize('NFKC'), + }) + await client.connect() + await client.end() + }) + + suite.test('sasl/scram fails when unicode password is wrong', async () => { + const client = new pg.Client({ + ...unicodeConfig, + password: unicodeConfig.password + 'append-something-to-make-it-bad', + }) + let usingSasl = false + client.connection.once('authenticationSASL', () => { + usingSasl = true + }) + await assert.rejects( + () => client.connect(), + { + code: '28P01', + }, + 'Error code should be for a password error' + ) + assert.ok(usingSasl, 'Should be using SASL for authentication') + }) +} diff --git a/packages/pg/test/integration/gh-issues/3174-tests.js b/packages/pg/test/integration/gh-issues/3174-tests.js index 99044df0e..cd920346a 100644 --- a/packages/pg/test/integration/gh-issues/3174-tests.js +++ b/packages/pg/test/integration/gh-issues/3174-tests.js @@ -104,7 +104,9 @@ const testErrorBuffer = (bufferName, errorBuffer) => { if (!cli.native) { assert(errorHit) // further queries on the client should fail since its in an invalid state - await assert.rejects(() => client.query('SELECTR NOW()'), 'Further queries on the client should reject') + await assert.rejects(client.query('SELECT NOW()'), { + message: 'Client has encountered a connection error and is not queryable', + }) } await closeServer() @@ -129,7 +131,9 @@ const testErrorBuffer = (bufferName, errorBuffer) => { if (!cli.native) { assert(errorHit) // further queries on the client should fail since its in an invalid state - await assert.rejects(() => client.query('SELECTR NOW()'), 'Further queries on the client should reject') + await assert.rejects(client.query('SELECT NOW()'), { + message: 'Client has encountered a connection error and is not queryable', + }) } await client.end() diff --git a/packages/pg/test/unit/client/sasl-scram-tests.js b/packages/pg/test/unit/client/sasl-scram-tests.js index 7554a9814..fc75a748a 100644 --- a/packages/pg/test/unit/client/sasl-scram-tests.js +++ b/packages/pg/test/unit/client/sasl-scram-tests.js @@ -58,64 +58,53 @@ suite.test('sasl/scram', function () { }) suite.test('continueSession', function () { - suite.test('fails when last session message was not SASLInitialResponse', async function () { - assert.rejects( - function () { - return sasl.continueSession({}, '', '') - }, - { - message: 'SASL: Last message was not SASLInitialResponse', - } - ) + suite.test('fails when last session message was not SASLInitialResponse', async () => { + await assert.rejects(sasl.continueSession({}, '', ''), { + message: 'SASL: Last message was not SASLInitialResponse', + }) }) - suite.test('fails when nonce is missing in server message', function () { - assert.rejects( - function () { - return sasl.continueSession( - { - message: 'SASLInitialResponse', - }, - 'bad-password', - 's=1,i=1' - ) - }, + suite.test('fails when nonce is missing in server message', async () => { + await assert.rejects( + sasl.continueSession( + { + message: 'SASLInitialResponse', + }, + 'bad-password', + 's=1,i=1' + ), { message: 'SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce missing', } ) }) - suite.test('fails when salt is missing in server message', function () { - assert.rejects( - function () { - return sasl.continueSession( - { - message: 'SASLInitialResponse', - }, - 'bad-password', - 'r=1,i=1' - ) - }, + suite.test('fails when salt is missing in server message', async () => { + await assert.rejects( + sasl.continueSession( + { + message: 'SASLInitialResponse', + }, + 'bad-password', + 'r=1,i=1' + ), { message: 'SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing', } ) }) - suite.test('fails when client password is not a string', function () { + suite.test('fails when client password is not a string', async () => { for (const badPasswordValue of [null, undefined, 123, new Date(), {}]) { - assert.rejects( - function () { - return sasl.continueSession( - { - message: 'SASLInitialResponse', - clientNonce: 'a', - }, - badPasswordValue, - 'r=1,i=1' - ) - }, + await assert.rejects( + sasl.continueSession( + { + message: 'SASLInitialResponse', + clientNonce: 'a', + }, + badPasswordValue, + 'r=1,i=1' + ), { message: 'SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string', } @@ -123,53 +112,47 @@ suite.test('sasl/scram', function () { } }) - suite.test('fails when client password is an empty string', function () { - assert.rejects( - function () { - return sasl.continueSession( - { - message: 'SASLInitialResponse', - clientNonce: 'a', - }, - '', - 'r=1,i=1' - ) - }, + suite.test('fails when client password is an empty string', async () => { + await assert.rejects( + sasl.continueSession( + { + message: 'SASLInitialResponse', + clientNonce: 'a', + }, + '', + 'r=1,i=1' + ), { message: 'SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a non-empty string', } ) }) - suite.test('fails when iteration is missing in server message', function () { - assert.rejects( - function () { - return sasl.continueSession( - { - message: 'SASLInitialResponse', - }, - 'bad-password', - 'r=1,s=abcd' - ) - }, + suite.test('fails when iteration is missing in server message', async () => { + await assert.rejects( + sasl.continueSession( + { + message: 'SASLInitialResponse', + }, + 'bad-password', + 'r=1,s=abcd' + ), { message: 'SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration missing', } ) }) - suite.test('fails when server nonce does not start with client nonce', function () { - assert.rejects( - function () { - return sasl.continueSession( - { - message: 'SASLInitialResponse', - clientNonce: '2', - }, - 'bad-password', - 'r=1,s=abcd,i=1' - ) - }, + suite.test('fails when server nonce does not start with client nonce', async () => { + await assert.rejects( + sasl.continueSession( + { + message: 'SASLInitialResponse', + clientNonce: '2', + }, + 'bad-password', + 'r=1,s=abcd,i=1' + ), { message: 'SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce', } @@ -204,6 +187,64 @@ suite.test('sasl/scram', function () { assert.equal(session.response, 'c=eSws,r=ab,p=YVTEOwOD7khu/NulscjFegHrZoTXJBFI/7L61AN9khc=') }) + suite.test('SASLprep maps non-ASCII space characters (RFC 3454 C.1.2) to U+0020 SPACE', async function () { + // SASLprep probably misuses the C.1.2 table; U+200B, in particular, is listed in both the C.1.2 and B.1 tables. We treat it as a space for compatibility with PostgreSQL. + const sessionPrepped = { message: 'SASLInitialResponse', clientNonce: 'a' } + const sessionRef = { message: 'SASLInitialResponse', clientNonce: 'a' } + + await sasl.continueSession(sessionPrepped, '\u200bfoo\xa0bar', 'r=ab,s=abcd,i=1') + await sasl.continueSession(sessionRef, ' foo bar', 'r=ab,s=abcd,i=1') + + assert.equal(sessionPrepped.serverSignature, sessionRef.serverSignature) + assert.equal(sessionPrepped.response, sessionRef.response) + }) + + suite.test('SASLprep maps mapped-to-nothing characters before PBKDF2 (RFC 3454 B.1)', async function () { + // Soft hyphen U+00AD is mapped to nothing by SASLprep, so 'I\u00ADX' + // must produce identical SCRAM output to 'IX'. This proves the prep + // step is engaged on the SCRAM derivation path. Without the fix the + // two would diverge and this assertion would fail. + const sessionPrepped = { message: 'SASLInitialResponse', clientNonce: 'a' } + const sessionRef = { message: 'SASLInitialResponse', clientNonce: 'a' } + + await sasl.continueSession(sessionPrepped, 'I\u00ADX', 'r=ab,s=abcd,i=1') + await sasl.continueSession(sessionRef, 'IX', 'r=ab,s=abcd,i=1') + + assert.equal(sessionPrepped.serverSignature, sessionRef.serverSignature) + assert.equal(sessionPrepped.response, sessionRef.response) + }) + + suite.test('SASLprep NFKC-normalizes passwords before PBKDF2 (RFC 4013 §2.2)', async function () { + // ROMAN NUMERAL IX (U+2168) NFKC-decomposes to the ASCII letters 'IX'. + // PostgreSQL's server applies SASLprep when computing the verifier, so + // a role created with U+2168 is stored as if it were 'IX'. The client + // must do the same. + const sessionPrepped = { message: 'SASLInitialResponse', clientNonce: 'a' } + const sessionRef = { message: 'SASLInitialResponse', clientNonce: 'a' } + + await sasl.continueSession(sessionPrepped, '\u2168', 'r=ab,s=abcd,i=1') + await sasl.continueSession(sessionRef, 'IX', 'r=ab,s=abcd,i=1') + + assert.equal(sessionPrepped.serverSignature, sessionRef.serverSignature) + assert.equal(sessionPrepped.response, sessionRef.response) + }) + + suite.test('passes ASCII control characters through normalization unchanged', async function () { + // BEL (U+0007) is an ASCII control character. The minimal SASLprep + // implementation (B.1 mapping → C.1.2 mapping → NFKC) is the identity + // on ASCII control codes, so the bytes fed to PBKDF2 are exactly the + // raw password. We snapshot the resulting SCRAM output as a regression + // guard: if anyone ever swaps the order of operations, removes the + // NFKC step, or accidentally strips ASCII bytes, this assertion trips. + const session = { message: 'SASLInitialResponse', clientNonce: 'a' } + + await sasl.continueSession(session, '\u0007abc', 'r=ab,s=abcd,i=1') + + assert.equal(session.message, 'SASLResponse') + assert.equal(session.serverSignature, 'ytJN8GA+9TeZpeS28ix+u0cwaIB7iFlWgpAsmy+MmP0=') + assert.equal(session.response, 'c=biws,r=ab,p=04HAPnY4K2UhwiD2RJtFw9sU81SLcas8B1Uqdqv8SeQ=') + }) + suite.test('sets expected session data (SCRAM-SHA-256-PLUS)', async function () { const session = { message: 'SASLInitialResponse', diff --git a/packages/pg/test/unit/client/simple-query-tests.js b/packages/pg/test/unit/client/simple-query-tests.js index 6c20c576b..8cc550830 100644 --- a/packages/pg/test/unit/client/simple-query-tests.js +++ b/packages/pg/test/unit/client/simple-query-tests.js @@ -118,39 +118,36 @@ test('executing query', function () { const client = helper.client() test('throws an error when config is null', function () { - try { - client.query(null, undefined) - } catch (error) { - assert.equal( - error.message, - 'Client was passed a null or undefined query', - 'Should have thrown an Error for null queries' - ) - } + assert.throws( + () => { + client.query(null, undefined) + }, + { + message: 'Client was passed a null or undefined query', + } + ) }) test('throws an error when config is undefined', function () { - try { - client.query() - } catch (error) { - assert.equal( - error.message, - 'Client was passed a null or undefined query', - 'Should have thrown an Error for null queries' - ) - } + assert.throws( + () => { + client.query() + }, + { + message: 'Client was passed a null or undefined query', + } + ) }) test('throws an error when callback is not a function', function () { - try { - client.query('SELECT $1', [1], 'notafunction') - } catch (error) { - assert.equal( - error.message, - 'callback is not a function', - 'Should have thrown an Error for non function callback' - ) - } + assert.throws( + () => { + client.query('SELECT $1', [1], 'notafunction') + }, + { + message: 'callback is not a function', + } + ) }) }) }) diff --git a/yarn.lock b/yarn.lock index 6e45ace78..92028ecc8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5907,13 +5907,13 @@ levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" -libpq@^1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/libpq/-/libpq-1.10.0.tgz#238d01d416abca8768aab09bc82d81af9c7ffa23" - integrity sha512-PHY+JGD3+9X5b2emXLh+WJEnz1jhczO1xs25ZH0xbMWvQi+Hd9X/mTZOrGA99Rcw/DvNjsBRlegroqigpNfaJA== +libpq@^1.8.15: + version "1.11.0" + resolved "https://registry.yarnpkg.com/libpq/-/libpq-1.11.0.tgz#1baf0920eb51ebe1399de942414e012142dcead8" + integrity sha512-mHoPlvMwYDMJV36bS2w3eSdFD4eDSm7P9FsvruUldQxzE23/W6qitT9VU/yD1+g2vpgpDktnk2iEYJyhy1RR5g== dependencies: bindings "1.5.0" - nan "~2.23.1" + nan "~2.26.2" lines-and-columns@^1.1.6: version "1.1.6" @@ -6627,15 +6627,10 @@ mz@^2.5.0: object-assign "^4.0.1" thenify-all "^1.0.0" -nan@~2.22.2: - version "2.22.2" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.22.2.tgz#6b504fd029fb8f38c0990e52ad5c26772fdacfbb" - integrity sha512-DANghxFkS1plDdRsX0X9pm0Z6SJNN6gBdtXfanwoZ8hooC5gosGFSBGRYHUVPz1asKA/kMRqDRdHrluZ61SpBQ== - -nan@~2.23.1: - version "2.23.1" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.23.1.tgz#6f86a31dd87e3d1eb77512bf4b9e14c8aded3975" - integrity sha512-r7bBUGKzlqk8oPBDYxt6Z0aEdF1G1rwlMcLk8LCOMbOzf0mG+JUfUzG4fIMWwHWP0iyaLWEQZJmtB7nOHEm/qw== +nan@~2.26.2: + version "2.26.2" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.26.2.tgz#2e5e25764224c737b9897790b57c3294d4dcee9c" + integrity sha512-0tTvBTYkt3tdGw22nrAy50x7gpbGCCFH3AFcyS5WiUu7Eu4vWlri1woE6qHBSfy11vksDqkiwjOnlR7WV8G1Hw== nanoid@^3.3.11: version "3.3.11"