Giter Site home page Giter Site logo

lucabongiorni / scanjs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mozilla/scanjs

0.0 2.0 0.0 2.52 MB

Static analysis tool for javascript code based. Scanjs uses Acorn to convert sources to AST, then walks AST looking for patterns.

License: Other

scanjs's Introduction

scanjs

ScanJS is a Static analysis tool for javascript code. ScanJS was created as an aid for security review, to help identify security issues in client-side web applications. The

Scanjs uses Acorn to convert sources to AST, then walks AST looking for source patterns

ScanJS Rules

Rules are specified in JSON format - for an example see /common/template_rules.json

At a minimum, each must have rule is made up of 2 attributes:

  • name: the name of the rule
  • source: javascript source which matches one of the patterns below

The following statements are supported:

identifier: matches any identifier , e.g. "foo" property: matches any property

Optionally a rule may have the following attirbutes:

  • testhit: one more JavaScript statements (seperate by semi-colons) that the rule will match
  • testmiss: the rule should not match any of these statements
  • desc: description of the rule
  • threat: for catgorizing rules by threat

Run ScanJS in the browser

Run ScanJS from the command line

  • Install node.js
  • npm install -g mozilla/scanjs
  • scanjs -t DIRECTORY_PATH

Testing instructions

Tests use the mocha testing framework.

  • scanjs-server
  • http://127.0.0.1:4000/tests/

Tests are included in the rules declaration (see common/rules.json) by specifying the following two attributes, which are specified in the form of a series of javascript statements:

  • testhit: The rule should match each of these statements individualy.
  • testmiss: The rule should not match all of these statements.

scanjs's People

Contributors

mozfreddyb avatar dbkaplun avatar defreez avatar nmaier avatar arroway avatar

Watchers

James Cloos avatar  avatar

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.