Pewarta Proxy

πŸ“‹ Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

βš™οΈ Pengaturan Proxy Target

CodeQL documentation

Data flow cheat sheet for JavaScriptΒΆ

This article describes parts of the JavaScript libraries commonly used for variant analysis and in data flow queries.

Taint tracking path queriesΒΆ

Use the following template to create a taint tracking path query:

/**
 * @kind path-problem
 */
import javascript

module MyConfig implements DataFlow::ConfigSig {
  predicate isSource(DataFlow::Node node) { ... }
  predicate isSink(DataFlow::Node node) { ... }
  predicate isAdditionalFlowStep(DataFlow::Node pred, DataFlow::Node succ) { ... }
}

module MyFlow = TaintTracking::Global<MyConfig>;

from MyFlow::PathNode source, MyFlow::PathNode sink
where MyFlow::flowPath(source, sink)
select sink.getNode(), source, sink, "taint from $@.", source.getNode(), "here"

This query reports flow paths which:

  • Begin at a node matched by isSource.

  • Step through variables, function calls, properties, strings, arrays, promises, exceptions, and steps added by isAdditionalTaintStep.

  • End at a node matched by isSink.

See also: β€œGlobal data flow” and β€œCreating path queries.”

DataFlow moduleΒΆ

Use data flow nodes to match program elements independently of syntax. See also: β€œAnalyzing data flow in JavaScript and TypeScript.”

Predicates in the DataFlow:: module:

Classes and member predicates in the DataFlow:: module:

StringOps moduleΒΆ

  • StringOps::Concatenation – string concatenation, using a plus operator, template literal, or array join call

  • StringOps::StartsWith – check if a string starts with something

  • StringOps::EndsWith – check if a string ends with something

  • StringOps::Includes – check if a string contains something

  • StringOps::RegExpTest – check if a string matches a RegExp

UtilityΒΆ

System and NetworkΒΆ

Untrusted dataΒΆ

Note: some RemoteFlowSource instances, such as input from a web socket, belong to none of the specific subcategories above.

FilesΒΆ

AST nodesΒΆ

See also: β€œAbstract syntax tree classes for working with JavaScript and TypeScript programs.”

Conversion between DataFlow and AST nodes:

String matchingΒΆ

  • x.matches(β€œescape%”) – holds if x starts with β€œescape”

  • x.regexpMatch(β€œescape.*”) – holds if x starts with β€œescape”

  • x.regexpMatch(β€œ(?i).*escape.*”) – holds if x contains β€œescape” (case insensitive)

Access pathsΒΆ

When multiple property accesses are chained together they form what’s called an β€œaccess path”.

To identify nodes based on access paths, use the following predicates in AccessPath module:

getAReferenceTo and getAnAssignmentTo have a 1-argument version for global access paths, and a 2-argument version for access paths starting at a given node.

Type trackingΒΆ

See also: β€œUsing type tracking for API modeling.”

Use the following template to define forward type tracking predicates:

import DataFlow

SourceNode myType(TypeTracker t) {
  t.start() and
  result = /* SourceNode to track */
  or
  exists(TypeTracker t2 |
    result = myType(t2).track(t2, t)
  )
}

SourceNode myType() {
  result = myType(TypeTracker::end())
}

Use the following template to define backward type tracking predicates:

import DataFlow

SourceNode myType(TypeBackTracker t) {
  t.start() and
  result = (/* argument to track */).getALocalSource()
  or
  exists(TypeBackTracker t2 |
    result = myType(t2).backtrack(t2, t)
  )
}

SourceNode myType() {
  result = myType(TypeBackTracker::end())
}

TroubleshootingΒΆ

  • Using a call node as as sink? Try using getArgument to get an argument of the call node instead.

  • Trying to use moduleImport or moduleMember as a call node? Try using getACall to get a call to the imported function, instead of the function itself.

  • Compilation fails due to incompatible types? Make sure AST nodes and DataFlow nodes are not mixed up. Use asExpr() or flow() to convert.

Further readingΒΆ

  • © GitHub, Inc.
  • Terms
  • Privacy