Giter VIP home page Giter VIP logo

analyzer's Issues

Runtime code analysis

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.

WASM

WASMify the nest_analyzer to be used in web. Use wasm-bindgen and wasm-pack

static: implement basic rules

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. - #5
  • check-deno-run - This will be configurable, user will provide the particular command to be banned by the analyzer that is executed by Deno.run - #6
  • ban-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

imports analysis: panicked when src is incorrect

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.