Javascript Cheatsheets

[BASIC]

[JAVASCRIPT]

Call to function

Finds function calls of the form `eval(...)`

[BASIC]

[JAVASCRIPT]

Callbacks

Finds functions that are passed as arguments to other functions

[BASIC]

[JAVASCRIPT]

Class with implicit default constructor

Finds classes that do not declare an explicit constructor

[BASIC]

[JAVASCRIPT]

Constant property name in `[]` property access

Finds property accesses using the square bracket notation where the property name is a constant string

[BASIC]

[JAVASCRIPT]

Declaration of variable

Finds places where we declare a variable called `v`

[EXPERT]

[JAVASCRIPT]

Decoding after sanitization (generalized)

Tracks the return value of an HTML sanitizer into an escape-sequence decoder, indicating an ineffective sanitization attempt.

[EXPERT]

[JAVASCRIPT]

Decoding after sanitization

Tracks the return value of 'escapeHtml' into 'decodeURI', indicating an ineffective sanitization attempt.

[BASIC]

[JAVASCRIPT]

Default exports exporting a function

Finds 'default' exports that export a function

[BASIC]

[JAVASCRIPT]

Empty block

Finds empty block statements

[BASIC]

[JAVASCRIPT]

Empty yield

Finds yield expressions without an operand

[BASIC]

[JAVASCRIPT]

Equalities as expression statement

Finds `==` equality expressions that form an expression statement

[EXPERT]

[JAVASCRIPT]

Extension of standard query: Stored XSS (with TrackedNode)

Extends the standard Stored XSS query with an additional source, using TrackedNode to track MySQL connections globally.

[EXPERT]

[JAVASCRIPT]

Extension of standard query: Stored XSS

Extends the standard Stored XSS query with an additional source.

[BASIC]

[JAVASCRIPT]

File with given name

Finds files called `index.js`

[BASIC]

[JAVASCRIPT]

Find class

Finds classes called 'File'

[BASIC]

[JAVASCRIPT]

Find-references links

Generates use-definition pairs that provide the data for find-references in the code viewer.

[BASIC]

[JAVASCRIPT]

Functions with many parameters

Finds functions with more than ten parameters

[BASIC]

[JAVASCRIPT]

Functions without return statements

Finds functions that do not contain a return statement

[BASIC]

[JAVASCRIPT]

Generator functions (function* foo(...))

Finds generator functions

[EXPERT]

[JAVASCRIPT]

IDOR through request to backend service

Finds cases where the 'userId' field in a request to another service is an arbitrary user-controlled value, indicating lack of authentication.

[BASIC]

[JAVASCRIPT]

If statements with empty then branch

Finds 'if' statements where the 'then' branch is an empty block statement

[BASIC]

[JAVASCRIPT]

Immediately invoked function expressions

Finds calls of the form `(function(...) { ... })(...)`

[BASIC]

[JAVASCRIPT]

Imports from 'react'

Finds import statements that import from module 'react'

[EXPERT]

[JAVASCRIPT]

Information disclosure through postMessage

Tracks values from an 'authKey' property into a postMessage call with unrestricted origin, indicating a leak of sensitive information.

[BASIC]

[JAVASCRIPT]

JSX attributes

Finds JSX attributes named `dangerouslySetInnerHTML`

[BASIC]

[JAVASCRIPT]

Jump-to-definition links

Generates use-definition pairs that provide the data for jump-to-definition in the code viewer.

[BASIC]

[JAVASCRIPT]

Method calls

Finds calls of the form `this.isMounted(...)`

[BASIC]

[JAVASCRIPT]

Method search

Finds methods named 'render'

[BASIC]

[JAVASCRIPT]

Named function expression

Finds function expressions that have a name

[BASIC]

[JAVASCRIPT]

New expressions

Finds new expressions of the form `new RegExp(...)`

[BASIC]

[JAVASCRIPT]

Parameters searched by name

Finds parameters called 'arguments'

[BASIC]

[JAVASCRIPT]

Print source code AST

Outputs a representation of a file's Abstract Syntax Tree. This query is used by the VS Code extension.

[BASIC]

[JAVASCRIPT]

Property accesses

Finds property accesses of the form `x.innerHTML`

[BASIC]

[JAVASCRIPT]

References of a variable by name

Finds places where we reference a variable called `var`

[BASIC]

[JAVASCRIPT]

Single-quoted string literals

Finds string literals using single quotes

[BASIC]

[JAVASCRIPT]

Singleton blocks

Finds block statements containing a single statement

[BASIC]

[JAVASCRIPT]

Tagged templates

Finds tagged template expressions

[EXPERT]

[JAVASCRIPT]

Taint-tracking to 'eval' calls (with path visualization)

Tracks user-controlled values into 'eval' calls (special case of js/code-injection), and generates a visualizable path from the source to the sink.

[ADVANCED]

[JAVASCRIPT]

Taint-tracking to 'eval' calls

Tracks user-controlled values into 'eval' calls (special case of js/code-injection).

[EXPERT]

[JAVASCRIPT]

Template injection

Tracks user-controlled values to an unescaped lodash template placeholder.

[BASIC]

[JAVASCRIPT]

Tests for even numbers

Finds expressions of the form `e % 2 === 0`

[BASIC]

[JAVASCRIPT]

TODO comments

Finds comments containing the word TODO