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
`Container <https://help.semmle.com/qldoc/javascript/semmle/javascript/Files.qll/type.Files$Container.html>`__ -- file or folder in the snapshot
137
+
`Container <https://help.semmle.com/qldoc/javascript/semmle/javascript/Files.qll/type.Files$Container.html>`__ -- file or folder in the database
138
138
139
139
- `getBaseName <https://help.semmle.com/qldoc/javascript/semmle/javascript/Files.qll/predicate.Files$Container$getBaseName.0.html>`__ -- the name of the file or folder
140
-
- `getRelativePath <https://help.semmle.com/qldoc/javascript/semmle/javascript/Files.qll/predicate.Files$Container$getRelativePath.0.html>`__ -- path relative to the snapshot root
140
+
- `getRelativePath <https://help.semmle.com/qldoc/javascript/semmle/javascript/Files.qll/predicate.Files$Container$getRelativePath.0.html>`__ -- path relative to the database root
Copy file name to clipboardExpand all lines: docs/language/learn-ql/javascript/dataflow.rst
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,13 @@ Analyzing data flow in JavaScript and TypeScript
4
4
Overview
5
5
--------
6
6
7
-
This topic describes how data flow analysis is implemented in the QL libraries for JavaScript/TypeScript and includes examples to help you write your own data flow queries.
8
-
The following sections describe how to utilize the QL libraries for local data flow, global data flow, and taint tracking.
7
+
This topic describes how data flow analysis is implemented in the CodeQL libraries for JavaScript/TypeScript and includes examples to help you write your own data flow queries.
8
+
The following sections describe how to utilize the libraries for local data flow, global data flow, and taint tracking.
9
9
10
10
As our running example, we will develop a query that identifies command-line arguments that are passed as a file path to the standard Node.js ``readFile`` function.
11
11
While this is not a problematic pattern as such, it is typical of the kind of reasoning that is frequently used in security queries.
12
12
13
-
For a more general introduction to modeling data flow in QL, see :doc:`Introduction to data flow analysis in QL<../intro-to-data-flow>`.
13
+
For a more general introduction to modeling data flow, see :doc:`Introduction to data flow analysis with CodeQL<../intro-to-data-flow>`.
14
14
15
15
Data flow nodes
16
16
---------------
@@ -174,7 +174,7 @@ There are two points worth making about the source node API:
174
174
2. Strings are not source nodes and cannot be tracked using this API. You can, however, use the ``mayHaveStringValue`` predicate on class ``DataFlow::Node``
175
175
to reason about the possible string values flowing into a data flow node.
176
176
177
-
For a full description of the ``DataFlow::SourceNode`` API, see the `QL JavaScript standard library <https://help.semmle.com/qldoc/javascript/semmle/javascript/dataflow/Sources.qll/type.Sources$SourceNode.html>`__.
177
+
For a full description of the ``DataFlow::SourceNode`` API, see the `JavaScript standard library <https://help.semmle.com/qldoc/javascript/semmle/javascript/dataflow/Sources.qll/type.Sources$SourceNode.html>`__.
Copy file name to clipboardExpand all lines: docs/language/learn-ql/javascript/flow-labels.rst
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -393,6 +393,6 @@ string may be an absolute path and whether it may contain ``..`` components.
393
393
What next?
394
394
----------
395
395
396
-
- Learn about the QL standard libraries used to write queries for JavaScript in :doc:`Introducing the JavaScript libraries <introduce-libraries-js>`.
396
+
- Learn about the standard CodeQL libraries used to write queries for JavaScript in :doc:`Introducing the JavaScript libraries <introduce-libraries-js>`.
397
397
- Find out more about QL in the `QL language handbook <https://help.semmle.com/QL/ql-handbook/index.html>`__ and `QL language specification <https://help.semmle.com/QL/ql-spec/language.html>`__.
398
398
- Learn more about the query console in `Using the query console <https://lgtm.com/help/lgtm/using-query-console>`__.
Copy file name to clipboardExpand all lines: docs/language/learn-ql/javascript/introduce-libraries-ts.rst
+13-11Lines changed: 13 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,16 @@
1
-
Introducing the QL libraries for TypeScript
2
-
===========================================
1
+
Introducing the CodeQL libraries for TypeScript
2
+
===============================================
3
3
4
4
Overview
5
5
--------
6
6
7
-
Support for analyzing TypeScript code is bundled with the JavaScript QL libraries, so you can include the full TypeScript library by importing the ``javascript.qll`` module:
7
+
Support for analyzing TypeScript code is bundled with the CodeQL libraries for JavaScript, so you can include the full TypeScript library by importing the ``javascript.qll`` module:
8
8
9
9
.. code-block:: ql
10
10
11
11
import javascript
12
12
13
-
The :doc:`QL library introduction for JavaScript <introduce-libraries-js>` covers most of this library, and is also relevant for TypeScript analysis. This document supplements the JavaScript QL documentation with the TypeScript-specific classes and predicates.
13
+
The :doc:`CodeQL library introduction for JavaScript <introduce-libraries-js>` covers most of this library, and is also relevant for TypeScript analysis. This document supplements the JavaScript documentation with the TypeScript-specific classes and predicates.
14
14
15
15
Syntax
16
16
------
@@ -124,7 +124,7 @@ Select expressions that cast a value to a type parameter:
124
124
Classes and interfaces
125
125
~~~~~~~~~~~~~~~~~~~~~~
126
126
127
-
The QL class `ClassOrInterface <https://help.semmle.com/qldoc/javascript/semmle/javascript/Classes.qll/type.Classes$ClassOrInterface.html>`__ is a common supertype of classes and interfaces, and provides some TypeScript-specific member predicates:
127
+
The CodeQL class `ClassOrInterface <https://help.semmle.com/qldoc/javascript/semmle/javascript/Classes.qll/type.Classes$ClassOrInterface.html>`__ is a common supertype of classes and interfaces, and provides some TypeScript-specific member predicates:
128
128
129
129
- ``ClassOrInterface.isAbstract()`` holds if this is an interface or a class with the ``abstract`` modifier.
130
130
- ``ClassOrInterface.getASuperInterface()`` gets a type from the ``implements`` clause of a class or from the ``extends`` clause of an interface.
@@ -134,7 +134,7 @@ The QL class `ClassOrInterface <https://help.semmle.com/qldoc/javascript/semmle/
134
134
135
135
Note that the superclass of a class is an expression, not a type annotation. If the superclass has type arguments, it will be an expression of kind `ExpressionWithTypeArguments <https://help.semmle.com/qldoc/javascript/semmle/javascript/TypeScript.qll/type.TypeScript$ExpressionWithTypeArguments.html>`__.
136
136
137
-
Also see the documentation for classes in the `Introduction to the QL libraries for JavaScript <introduce-libraries-js#classes>`__.
137
+
Also see the documentation for classes in the `Introduction to the CodeQL libraries for JavaScript <introduce-libraries-js#classes>`__.
138
138
139
139
To select the type references to a class or an interface, use ``getTypeName()``.
140
140
@@ -175,6 +175,8 @@ Ambient nodes are mostly ignored by control flow and data flow analysis. The out
175
175
Static type information
176
176
-----------------------
177
177
178
+
.. TODO: Remove link to QL command-line tools below?
179
+
178
180
Static type information and global name binding is available for projects with "full" TypeScript extraction enabled. This option is enabled by default for projects on LGTM.com. If you are using the `QL command-line tools <https://help.semmle.com/wiki/display/SD/QL+command-line+tools>`__, you must enable it by passing ``--typescript-full`` to the JavaScript extractor. For further information on customizing calls to the extractor, see `Customizing JavaScript extraction <https://help.semmle.com/wiki/display/SD/Customizing+JavaScript+extraction>`__.
179
181
180
182
**Note:** Without full extraction, the classes and predicates described in this section are empty.
@@ -262,7 +264,7 @@ Additionally, ``Type`` has the following subclasses which overlap partially with
262
264
Canonical names and named types
263
265
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
264
266
265
-
``CanonicalName`` is a QL class representing a qualified name relative to a root scope, such as a module or the global scope. It typically represents an entity such as a type, namespace, variable, or function. ``TypeName`` and ``Namespace`` are subclasses of this class.
267
+
``CanonicalName`` is a CodeQL class representing a qualified name relative to a root scope, such as a module or the global scope. It typically represents an entity such as a type, namespace, variable, or function. ``TypeName`` and ``Namespace`` are subclasses of this class.
266
268
267
269
Canonical names can be recognized using the ``hasQualifiedName`` predicate:
268
270
@@ -274,7 +276,7 @@ For convenience, this predicate is also available on other classes, such as ``Ty
274
276
Function types
275
277
~~~~~~~~~~~~~~
276
278
277
-
There is no QL class for function types, as any type with a call or construct signature is usable as a function. The type ``CallSignatureType`` represents such a signature (with or without the ``new`` keyword).
279
+
There is no CodeQL class for function types, as any type with a call or construct signature is usable as a function. The type ``CallSignatureType`` represents such a signature (with or without the ``new`` keyword).
278
280
279
281
Signatures can be obtained in several ways:
280
282
@@ -353,7 +355,7 @@ TypeScript also allows you to import types and namespaces, and give them local n
353
355
354
356
The local name ``B`` is represented as a `LocalTypeName <https://help.semmle.com/qldoc/javascript/semmle/javascript/TypeScript.qll/type.TypeScript$LocalTypeName.html>`__ named ``B``, restricted to just the file containing the import. An import statement can also introduce a `Variable <https://help.semmle.com/qldoc/javascript/semmle/javascript/Variables.qll/type.Variables$Variable.html>`__ and a `LocalNamespaceName <https://help.semmle.com/qldoc/javascript/semmle/javascript/TypeScript.qll/type.TypeScript$LocalNamespaceName.html>`__.
355
357
356
-
The following table shows the relevant QL classes for working with each kind of name. The classes are described in more detail below.
358
+
The following table shows the relevant classes for working with each kind of name. The classes are described in more detail below.
| Kind | Local alias | Canonical name | Definition | Access |
@@ -419,7 +421,7 @@ Find imported names that are used as both a type and a value:
419
421
Namespace names
420
422
~~~~~~~~~~~~~~~
421
423
422
-
Namespaces are represented by the QL classes `Namespace <https://help.semmle.com/qldoc/javascript/semmle/javascript/CanonicalNames.qll/type.CanonicalNames$Namespace.html>`__ and `LocalNamespaceName <https://help.semmle.com/qldoc/javascript/semmle/javascript/TypeScript.qll/type.TypeScript$LocalNamespaceName.html>`__. The `NamespaceDefinition <https://help.semmle.com/qldoc/javascript/semmle/javascript/TypeScript.qll/type.TypeScript$NamespaceDefinition.html>`__ class represents a syntactic definition of a namespace, which includes ordinary namespace declarations as well as enum declarations.
424
+
Namespaces are represented by the classes `Namespace <https://help.semmle.com/qldoc/javascript/semmle/javascript/CanonicalNames.qll/type.CanonicalNames$Namespace.html>`__ and `LocalNamespaceName <https://help.semmle.com/qldoc/javascript/semmle/javascript/TypeScript.qll/type.TypeScript$LocalNamespaceName.html>`__. The `NamespaceDefinition <https://help.semmle.com/qldoc/javascript/semmle/javascript/TypeScript.qll/type.TypeScript$NamespaceDefinition.html>`__ class represents a syntactic definition of a namespace, which includes ordinary namespace declarations as well as enum declarations.
423
425
424
426
Note that these classes deal exclusively with namespaces referenced from inside type annotations, not through expressions.
425
427
@@ -443,6 +445,6 @@ A `LocalNamespaceName <https://help.semmle.com/qldoc/javascript/semmle/javascrip
443
445
What next?
444
446
----------
445
447
446
-
- Learn about the QL standard libraries used to write queries for JavaScript in :doc:`Introducing the Javacript libraries <introduce-libraries-js>`.
448
+
- Learn about the standard CodeQL libraries used to write queries for JavaScript in :doc:`Introducing the JavaScript libraries <introduce-libraries-js>`.
447
449
- Find out more about QL in the `QL language handbook <https://help.semmle.com/QL/ql-handbook/index.html>`__ and `QL language specification <https://help.semmle.com/QL/ql-spec/language.html>`__.
448
450
- Learn more about the query console in `Using the query console <https://lgtm.com/help/lgtm/using-query-console>`__.
These documents provide an overview of the QL JavaScript and TypeScript standard libraries and show examples of how to use them.
16
+
These documents provide an overview of the CodeQL libraries for JavaScript and TypeScript and show examples of how to use them.
17
17
18
-
- `Basic JavaScript QL query <https://lgtm.com/help/lgtm/console/ql-javascript-basic-example>`__ describes how to write and run queries using LGTM.
18
+
- `Basic JavaScript query <https://lgtm.com/help/lgtm/console/ql-javascript-basic-example>`__ describes how to write and run queries using LGTM.
19
19
20
-
- :doc:`Introducing the QL libraries for JavaScript <introduce-libraries-js>`: an overview of the standard libraries used to write queries for JavaScript code. There is an extensive QL library for analyzing JavaScript code. This tutorial briefly summarizes the most important QL classes and predicates provided by this library.
20
+
- :doc:`Introducing the CodeQL libraries for JavaScript <introduce-libraries-js>` introduces the standard libraries used to write queries for JavaScript code. There is an extensive CodeQL library for analyzing JavaScript code. This tutorial briefly summarizes the most important classes and predicates provided by this library.
21
21
22
-
- :doc:`Introducing the QL libraries for TypeScript <introduce-libraries-ts>`: an overview of the standard libraries used to write queries for TypeScript code.
22
+
- :doc:`Introducing the CodeQL libraries for TypeScript <introduce-libraries-ts>` introduces the standard libraries used to write queries for TypeScript code.
23
23
24
-
- :doc:`Analyzing data flow in JavaScript/TypeScript <dataflow>`: demonstrates how to write queries using the standard QL for JavaScript/TypeScript data flow and taint tracking libraries.
24
+
- :doc:`Analyzing data flow in JavaScript/TypeScript <dataflow>` demonstrates how to write queries using the standard data flow and taint tracking libraries for JavaScript/TypeScript.
25
25
26
-
- :doc:`Advanced data-flow analysis using flow labels <flow-labels>`: shows a more advanced example of data flow analysis using flow labels.
26
+
- :doc:`Advanced data-flow analysis using flow labels <flow-labels>` shows a more advanced example of data flow analysis using flow labels.
27
27
28
-
- :doc:`AST class reference <ast-class-reference>`: an overview of all AST classes in the QL standard library for JavaScript.
28
+
- :doc:`AST class reference <ast-class-reference>` gives an overview of all AST classes in the standard CodeQL library for JavaScript.
29
29
30
-
- :doc:`Data flow cheat sheet <dataflow-cheat-sheet>`: bits of QL commonly used for variant analysis and in data flow queries.
30
+
- :doc:`Data flow cheat sheet <dataflow-cheat-sheet>` lists parts of the CodeQL libraries that are commonly used for variant analysis and in data flow queries.
31
31
32
32
Other resources
33
33
---------------
34
34
35
-
- For examples of how to query common JavaScript elements, see the `JavaScript QL cookbook <https://help.semmle.com/wiki/display/CBJS>`__
36
-
- For the queries used in LGTM, display a `JavaScript query <https://lgtm.com/search?q=language%3Ajavascript&t=rules>`__ and click **Open in query console** to see the QL code used to find alerts.
37
-
- For more information about the JavaScript QL library see the `QL library for JavaScript <https://help.semmle.com/qldoc/javascript/>`__.
35
+
- For examples of how to query common JavaScript elements, see the `JavaScript cookbook <https://help.semmle.com/wiki/display/CBJS>`__.
36
+
- For the queries used in LGTM, display a `JavaScript query <https://lgtm.com/search?q=language%3Ajavascript&t=rules>`__ and click **Open in query console** to see the code used to find alerts.
37
+
- For more information about the library for JavaScript see the `CodeQL library for JavaScript <https://help.semmle.com/qldoc/javascript/>`__.
0 commit comments