DataDog / dd-native-appsec-js

Node.js bindings for libddwaf
Apache License 2.0
1 stars 3 forks source link

Updates node-addon-api #79

Closed vdeturckheim closed 8 months ago

vdeturckheim commented 1 year ago

@simon-id , please add some tests when you have a way to reproduce the issue

simon-id commented 10 months ago

Potentially solves #82

uurien commented 8 months ago

This PR fixes the problems related with worker_threads and the waf. Added a test to check that it is working fine. This PR also break the compatibility with node12, so next release should be a major release.

Here is a very short explanation about why this solves the problem: https://github.com/nodejs/node-addon-api/issues/711

Explanation: this example set the constructor static member of the class to a reference of the constructor function but if the addon is loaded multiple time (with worker_threads for example), the value is overwritten by a new reference in the new context. That makes this reference unusable to create new instances of this wrapped class from other C++ code and makes any code wanting to use this reference in another context crash.

vdeturckheim commented 8 months ago

🚀 🚀 🚀 image

vdeturckheim commented 8 months ago

image