Update Bot

This commit is contained in:
2026-03-15 11:58:43 +01:00
parent b67c111ffc
commit cd99275933
560 changed files with 23173 additions and 55113 deletions

View File

@@ -3,7 +3,6 @@
const PLUGIN_NAME = 'sha256_password';
const crypto = require('crypto');
const { xorRotating } = require('../auth_41');
const Tls = require('tls');
const REQUEST_SERVER_KEY_PACKET = Buffer.from([1]);
@@ -33,14 +32,6 @@ module.exports =
return (data) => {
switch (state) {
case STATE_INITIAL:
if (
connection.stream instanceof Tls.TLSSocket &&
connection.stream.encrypted === true
) {
// We don't need to encrypt passwords over TLS connection
return Buffer.from(`${password}\0`, 'utf8');
}
scramble = data.slice(0, 20);
// if client provides key we can save one extra roundrip on first connection
if (pluginOptions.serverPublicKey) {

View File

@@ -345,9 +345,7 @@ class BaseConnection extends EventEmitter {
});
const rejectUnauthorized = this.config.ssl.rejectUnauthorized;
const verifyIdentity = this.config.ssl.verifyIdentity;
const servername = Net.isIP(this.config.host)
? undefined
: this.config.host;
const servername = this.config.host;
let secureEstablished = false;
this.stream.removeAllListeners('data');
@@ -412,37 +410,6 @@ class BaseConnection extends EventEmitter {
this.emit('error', err);
}
get state() {
// Error state has highest priority
if (this._fatalError || this._protocolError) {
return 'error';
}
// Closing state has second priority
if (this._closing || (this.stream && this.stream.destroyed)) {
return 'disconnected';
}
// Authenticated state has third priority
if (this.authorized) {
return 'authenticated';
}
// Connected state: handshake completed but not yet authorized
// This matches the original mysql driver's 'connected' state
if (this._handshakePacket) {
return 'connected';
}
// Protocol handshake state: connection established, handshake in progress
if (this.stream && !this.stream.destroyed) {
return 'protocol_handshake';
}
// Default: not connected
return 'disconnected';
}
get fatalError() {
return this._fatalError;
}

View File

@@ -48,6 +48,7 @@ class ClientHandshake extends Command {
sendCredentials(connection) {
if (connection.config.debug) {
// eslint-disable-next-line
console.log(
'Sending handshake packet: flags:%d=(%s)',
this.clientFlags,
@@ -110,6 +111,7 @@ class ClientHandshake extends Command {
});
this.handshake = Packets.Handshake.fromPacket(helloPacket);
if (connection.config.debug) {
// eslint-disable-next-line
console.log(
'Server hello packet: capability flags:%d=(%s)',
this.handshake.capabilityFlags,

View File

@@ -39,7 +39,7 @@ class Query extends Command {
then() {
const err =
"You have tried to call .then(), .catch(), or invoked await on the result of query that is not a promise, which is a programming error. Try calling con.promise().query(), or require('mysql2/promise') instead of 'mysql2' for a promise-compatible version of the query interface. To learn how to use async/await or Promises check out documentation at https://sidorares.github.io/node-mysql2/docs#using-promise-wrapper, or the mysql2 documentation at https://sidorares.github.io/node-mysql2/docs/documentation/promise-wrapper";
// eslint-disable-next-line
console.log(err);
throw new Error(err);
}
@@ -47,6 +47,7 @@ class Query extends Command {
/* eslint no-unused-vars: ["error", { "argsIgnorePattern": "^_" }] */
start(_packet, connection) {
if (connection.config.debug) {
// eslint-disable-next-line
console.log(' Sending query command: %s', this.sql);
}
this._connection = connection;
@@ -118,6 +119,7 @@ class Query extends Command {
const rs = new Packets.ResultSetHeader(packet, connection);
this._fieldCount = rs.fieldCount;
if (connection.config.debug) {
// eslint-disable-next-line
console.log(
` Resultset header received, expecting ${rs.fieldCount} column definition packets`
);
@@ -199,10 +201,12 @@ class Query extends Command {
);
this._fields[this._resultIndex].push(field);
if (connection.config.debug) {
/* eslint-disable no-console */
console.log(' Column definition:');
console.log(` name: ${field.name}`);
console.log(` type: ${field.columnType}`);
console.log(` flags: ${field.flags}`);
/* eslint-enable no-console */
}
}
// last field received
@@ -231,6 +235,7 @@ class Query extends Command {
return this.row;
}
/* eslint no-unused-vars: ["error", { "argsIgnorePattern": "^_" }] */
row(packet, _connection) {
if (packet.isEOF()) {
const status = packet.eofStatusFlags();

View File

@@ -168,6 +168,7 @@ class ServerHandshake extends Command {
if (connection.listeners('packet').length) {
connection.emit('packet', packet.clone(), knownCommand, commandCode);
} else if (!knownCommand) {
// eslint-disable-next-line no-console
console.log('Unknown command:', commandCode);
}
return ServerHandshake.prototype.dispatchCommands;

View File

@@ -87,6 +87,7 @@ class ConnectionConfig {
if (!Object.prototype.hasOwnProperty.call(options, key)) continue;
if (validOptions[key] !== 1) {
// REVIEW: Should this be emitted somehow?
// eslint-disable-next-line no-console
console.error(
`Ignoring invalid configuration option passed to Connection: ${key}. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection`
);
@@ -130,7 +131,7 @@ class ConnectionConfig {
) {
// strictly supports timezones specified by mysqljs/mysql:
// https://github.com/mysqljs/mysql#user-content-connection-options
// eslint-disable-next-line no-console
console.error(
`Ignoring invalid timezone passed to Connection: ${options.timezone}. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection`
);
@@ -281,7 +282,7 @@ class ConnectionConfig {
try {
// Try to parse this as a JSON expression first
options[key] = JSON.parse(value);
} catch {
} catch (err) {
// Otherwise assume it is a plain string
options[key] = value;
}

View File

@@ -31,6 +31,7 @@ exports.CONNECT_ATTRS = 0x00100000; /* permits connection attributes */
exports.PLUGIN_AUTH_LENENC_CLIENT_DATA = 0x00200000; /* Understands length-encoded integer for auth response data in Protocol::HandshakeResponse41. */
exports.CAN_HANDLE_EXPIRED_PASSWORDS = 0x00400000; /* Announces support for expired password extension. */
exports.SESSION_TRACK = 0x00800000; /* Can set SERVER_SESSION_STATE_CHANGED in the Status Flags and send session-state change data after a OK packet. */
exports.DEPRECATE_EOF = 0x01000000; /* Can send OK after a Text Resultset. */
exports.SSL_VERIFY_SERVER_CERT = 0x40000000;
exports.REMEMBER_OPTIONS = 0x80000000;

5
node_modules/mysql2/lib/helpers.js generated vendored
View File

@@ -28,9 +28,10 @@ try {
// the purpose of this is to prevent projects using Webpack from displaying a warning during runtime if cardinal is not a dependency
const REQUIRE_TERMINATOR = '';
highlightFn = require(`cardinal${REQUIRE_TERMINATOR}`).highlight;
} catch {
} catch (err) {
highlightFn = (text) => {
if (!cardinalRecommended) {
// eslint-disable-next-line no-console
console.log('For nicer debug output consider install cardinal@^2.0.0');
cardinalRecommended = true;
}
@@ -42,7 +43,9 @@ try {
* Prints debug message with code frame, will try to use `cardinal` if available.
*/
function printDebugWithCode(msg, code) {
// eslint-disable-next-line no-console
console.log(`\n\n${msg}:\n`);
// eslint-disable-next-line no-console
console.log(`${highlightFn(code)}\n`);
}

View File

@@ -73,6 +73,7 @@ class Packet {
}
dump() {
// eslint-disable-next-line no-console
console.log(
[this.buffer.asciiSlice(this.start, this.end)],
this.buffer.slice(this.start, this.end),
@@ -226,7 +227,7 @@ class Packet {
res = resNumber.toString() === resString ? resNumber : resString;
return bigNumberStrings ? resString : res;
}
// eslint-disable-next-line no-console
console.trace();
throw new Error(`Should not reach here: ${tag}`);
}

View File

@@ -9,10 +9,10 @@ module.exports = function (command, connectionStream) {
options = options || {};
options.objectMode = true;
((stream = new Readable(options)),
(stream = new Readable(options)),
(stream._read = function () {
connectionStream.resume();
}));
});
this.on('result', (row, i) => {
if (!stream.push(row)) {

52
node_modules/mysql2/package.json generated vendored
View File

@@ -1,6 +1,6 @@
{
"name": "mysql2",
"version": "3.16.3",
"version": "3.15.1",
"description": "fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS",
"main": "index.js",
"typings": "typings/mysql/index",
@@ -12,12 +12,6 @@
"test:bun": "bun poku -d --sequential test/esm test/unit test/integration",
"test:deno": "deno run --allow-read --allow-env --allow-run npm:poku -d --sequential --denoAllow=\"read,env,net,sys\" test/esm test/unit test/integration",
"test:tsc-build": "cd \"test/tsc-build\" && npx tsc -p \"tsconfig.json\"",
"test:docker:up": "docker compose -f test/docker-compose.yml up --abort-on-container-exit --remove-orphans",
"test:docker:down": "docker compose -f test/docker-compose.yml down",
"test:docker:node": "npm run test:docker:up -- node && npm run test:docker:down",
"test:docker:bun": "npm run test:docker:up -- bun && npm run test:docker:down",
"test:docker:deno": "npm run test:docker:up -- deno && npm run test:docker:down",
"test:docker:coverage": "npm run test:docker:up -- coverage && npm run test:docker:down",
"coverage-test": "c8 npm run test",
"benchmark": "node ./benchmarks/benchmark.js",
"wait-port": "wait-on"
@@ -52,35 +46,35 @@
"author": "Andrey Sidorov <andrey.sidorov@gmail.com>",
"license": "MIT",
"dependencies": {
"aws-ssl-profiles": "^1.1.2",
"aws-ssl-profiles": "^1.1.1",
"denque": "^2.1.0",
"generate-function": "^2.3.1",
"iconv-lite": "^0.7.2",
"long": "^5.3.2",
"lru.min": "^1.1.3",
"named-placeholders": "^1.1.6",
"iconv-lite": "^0.7.0",
"long": "^5.2.1",
"lru.min": "^1.0.0",
"named-placeholders": "^1.1.3",
"seq-queue": "^0.0.5",
"sqlstring": "^2.3.3"
"sqlstring": "^2.3.2"
},
"devDependencies": {
"@eslint/eslintrc": "^3.3.3",
"@eslint/js": "^9.39.2",
"@eslint/markdown": "^7.5.1",
"@types/node": "^25.0.9",
"@typescript-eslint/eslint-plugin": "^8.53.0",
"@typescript-eslint/parser": "^8.53.0",
"assert-diff": "^3.0.4",
"@eslint/eslintrc": "^3.3.0",
"@eslint/js": "^9.21.0",
"@eslint/markdown": "^7.0.0",
"@types/node": "^24.0.0",
"@typescript-eslint/eslint-plugin": "^8.26.0",
"@typescript-eslint/parser": "^8.26.0",
"assert-diff": "^3.0.2",
"benchmark": "^2.1.4",
"c8": "^10.1.3",
"error-stack-parser": "^2.1.4",
"eslint-config-prettier": "^10.1.8",
"c8": "^10.1.1",
"error-stack-parser": "^2.0.3",
"eslint-config-prettier": "^10.0.2",
"eslint-plugin-async-await": "^0.0.0",
"eslint-plugin-markdown": "^5.1.0",
"eslint-plugin-prettier": "^5.5.5",
"globals": "^17.0.0",
"poku": "^3.0.2",
"portfinder": "^1.0.38",
"prettier": "^3.8.0",
"typescript": "^5.9.3"
"eslint-plugin-prettier": "^5.2.3",
"globals": "^16.0.0",
"poku": "^3.0.0",
"portfinder": "^1.0.28",
"prettier": "^3.0.0",
"typescript": "^5.0.2"
}
}

3
node_modules/mysql2/promise.d.ts generated vendored
View File

@@ -10,7 +10,6 @@ import {
PoolOptions,
PoolClusterOptions,
Pool as CorePool,
ConnectionState,
} from './index.js';
import { ExecutableBase as ExecutableBaseClass } from './typings/mysql/lib/protocol/sequences/promise/ExecutableBase.js';
import { QueryableBase as QueryableBaseClass } from './typings/mysql/lib/protocol/sequences/promise/QueryableBase.js';
@@ -45,8 +44,6 @@ export interface Connection extends QueryableAndExecutableBase {
threadId: number;
readonly state: ConnectionState;
connect(): Promise<void>;
ping(): Promise<void>;

View File

@@ -39,7 +39,6 @@ export * from './lib/protocol/packets/index.js';
export * from './lib/Auth.js';
export * from './lib/constants/index.js';
export * from './lib/parsers/index.js';
export * from './lib/Connection.js';
// Expose class interfaces
export interface Connection extends BaseConnection {}

View File

@@ -339,13 +339,6 @@ export interface ConnectionOptions {
gracefulEnd?: boolean;
}
export type ConnectionState =
| 'disconnected'
| 'protocol_handshake'
| 'connected'
| 'authenticated'
| 'error';
declare class Connection extends QueryableBase(ExecutableBase(EventEmitter)) {
config: ConnectionOptions;
@@ -353,8 +346,6 @@ declare class Connection extends QueryableBase(ExecutableBase(EventEmitter)) {
authorized: boolean;
readonly state: ConnectionState;
static createQuery<
T extends
| RowDataPacket[][]