nestdotland / analyzer Goto Github PK
View Code? Open in Web Editor NEWAnalyze and Detect broken and malicious JS/TS modules.
Home Page: https://analyzer.nest.land
License: MIT License
Analyze and Detect broken and malicious JS/TS modules.
Home Page: https://analyzer.nest.land
License: MIT License
No npm. Use nest.land and import into website via module script type.
Before passing the code to the runtime analyzer, we use babel to transform the code into acornjs parsable code. So why not use swc in that case?
Following on from discord discussion:
I think something like depcheck
would be better suited for this project, and i'll probably just archive my repo
Thoughts?
References
NPM's depcheck: https://www.npmjs.com/package/depcheck
Deno's depcheck that I made: https://github.com/ebebbington/depcheck
Using either napi-rs or neon
The static code analysis is not able to detect runtime behaviour, eg: let a = Deno["run"]; a({ cmd: "shutdown" })
therefore we need a runtime code analyzer using Iroh.js.
WASMify the nest_analyzer to be used in web. Use wasm-bindgen
and wasm-pack
Integrate sauron_core into the static analyzer and
Implement module score calculation.
cc @Qu4k ๐
Feel free to take up one of these.
ban-deno-run
- Report if Deno.run
is called.ban-deno-plugin
- Report if Deno.openPlugin
is called. - #5check-deno-run
- This will be configurable, user will provide the particular command to be banned by the analyzer that is executed by Deno.run
- #6ban-deno-env
- Report if Deno.env
is called.ban-deno-get-env
- Report if Deno.env.get
is called.ban-deno-set-env
- Report if Deno.env.set
is called.check-deno-get-env
- Configurable, ban a particular env that is card with Deno.env.get
check-deno-set-env
- Configurable, ban a particular env that is card with Deno.env.set
Hi Divy
I'm currently working on a rewrite of the dep tree module but I'm facing a few issues
Consider the folloing code:
import init, { source, tree } from "https://x.nest.land/[email protected]/wasm/wasm.js";
await init(source);
try {
tree("", "{{");
} catch (err) {
console.log(err);
}
try {
tree("", "const x = 5;");
} catch (err) {
console.log(err);
}
The first call analyzes {{
. This code is obviously not valid javascript.
Some error messages are displayed even if I remove the console.log
.
The second call analyzes const x = 5;
which is valid javascript but the wasm function is still stuck.
panicked at 'called `Result::unwrap()` on an `Err` value: SwcDiagnosticBuffer { diagnostics: ["Unexpected eof at :1:2"] }', src/lib.rs:19:6
Stack:
Error
at Y.g.wbg.__wbg_new_59cb74e423758ede (https://3cfd3lulgczqtos7nd7bcmymng2nybpbdzsdljvpo64uo3vyx4kq.arweave.net/2Io9roswswm6X2j-ETMMabTcBeEeZDWmr3e5R264vxU/wasm/wasm.js:2:1169976)
at <anonymous> (<anonymous>:0:638559)
at <anonymous> (<anonymous>:0:791204)
at <anonymous> (<anonymous>:0:673555)
at <anonymous> (<anonymous>:0:770656)
at <anonymous> (<anonymous>:0:778289)
at <anonymous> (<anonymous>:0:742880)
at tree (<anonymous>:0:558415)
at tree (https://3cfd3lulgczqtos7nd7bcmymng2nybpbdzsdljvpo64uo3vyx4kq.arweave.net/2Io9roswswm6X2j-ETMMabTcBeEeZDWmr3e5R264vxU/wasm/wasm.js:2:1168676)
at graph.ts:137:3
RuntimeError: unreachable
at <anonymous> (<anonymous>:0:673586)
at <anonymous> (<anonymous>:0:770656)
at <anonymous> (<anonymous>:0:778289)
at <anonymous> (<anonymous>:0:742880)
at tree (<anonymous>:0:558415)
at tree (https://3cfd3lulgczqtos7nd7bcmymng2nybpbdzsdljvpo64uo3vyx4kq.arweave.net/2Io9roswswm6X2j-ETMMabTcBeEeZDWmr3e5R264vxU/wasm/wasm.js:2:1168676)
at graph.ts:137:3
panicked at 'cannot modify the panic hook from a panicking thread', src/libstd/panicking.rs:106:9
Stack:
Error
at Y.g.wbg.__wbg_new_59cb74e423758ede (https://3cfd3lulgczqtos7nd7bcmymng2nybpbdzsdljvpo64uo3vyx4kq.arweave.net/2Io9roswswm6X2j-ETMMabTcBeEeZDWmr3e5R264vxU/wasm/wasm.js:2:1169976)
at <anonymous> (<anonymous>:0:638559)
at <anonymous> (<anonymous>:0:791204)
at <anonymous> (<anonymous>:0:673555)
at <anonymous> (<anonymous>:0:778894)
at tree (<anonymous>:0:558349)
at tree (https://3cfd3lulgczqtos7nd7bcmymng2nybpbdzsdljvpo64uo3vyx4kq.arweave.net/2Io9roswswm6X2j-ETMMabTcBeEeZDWmr3e5R264vxU/wasm/wasm.js:2:1168676)
at graph.ts:143:3
RuntimeError: unreachable
at <anonymous> (<anonymous>:0:673584)
at <anonymous> (<anonymous>:0:778894)
at tree (<anonymous>:0:558349)
at tree (https://3cfd3lulgczqtos7nd7bcmymng2nybpbdzsdljvpo64uo3vyx4kq.arweave.net/2Io9roswswm6X2j-ETMMabTcBeEeZDWmr3e5R264vxU/wasm/wasm.js:2:1168676)
at graph.ts:143:3
I really don't have any rust skills, I'd like to fix this bug, but I can't ๐
I've looked for other AST parsers but yours is really the most suitable.
Deno.run and other methods can also be called using native op dispatch calls, so analyze them too ๐
Use docosaurus or vuepress for documenting the analyzer
Instead of using browser bundles, publish to nest.land.
The runtime analysis is only possible in Deno so to use in the website some kind of API endpoint has to be exposed using vercel.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.