source code (white-box testing). • Can use project specific rules. • Can be automated. • Highly effective with specific patterns. • Early detection of potential issues.
Javascript Applications is more common. • Testing infrastructure in Javascript too! • Goal: One language can give more flexibility to teams. • Goal: Run static code analysis on CI / nightly builds. • Goal: Leverage existing tools available in the Javascript community.
way to filter successive scan results. • False negatives – Some vulnerabilities need to be discovered via dynamic code analysis. – Unaware of custom APIs, cross layer vulnerabilities, or configuration files. – Add custom rules to mitigate.
AST. • Abstract Syntax Tree: represents program structure. Parser Token s AST Type Value Keyword var Identifier foo Punctuator = Identifier bar Punctuator ; VariableDeclaration bar foo Syntactic Grammar
– Collect dynamic information about data by analyzing static information. – Determine the Control Flows for a given program. if (a > 1) { pathA(a); } else { pathB(1); } if path A path B end- if
no command line tools makes it hard to integrate with build tools. • Developed by Mozilla, unfortunately deprecated, but lives on as plugin for ESLint: eslint-config-scanjs. DEMO
Pluggable architecture: – All rules are plugins, more can be added at runtime. – Different parsers can be used (Esprima, Espree or Babel are currently compatible). – Language extensions specified at configuration. – Global variables predefined through Environments. • Integrates with editors, build systems, command line tools, and more!