![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Execute arbitrary JS with callbacks in node.js. Also counts asynchronous operations and does not return until all callbacks have been executed.
Note: This library actually uses vm.runInNewContext()
instead of eval()
for a bit more added security, though it doesn't fork a process, so it's best used with trusted code.
npm install async-eval
npm test
or
git clone https://github.com/dallonf/async-eval
npm install
npm test
var asyncEval = require('async-eval');
var someObject = {x: 5, y: 10};
function waitOneSecond(callback) {
setTimeout(callback, 1000);
}
var options = {
this: someObject,
asyncFunctions: {
waitOneSecond: waitOneSecond
}
}
asyncEval('waitOneSecond(function() { this.x += 2; });', options, function() {
console.log(someObject.x); // 7
});
asyncEval(code, [options], [callback])
asyncEval() will interpret and execute code
and run callback
when the code and every asynchronous function it calls has finished running.
this
Default: {}
Sets the object that will be used as this
in the executed code and any nested callbacks.
context
Default: {}
Sets the global context in the executed code. Put any synchronous DSL functions and global variables here.
asyncFunctions
Default: {}
Registers asynchronous functions into the context
. Asynchronous functions must be listed in the asyncFunctions
property so that asyncEval can count pending callbacks.
The functions registered in asyncFunctions
must take a callback as the last argument.
These functions can be namespaced with objects, for example:
asyncFunctions: {
users: {
get: function(callback) { /* ... */ },
create: function(user, callback) { /* ... */ },
},
posts: {
get: function(callback) { /* ... */ },
create: function(post, callback) { /* ... */ },
}
}
FAQs
Execute arbitrary JS with callbacks
The npm package async-eval receives a total of 0 weekly downloads. As such, async-eval popularity was classified as not popular.
We found that async-eval 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.