Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4e75fe3

Browse files
committed
JS: Update some qldoc comments
1 parent 08ad4f7 commit 4e75fe3

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

javascript/ql/src/semmle/javascript/dataflow/Configuration.qll

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,11 @@ abstract class Configuration extends string {
256256
/**
257257
* A label describing the kind of information tracked by a flow configuration.
258258
*
259-
* There are two standard labels "data" and "taint", the former describing values
260-
* that directly originate from a flow source, the latter values that are derived
261-
* from a flow source via one or more transformations (such as string operations).
259+
* There are two standard labels "data" and "taint".
260+
* - "data" only propagates along value-preserving data flow, such as assignments
261+
* and parameter-passing, and is the default flow source for a `DataFlow::Configuration`.
262+
* - "taint" additionally permits flow through transformations such as string operations,
263+
* and is the default flow source for a `TaintTracking::Configuration`.
262264
*/
263265
abstract class FlowLabel extends string {
264266
bindingset[this]

javascript/ql/src/semmle/javascript/dataflow/TaintTracking.qll

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,16 @@ module TaintTracking {
4848
// overridden to provide taint-tracking specific qldoc
4949
override predicate isSink(DataFlow::Node sink) { super.isSink(sink) }
5050

51-
/** Holds if the intermediate node `node` is a taint sanitizer. */
51+
/**
52+
* Holds if the intermediate node `node` is a taint sanitizer, that is,
53+
* tainted values can not flow into or out of `node`.
54+
*
55+
* Note that this only blocks flow through nodes that operate directly on the tainted value.
56+
* An object _containing_ a tainted value in a property can still flow into and out of `node`.
57+
* To block such objects, override `isBarrier` or use a labeled sanitizer to block the `data` flow label.
58+
*
59+
* For operations that _check_ if a value is tainted or safe, use `isSanitizerGuard` instead.
60+
*/
5261
predicate isSanitizer(DataFlow::Node node) { none() }
5362

5463
/**
@@ -84,6 +93,10 @@ module TaintTracking {
8493
* For example, if `guard` is the comparison expression in
8594
* `if(x == 'some-constant'){ ... x ... }`, it could sanitize flow of
8695
* `x` into the "then" branch.
96+
*
97+
* Node that this only handles checks that operate directly on the tainted value.
98+
* Objects that _contain_ a tainted value in a property may still flow across the check.
99+
* To block such objects, use a labeled sanitizer guard to block the `data` label.
87100
*/
88101
predicate isSanitizerGuard(SanitizerGuardNode guard) { none() }
89102

0 commit comments

Comments
 (0)