Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
lexical-scope
Advanced tools
detect global and local lexical identifiers from javascript source code
var detect = require('lexical-scope');
var fs = require('fs');
var src = fs.readFileSync(__dirname + '/src.js');
var scope = detect(src);
console.dir(scope);
input:
var x = 5;
var y = 3, z = 2;
w.foo();
w = 2;
RAWR=444;
RAWR.foo();
BLARG=3;
foo(function () {
var BAR = 3;
process.nextTick(function (ZZZZZZZZZZZZ) {
console.log('beep boop');
var xyz = 4;
x += 10;
x.zzzzzz;
ZZZ=6;
});
function doom () {
}
ZZZ.foo();
});
console.log(xyz);
output:
$ node example/detect.js
{ locals:
{ '': [ 'x', 'y', 'z' ],
'body.7.arguments.0': [ 'BAR', 'doom' ],
'body.7.arguments.0.body.1.arguments.0': [ 'xyz' ],
'body.7.arguments.0.body.2': [] },
globals:
{ implicit: [ 'w', 'foo', 'process', 'console', 'xyz' ],
exported: [ 'w', 'RAWR', 'BLARG', 'ZZZ' ] } }
var detect = require('lexical-scope')
Return a scope
structure from a javascript source string src
.
scope.locals
maps scope name keys to an array of local variable names declared
with var
. The key name ''
refers to the top-level scope.
scope.globals.implicit
contains the global variable names that are expected to
already exist in the environment by the script.
scope.globals.explicit
contains the global variable names that are exported by
the script.
With npm do:
npm install lexical-scope
MIT
FAQs
detect global and local lexical identifiers from javascript source code
The npm package lexical-scope receives a total of 16,213 weekly downloads. As such, lexical-scope popularity was classified as popular.
We found that lexical-scope demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.