mysql2 3.15.1 → 3.15.2-canary.fb9eae11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,7 @@
3
3
  const PLUGIN_NAME = 'sha256_password';
4
4
  const crypto = require('crypto');
5
5
  const { xorRotating } = require('../auth_41');
6
+ const Tls = require('tls');
6
7
 
7
8
  const REQUEST_SERVER_KEY_PACKET = Buffer.from([1]);
8
9
 
@@ -32,6 +33,14 @@ module.exports =
32
33
  return (data) => {
33
34
  switch (state) {
34
35
  case STATE_INITIAL:
36
+ if (
37
+ connection.stream instanceof Tls.TLSSocket &&
38
+ connection.stream.encrypted === true
39
+ ) {
40
+ // We don't need to encrypt passwords over TLS connection
41
+ return Buffer.from(`${password}\0`, 'utf8');
42
+ }
43
+
35
44
  scramble = data.slice(0, 20);
36
45
  // if client provides key we can save one extra roundrip on first connection
37
46
  if (pluginOptions.serverPublicKey) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mysql2",
3
- "version": "3.15.1",
3
+ "version": "3.15.2-canary.fb9eae11",
4
4
  "description": "fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS",
5
5
  "main": "index.js",
6
6
  "typings": "typings/mysql/index",