Skip to content

Commit

Permalink
Requested tweaks to channel binding
Browse files Browse the repository at this point in the history
  • Loading branch information
jawj committed Jan 14, 2025
1 parent 65e1c72 commit a338521
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/pg/lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Client extends EventEmitter {
this.database = this.connectionParameters.database
this.port = this.connectionParameters.port
this.host = this.connectionParameters.host
this.enableChannelBinding = true
this.enableChannelBinding = false // set true to use SCRAM-SHA-256-PLUS when offered

// "hiding" the password so it doesn't show up in stack traces
// or if the client is console.logged
Expand Down
4 changes: 2 additions & 2 deletions packages/pg/lib/crypto/sasl.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict'
const crypto = require('./utils')
const tls = require('tls');
const tls = require('tls')
const x509 = require('@peculiar/x509')

function startSession(mechanisms, stream) {
const candidates = ['SCRAM-SHA-256']
Expand Down Expand Up @@ -65,7 +66,6 @@ async function continueSession(session, password, serverData, stream) {
// override if channel binding is in use:
if (session.mechanism === 'SCRAM-SHA-256-PLUS') {
const peerCert = stream.getPeerCertificate().raw
const x509 = await import('@peculiar/x509')
const parsedCert = new x509.X509Certificate(peerCert)
const sigAlgo = parsedCert.signatureAlgorithm
if (!sigAlgo) {
Expand Down
2 changes: 1 addition & 1 deletion packages/pg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"author": "Brian Carlson <[email protected]>",
"main": "./lib",
"dependencies": {
"@peculiar/x509": "^1.12.3",
"@peculiar/x509": "1.12.3",
"pg-connection-string": "^2.7.0",
"pg-pool": "^3.7.0",
"pg-protocol": "^1.7.0",
Expand Down

0 comments on commit a338521

Please sign in to comment.