You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Since we're adding a new sink, we add a tuple to the **sinkModel** extension point.
63
62
- The first column, **"execa"**, identifies a set of values from which to begin the search for the sink.
@@ -95,7 +94,6 @@ This source is already known by the CodeQL JS analysis, but we'll show how it co
95
94
"remote",
96
95
]
97
96
98
-
To break this down:
99
97
100
98
- Since we're adding a new taint source, we add a tuple to the **sourceModel** extension point.
101
99
- The first column, **"global"**, begins the search at references to the global object (also known as **window** in browser contexts). This is a special JavaScript object that contains all global variables and methods.
@@ -159,17 +157,16 @@ We can recognize this using the following extension:
- Since we're providing type information, we add a tuple to the **typeModel** extension point.
200
196
- The first column, **"mysql.Connection"**, names the type that we're adding a new definition for.
@@ -239,9 +235,8 @@ This flow is already recognized by the CodeQL JS analysis, but this is how it co
239
235
"taint",
240
236
]
241
237
242
-
To break this down:
243
238
244
-
- Since we're adding flow *through* a function call, we add a tuple to the **summaryModel** extension point.
239
+
- Since we're adding flow through a function call, we add a tuple to the **summaryModel** extension point.
245
240
- The first column, **"global"**, begins the search for relevant calls at references to the global object.
246
241
In JavaScript, global variables are properties of the global object, so this lets us access global variables or functions.
247
242
- The second column, **Member[decodeURIComponent]**, is a path leading to the function calls we wish to model.
@@ -250,7 +245,7 @@ To break this down:
250
245
- The third column, **Argument[0]**, indicates the input of the flow. In this case, the first argument to the function call.
251
246
- The fourth column, **ReturnValue**, indicates the output of the flow. In this case, the return value of the function call.
252
247
- The last column, **taint**, indicates the kind of flow to add. The value **taint** means the output is not necessarily equal
253
-
to the input, but was was derived from the input in a taint-preserving way.
248
+
to the input, but was derived from the input in a taint-preserving way.
254
249
255
250
Example: Adding flow through 'underscore.forEach'
256
251
-------------------------------------------------
@@ -278,9 +273,8 @@ This flow is already recognized by the CodeQL JS analysis, but we'll show how it
278
273
"value",
279
274
]
280
275
281
-
To break this down:
282
276
283
-
- Since we're adding flow *through* a function call, we add a tuple to the **summaryModel** extension point.
277
+
- Since we're adding flow through a function call, we add a tuple to the **summaryModel** extension point.
284
278
- The first column, **"underscore"**, begins the search for relevant calls at places where the **underscore** package is imported.
285
279
- The second column, **Member[forEach]**, selects references to the **forEach** member from the **underscore** package.
286
280
- The third column specifies the input of the flow:
@@ -327,7 +321,7 @@ Example:
327
321
sinkModel(type, path, kind)
328
322
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
329
323
330
-
Adds a new taint sink. Sinks are query-specific and will usually affect one or two queries.
324
+
Adds a new taint sink. Sinks are query-specific and will typically affect one or two queries.
331
325
332
326
- **type**: Name of a type from which to evaluate **path**.
333
327
- **path**: Access path leading to the sink.
@@ -410,7 +404,7 @@ A type can be defined by adding **typeModel** tuples for that type. Additionally
410
404
Access paths
411
405
------------
412
406
413
-
The **path**, **input**, and **output** columns consist of a **.**-separated list of components, which is evaluted from left to right, with each step selecting a new set of values derived from the previous set of values.
407
+
The **path**, **input**, and **output** columns consist of a **.**-separated list of components, which is evaluated from left to right, with each step selecting a new set of values derived from the previous set of values.
414
408
415
409
The following components are supported:
416
410
@@ -438,7 +432,7 @@ Components related to decorators:
438
432
- **DecoratedParameter** selects a parameter that is decorated by the current value.
439
433
- **DecoratedMember** selects a method, field, or accessor that is decorated by the current value.
440
434
441
-
Some additional notes about the syntax of operands:
435
+
Additional notes about the syntax of operands:
442
436
443
437
- Multiple operands may be given to a single component, as a shorthand for the union of the operands. For example, **Member[foo,bar]** matches the union of **Member[foo]** and **Member[bar]**.
444
438
- Numeric operands to **Argument**, **Parameter**, and **WithArity** may be given as an interval. For example, **Argument[0..2]** matches argument 0, 1, or 2.
@@ -455,11 +449,11 @@ Source kinds
455
449
Sink kinds
456
450
~~~~~~~~~~
457
451
458
-
Unlike sources, sinks tend to be highly query-specific, rarely affecting more than one or two queries. Not every query supports customizable sinks. If there is no suitable sink kind below, it is best to add a new query instead.
452
+
Unlike sources, sinks tend to be highly query-specific, rarely affecting more than one or two queries. Not every query supports customizable sinks. If the following sinks are not suitable for your use case, you should add a new query.
459
453
460
454
- **code-injection**: A sink that can be used to inject code, such as in calls to **eval**.
461
455
- **command-line-injection**: A sink that can be used to inject shell commands, such as in calls to **child_process.spawn**.
462
-
- **path-injection**: A sink that can be used for path injection in a file system access, such as in a calls to **fs.readFile**.
456
+
- **path-injection**: A sink that can be used for path injection in a file system access, such as in calls to **fs.readFile**.
463
457
- **sql-injection**: A sink that can be used for SQL injection, such as in a MySQL **query** call.
464
458
- **nosql-injection**: A sink that can be used for NoSQL injection, such as in a MongoDB **findOne** call.
465
459
- **html-injection**: A sink that can be used for HTML injection, such as in a jQuery **$()** call.
0 commit comments