This package causes applications to fail to start if using NodeJS's --disallow-code-generation-from-strings security option, even if the application is not using a deprecated function, due to the use of dynamically generated code:
|
var deprecatedfn = new Function('fn', 'log', 'deprecate', 'message', 'site', |
This could be fixed in multiple ways:
- Replace dynamic code generation with a non-dynamic version (I'm not actually sure why it generates an argument list which it doesn't use in the body?); or
- Catch the
EvalError exception which gets thrown in this environment and fall-back to a simpler alternative; or
- Catch the
EvalError and fall-back to a pass-through (just return fn unchanged), since warning about deprecated functions seems more useful at dev-time than in production anyway.
Since this package is being used by express, it seems especially useful to be able to run with additional security options enabled. This is the only change needed to let express run with --disallow-code-generation-from-strings.
This package causes applications to fail to start if using NodeJS's
--disallow-code-generation-from-stringssecurity option, even if the application is not using a deprecated function, due to the use of dynamically generated code:nodejs-depd/index.js
Line 425 in 73364d0
This could be fixed in multiple ways:
EvalErrorexception which gets thrown in this environment and fall-back to a simpler alternative; orEvalErrorand fall-back to a pass-through (just returnfnunchanged), since warning about deprecated functions seems more useful at dev-time than in production anyway.Since this package is being used by
express, it seems especially useful to be able to run with additional security options enabled. This is the only change needed to letexpressrun with--disallow-code-generation-from-strings.