Skip to content

fix: avoid mutating ssl connection options - #2586

Open
puneetdixit200 wants to merge 1 commit into
mysqljs:masterfrom
puneetdixit200:fix/ssl-config-mutation
Open

fix: avoid mutating ssl connection options#2586
puneetdixit200 wants to merge 1 commit into
mysqljs:masterfrom
puneetdixit200:fix/ssl-config-mutation

Conversation

@puneetdixit200

Copy link
Copy Markdown

Fixes #2380.

This copies SSL option objects before applying the default rejectUnauthorized value. The connection config still defaults rejectUnauthorized to true, but the caller-provided ssl object and shared SSL profile objects are left unchanged.

Validation:

  • FILTER=unit/test-ConnectionConfig npm_config_cache=/tmp/mysql-2380-npm-cache npm test
  • npm_config_cache=/tmp/mysql-2380-npm-cache npm run lint
  • Reproduction check: mysql.createConnection({ ssl: {} }) leaves the original config as { "ssl": {} } while connection.config.ssl.rejectUnauthorized is true
  • Broader FILTER=unit npm test was attempted on Node 24 and Node 18; existing SSL fake-server tests fail locally because modern OpenSSL rejects the repo test certs (ee key too small on Node 24, expired certificate on Node 18), while the focused config tests pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

createConnection reassigns ssl parameter

1 participant