-
Notifications
You must be signed in to change notification settings - Fork 435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tls.createSecurePair is being runtime-deprecated #515
Comments
@ChALkeR Thanks for the pointer. This will be helpful when we get to this. Feel free to send a PR if you feel inspired :-) |
@tvrprasad: @ChALkeR is part of the Node.js team and this post is mostly intended as a heads-up for us to know that this feature is deprecated. I don't think he actually uses @ChALkeR: I've known about this deprecation for a while, but the documentation around this deprecation is really sparse. The examples I've seen so far (like the PR for In TDS, the TLS upgrade is a lot more involved, all the handshaking packets need to be wrapped into TDS messages, and then once the connection is established, all further TLS packets don't need to be wrapped anymore. Implementing this via I'll try again when I get to it, but i don't think much has changed. Another issue I ran into is that wrapping a socket from the |
@arthurschreiber Thanks for the info :-)
If this work is on github, please send me a pointer. I'm curious to check it out. |
@tvrprasad @arthurschreiber Here is information on how to replace tls.createSecurePair https://nodejs.org/dist/latest-v6.x/docs/api/tls.html#tls_class_securepair |
Encoutered the same issue on Node v8.0.1. My app reports following error, after trying to establish an encrypted connexion:
I am using |
Same issue as @olange using node-mssql with tedious driver.
Please don't take me wrong and I really appreciate your efforts keeping this module up but Is there any prediction when it will be fixed? |
Using the package 'mssql' and using options: (node:13508) [DEP0064] DeprecationWarning: tls.createSecurePair() is deprecated. Please use tls.Socket instead. |
When Node team deprecates something like this whats the timeframe for removal in Node? Just curious. |
Probably will be removed in Node 9 or 10. The feature has been doc-deprecated for at least 4 years. :-/ This is one of the only popular NPM packages still using it. |
Does anyone from collaborators have any timeline on when the change will be released? |
Getting this today since I just updated our systems to node 8.9.0 lts. I've got two heavy projects right now, but if they both ease up, I'll see if I can spare some time to fixing this. |
@Iiridayn That would be awesome! |
Any progress on that? I'm facing the same issue trying to connect to Azure, just if it helps. Thank you in advance. |
@Jorgeee1 This is only a warning, it is unlikely to be the reason for your trouble. I am using tedious to connect to Azure DB, too, and it's working fine. |
I wrote a quick proof of concept of replacing This is obviously not a real solution to the issue at hand (unless eating extra sockets etc is OK). This is more of a discussion starter. It would be good to have actual suggestions and discussion on nodejs/help#1010. |
@joux3 that's awesome 😃 Can you create a PR? It will be easier to review and discuss there. |
Heavy projects have not eased up, a third has been added, and we've migrated to MySQL as well. Sorry I won't be able to fix this one - best of luck to you :). |
Please fix it, it is important problem |
Hey y'all, let me give a quick update on the current status here. I understand that the deprecation message might be a nuisance, but it is not really a problem. Also, nodejs/node#17882 proposes a re-implementation of Please let us know what you think! 😄 |
@arthurschreiber Fwiw, I also just published that |
@addaleax Sweet! ❤️ This is great and I'll see if I can hook this up and get us moved away from |
@arthurschreiber I think a patch for this could look as simple as this: diff --git a/package.json b/package.json
index bca5b266849d..8cc0ed957577 100644
--- a/package.json
+++ b/package.json
@@ -43,6 +43,7 @@
"babel-runtime": "^6.26.0",
"big-number": "0.3.1",
"bl": "^1.2.0",
+ "duplexpair": "^1.0.1",
"iconv-lite": "^0.4.11",
"readable-stream": "^2.2.6",
"sprintf": "0.1.5"
diff --git a/src/message-io.js b/src/message-io.js
index 6c2a15c32a9f..a1de3a1e91c0 100644
--- a/src/message-io.js
+++ b/src/message-io.js
@@ -1,7 +1,9 @@
+'use strict';
const tls = require('tls');
const crypto = require('crypto');
const EventEmitter = require('events').EventEmitter;
const Transform = require('readable-stream').Transform;
+const DuplexPair = require('duplexpair');
const Packet = require('./packet').Packet;
const TYPE = require('./packet').TYPE;
@@ -84,10 +86,14 @@ module.exports = class MessageIO extends EventEmitter {
startTls(credentialsDetails, hostname, trustServerCertificate) {
const credentials = tls.createSecureContext ? tls.createSecureContext(credentialsDetails) : crypto.createCredentials(credentialsDetails);
- this.securePair = tls.createSecurePair(credentials);
+ const duplexpair = new DuplexPair();
+ this.securePair = {
+ cleartext: new tls.TLSSocket(duplexpair.socket1),
+ encrypted: duplexpair.socket2
+ };
this.tlsNegotiationComplete = false;
- this.securePair.on('secure', () => {
+ this.securePair.cleartext.on('secure', () => {
const cipher = this.securePair.cleartext.getCipher();
if (!trustServerCertificate) { But this doesn’t seem to be tested as part of the regular test suite, so I’m not sure how to go about that… |
I gave a yet another shot at replacing SecurePair. The integration tests seem to be fine, tested on Node 9. joux3@6d255fb However I have some observations (but maybe the patch is good enough for a PR to discuss the issues?):
Huge thanks to @addaleax for your work! |
@joux3 is your fork ready for use with Node 8--the current LTS release? and is it possibly to open a pull request? I'd like to see if it resolves an issue I have using it in conjunction with https://github.com/patriksimek/node-mssql/ thank you! |
@joux3 Which test would that be? (I’m sorry, I’m not particularly familiar with this code base beyond what I’ve looked at for this issue) |
@addaleax, the failing test is tedious/test/integration/connection-retry-test.js Lines 73 to 104 in f5a0f95
Disabling the timer's here: https://github.com/tediousjs/tedious/pull/689/files#diff-ed1dc3ba8a10a8fb4b18a528b35bad00. Edit: I restored timer faking by only faking setTimeout ff5d5eb.
@jimmont, I opened a pull request at #689 (looks like referencing the issue id in the PR name is not enough...). Integration tests pass on Node 8, but there's still some work to do. |
👍 To fixing this ASAP! |
Any progress on this one? It'll be good if we can get an update on this issue. |
Linking PR #689 for tracking. |
In a world where warnings are sent to stderr instead of stdout. |
any update? |
#738 contains a fix and will be merged and released once reviewed by someone from the @tediousjs/microsoft-contributors team. |
After a long time of back and forth, this was finally (and properly) fixed via #738. Thanks everyone for your patience and help in getting this fixed! 🙇 |
Ref: nodejs/node#11349
Used in:
See also #135.
See e.g. sidorares/node-mysql2#367 for a feature detection example.
The text was updated successfully, but these errors were encountered: