Skip to content

Conversation

@esarafianou
Copy link

@esarafianou esarafianou commented Dec 17, 2018

  1. Updates lodash, ms
  2. Updates tests to run on Node 6 and 8

vulnerability reports:

@esarafianou esarafianou force-pushed the snyk branch 5 times, most recently from 98059d2 to b5b6eae Compare December 21, 2018 17:15
@esarafianou esarafianou reopened this Dec 27, 2018
client.js Outdated
}, circuitBreakerParams);
this.disyuntor = new Disyuntor(circuitBreakerParams);

this._protectedRequest = (...args) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why to use this format instead of Disyuntor.wrapCallbackApi which works pretty similar as before?

Copy link
Author

@esarafianou esarafianou Dec 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we use the old disyuntor.reset() which is now available only if we use the class Disyuntor.
https://github.com/limitd/node-client/pull/13/files#diff-215b25d5bf5c0b4623ad1a2b62456f60L127

Copy link
Author

@esarafianou esarafianou Dec 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you check the Note here: https://github.com/auth0/disyuntor#complex-scenarios this api supports only promise-returning functions and I had to write a similar wrapCallbackApi
by myself here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:( This is a pity the code is really complex for such a simple use case. Maybe we should add the feature to disyuntor before making the change.

package.json Outdated
"dependencies": {
"async": "^2.3.0",
"disyuntor": "^2.0.0",
"disyuntor": "^3.4.2",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We found several critical issues in this version of disyuntor, please update to 3.4.3

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any vulnerable code in the version 2 of disyuntor? I'd advice not to update otherwise, 2.0.0 is really stable whereas 3 is not so battle tested and changes a lot + limitd is a service where each deployment involves downtime

client.js Outdated

this._protectedRequest = (...args) => {
const callback = args[args.length - 1];
this.disyuntor.protect((resolve, reject) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why resolve, reject here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is overridden bellow

client.js Outdated
const newArgs = args.slice(0, -1)
this._directRequest(...newArgs, (err, ...args) => {
if (err) {return reject(err); }
resolve(...args);
Copy link
Contributor

@dafortune dafortune Jan 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve takes a single value, if you need to support more than one then you need to resolve with an array and the in the "then" you can unwrap the array.

new Promise((resolve) => { resolve('a', 'b'); })
Promise {<resolved>: "a"}__proto__: Promise[[PromiseStatus]]: "resolved"[[PromiseValue]]: "a"

@esarafianou esarafianou force-pushed the snyk branch 2 times, most recently from 3cfab3d to 07e38e7 Compare January 25, 2019 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants