Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
eval-abfork
Advanced tools
Evaluate node require() module content directly, aminbros fork, https://github.com/pierrec/node-eval
This module is a simple way to evaluate a module content in the same way as require() but without loading it from a file. Effectively, it mimicks the javascript evil eval
function but leverages Node's VM module instead.
Why would you be using the eval
module over the nativerequire
? Most of the time require
is fine but in some situations, I have found myself wishing for the following:
Or simply to leverage JavaScript's eval
but with sandboxing.
It is published on node package manager (npm). To install, do:
npm install eval
var _eval = require('eval')
var res = _eval(content /*, filename, scope, includeGlobals */)
The following options are available:
content
(String): the content to be evaluatedfilename
(String): optional dummy name to be given (used in stacktraces)scope
(Object): scope properties are provided as variables to the contentincludeGlobals
(Boolean): allow/disallow global variables (and require) to be supplied to the content (default=false)var _eval = require('eval')
var res = _eval('var x = 123; exports.x = x')
// => res === { x: 123 }
res = _eval('module.exports = function () { return 123 }')
// => res() === 123
res = _eval('module.exports = require("events")', true)
// => res === require('events')
res = _eval('exports.x = process', true)
// => res.x === process
FAQs
Evaluate node require() module content directly, aminbros fork, https://github.com/pierrec/node-eval
The npm package eval-abfork receives a total of 0 weekly downloads. As such, eval-abfork popularity was classified as not popular.
We found that eval-abfork demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.