mirror of
https://github.com/github/codeql.git
synced 2026-01-07 03:30:24 +01:00
Merge branch 'main' into felicitymay-10250-swift
This commit is contained in:
@@ -0,0 +1,291 @@
|
||||
.. _analyzing-data-flow-in-swift:
|
||||
|
||||
Analyzing data flow in Swift
|
||||
============================
|
||||
|
||||
You can use CodeQL to track the flow of data through a Swift program to places where the data is used.
|
||||
|
||||
.. include:: ../reusables/swift-beta-note.rst
|
||||
|
||||
About this article
|
||||
------------------
|
||||
|
||||
This article describes how data flow analysis is implemented in the CodeQL libraries for Swift and includes examples to help you write your own data flow queries.
|
||||
The following sections describe how to use the libraries for local data flow, global data flow, and taint tracking.
|
||||
For a more general introduction to modeling data flow, see ":ref:`About data flow analysis <about-data-flow-analysis>`."
|
||||
|
||||
Local data flow
|
||||
---------------
|
||||
|
||||
Local data flow tracks the flow of data within a single function. Local data flow is easier, faster, and more precise than global data flow. Before looking at more complex tracking, you should always consider local tracking because it is sufficient for many queries.
|
||||
|
||||
Using local data flow
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
You can use the local data flow library by importing the ``DataFlow`` module. The library uses the class ``Node`` to represent any element through which data can flow.
|
||||
The ``Node`` class has a number of useful subclasses, such as ``ExprNode`` for expressions and ``ParameterNode`` for parameters. You can map between data flow nodes and expressions/control-flow nodes using the member predicates ``asExpr`` and ``getCfgNode``:
|
||||
|
||||
.. code-block:: ql
|
||||
|
||||
class Node {
|
||||
/**
|
||||
* Gets the expression that corresponds to this node, if any.
|
||||
*/
|
||||
Expr asExpr() { ... }
|
||||
|
||||
/**
|
||||
* Gets the control flow node that corresponds to this data flow node.
|
||||
*/
|
||||
ControlFlowNode getCfgNode() { ... }
|
||||
|
||||
...
|
||||
}
|
||||
|
||||
You can use the predicates ``exprNode`` and ``parameterNode`` to map from expressions and parameters to their data-flow node:
|
||||
|
||||
.. code-block:: ql
|
||||
|
||||
/**
|
||||
* Gets a node corresponding to expression `e`.
|
||||
*/
|
||||
ExprNode exprNode(DataFlowExpr e) { result.asExpr() = e }
|
||||
|
||||
/**
|
||||
* Gets the node corresponding to the value of parameter `p` at function entry.
|
||||
*/
|
||||
ParameterNode parameterNode(DataFlowParameter p) { result.getParameter() = p }
|
||||
|
||||
There can be multiple data-flow nodes associated with a single expression node in the AST.
|
||||
|
||||
The predicate ``localFlowStep(Node nodeFrom, Node nodeTo)`` holds if there is an immediate data flow edge from the node ``nodeFrom`` to the node ``nodeTo``.
|
||||
You can apply the predicate recursively, by using the ``+`` and ``*`` operators, or you can use the predefined recursive predicate ``localFlow``.
|
||||
|
||||
For example, you can find flow from an expression ``source`` to an expression ``sink`` in zero or more local steps:
|
||||
|
||||
.. code-block:: ql
|
||||
|
||||
DataFlow::localFlow(DataFlow::exprNode(source), DataFlow::exprNode(sink))
|
||||
|
||||
Using local taint tracking
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Local taint tracking extends local data flow to include flow steps where values are not preserved, such as string manipulation.
|
||||
For example:
|
||||
|
||||
.. code-block:: swift
|
||||
|
||||
temp = x
|
||||
y = temp + ", " + temp
|
||||
|
||||
If ``x`` is a tainted string then ``y`` is also tainted.
|
||||
|
||||
The local taint tracking library is in the module ``TaintTracking``.
|
||||
Like local data flow, a predicate ``localTaintStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo)`` holds if there is an immediate taint propagation edge from the node ``nodeFrom`` to the node ``nodeTo``.
|
||||
You can apply the predicate recursively, by using the ``+`` and ``*`` operators, or you can use the predefined recursive predicate ``localTaint``.
|
||||
|
||||
For example, you can find taint propagation from an expression ``source`` to an expression ``sink`` in zero or more local steps:
|
||||
|
||||
.. code-block:: ql
|
||||
|
||||
TaintTracking::localTaint(DataFlow::exprNode(source), DataFlow::exprNode(sink))
|
||||
|
||||
Examples of local data flow
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
This query finds the ``format`` argument passed into each call to ``String.init(format:_:)``:
|
||||
|
||||
.. code-block:: ql
|
||||
|
||||
import swift
|
||||
|
||||
from CallExpr call, Method method
|
||||
where
|
||||
call.getStaticTarget() = method and
|
||||
method.hasQualifiedName("String", "init(format:_:)")
|
||||
select call.getArgument(0).getExpr()
|
||||
|
||||
Unfortunately this will only give the expression in the argument, not the values which could be passed to it.
|
||||
So we use local data flow to find all expressions that flow into the argument:
|
||||
|
||||
.. code-block:: ql
|
||||
|
||||
import swift
|
||||
import codeql.swift.dataflow.DataFlow
|
||||
|
||||
from CallExpr call, Method method, Expr sourceExpr, Expr sinkExpr
|
||||
where
|
||||
call.getStaticTarget() = method and
|
||||
method.hasQualifiedName("String", "init(format:_:)") and
|
||||
sinkExpr = call.getArgument(0).getExpr() and
|
||||
DataFlow::localFlow(DataFlow::exprNode(sourceExpr), DataFlow::exprNode(sinkExpr))
|
||||
select sourceExpr, sinkExpr
|
||||
|
||||
We can vary the source, for example, making the source the parameter of a function rather than an expression. The following query finds where a parameter is used for the format:
|
||||
|
||||
.. code-block:: ql
|
||||
|
||||
import swift
|
||||
import codeql.swift.dataflow.DataFlow
|
||||
|
||||
from CallExpr call, Method method, ParamDecl sourceParam, Expr sinkExpr
|
||||
where
|
||||
call.getStaticTarget() = method and
|
||||
method.hasQualifiedName("String", "init(format:_:)") and
|
||||
sinkExpr = call.getArgument(0).getExpr() and
|
||||
DataFlow::localFlow(DataFlow::parameterNode(sourceParam), DataFlow::exprNode(sinkExpr))
|
||||
select sourceParam, sinkExpr
|
||||
|
||||
The following example finds calls to ``String.init(format:_:)`` where the format string is not a hard-coded string literal:
|
||||
|
||||
.. code-block:: ql
|
||||
|
||||
import swift
|
||||
import codeql.swift.dataflow.DataFlow
|
||||
|
||||
from CallExpr call, Method method, DataFlow::Node sinkNode
|
||||
where
|
||||
call.getStaticTarget() = method and
|
||||
method.hasQualifiedName("String", "init(format:_:)") and
|
||||
sinkNode.asExpr() = call.getArgument(0).getExpr() and
|
||||
not exists(StringLiteralExpr sourceLiteral |
|
||||
DataFlow::localFlow(DataFlow::exprNode(sourceLiteral), sinkNode)
|
||||
)
|
||||
select call, "Format argument to " + method.getName() + " isn't hard-coded."
|
||||
|
||||
Global data flow
|
||||
----------------
|
||||
|
||||
Global data flow tracks data flow throughout the entire program, and is therefore more powerful than local data flow.
|
||||
However, global data flow is less precise than local data flow, and the analysis typically requires significantly more time and memory to perform.
|
||||
|
||||
.. pull-quote:: Note
|
||||
|
||||
.. include:: ../reusables/path-problem.rst
|
||||
|
||||
Using global data flow
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
You can use the global data flow library by implementing the module ``DataFlow::ConfigSig``:
|
||||
|
||||
.. code-block:: ql
|
||||
|
||||
import codeql.swift.dataflow.DataFlow
|
||||
|
||||
module MyDataFlowConfiguration implements DataFlow::ConfigSig {
|
||||
predicate isSource(DataFlow::Node source) {
|
||||
...
|
||||
}
|
||||
|
||||
predicate isSink(DataFlow::Node sink) {
|
||||
...
|
||||
}
|
||||
}
|
||||
|
||||
module MyDataFlow = DataFlow::Global<MyDataFlowConfiguration>;
|
||||
|
||||
These predicates are defined in the configuration:
|
||||
|
||||
- ``isSource`` - defines where data may flow from.
|
||||
- ``isSink`` - defines where data may flow to.
|
||||
- ``isBarrier`` - optionally, restricts the data flow.
|
||||
- ``isAdditionalFlowStep`` - optionally, adds additional flow steps.
|
||||
|
||||
The last line (``module MyDataFlow = ...``) instantiates the parameterized module for data flow analysis by passing the configuration to the parameterized module. Data flow analysis can then be performed using ``MyDataFlow::flow(DataFlow::Node source, DataFlow::Node sink)``:
|
||||
|
||||
.. code-block:: ql
|
||||
|
||||
from DataFlow::Node source, DataFlow::Node sink
|
||||
where MyDataFlow::flow(source, sink)
|
||||
select source, "Dataflow to $@.", sink, sink.toString()
|
||||
|
||||
Using global taint tracking
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Global taint tracking is to global data flow what local taint tracking is to local data flow.
|
||||
That is, global taint tracking extends global data flow with additional non-value-preserving steps.
|
||||
The global taint tracking library uses the same configuration module as the global data flow library. You can perform taint flow analysis using ``TaintTracking::Global``:
|
||||
|
||||
.. code-block:: ql
|
||||
|
||||
module MyTaintFlow = TaintTracking::Global<MyDataFlowConfiguration>;
|
||||
|
||||
from DataFlow::Node source, DataFlow::Node sink
|
||||
where MyTaintFlow::flow(source, sink)
|
||||
select source, "Taint flow to $@.", sink, sink.toString()
|
||||
|
||||
Predefined sources
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The data flow library module ``codeql.swift.dataflow.FlowSources`` contains a number of predefined sources that you can use to write security queries to track data flow and taint flow.
|
||||
|
||||
- The class ``RemoteFlowSource`` represents data flow from remote network inputs and from other applications.
|
||||
- The class ``LocalFlowSource`` represents data flow from local user input.
|
||||
- The class ``FlowSource`` includes both of the above.
|
||||
|
||||
Examples of global data flow
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The following global taint-tracking query finds places where a string literal is used in a function call argument named "password".
|
||||
- Since this is a taint-tracking query, the ``TaintTracking::Global`` module is used.
|
||||
- The ``isSource`` predicate defines sources as any ``StringLiteralExpr``.
|
||||
- The ``isSink`` predicate defines sinks as arguments to a ``CallExpr`` called "password".
|
||||
- The sources and sinks may need tuning to a particular use, for example, if passwords are represented by a type other than ``String`` or passed in arguments of a different name than "password".
|
||||
|
||||
.. code-block:: ql
|
||||
|
||||
import swift
|
||||
import codeql.swift.dataflow.DataFlow
|
||||
import codeql.swift.dataflow.TaintTracking
|
||||
|
||||
module ConstantPasswordConfig implements DataFlow::ConfigSig {
|
||||
predicate isSource(DataFlow::Node node) { node.asExpr() instanceof StringLiteralExpr }
|
||||
|
||||
predicate isSink(DataFlow::Node node) {
|
||||
// any argument called `password`
|
||||
exists(CallExpr call | call.getArgumentWithLabel("password").getExpr() = node.asExpr())
|
||||
}
|
||||
|
||||
module ConstantPasswordFlow = TaintTracking::Global<ConstantPasswordConfig>;
|
||||
|
||||
from DataFlow::Node sourceNode, DataFlow::Node sinkNode
|
||||
where ConstantPasswordFlow::flow(sourceNode, sinkNode)
|
||||
select sinkNode, "The value $@ is used as a constant password.", sourceNode, sourceNode.toString()
|
||||
|
||||
|
||||
The following global taint-tracking query finds places where a value from a remote or local user input is used as an argument to the SQLite ``Connection.execute(_:)`` function.
|
||||
- Since this is a taint-tracking query, the ``TaintTracking::Global`` module is used.
|
||||
- The ``isSource`` predicate defines sources as a ``FlowSource`` (remote or local user input).
|
||||
- The ``isSink`` predicate defines sinks as the first argument in any call to ``Connection.execute(_:)``.
|
||||
|
||||
.. code-block:: ql
|
||||
|
||||
import swift
|
||||
import codeql.swift.dataflow.DataFlow
|
||||
import codeql.swift.dataflow.TaintTracking
|
||||
import codeql.swift.dataflow.FlowSources
|
||||
|
||||
module SqlInjectionConfig implements DataFlow::ConfigSig {
|
||||
predicate isSource(DataFlow::Node node) { node instanceof FlowSource }
|
||||
|
||||
predicate isSink(DataFlow::Node node) {
|
||||
exists(CallExpr call |
|
||||
call.getStaticTarget().(Method).hasQualifiedName("Connection", "execute(_:)") and
|
||||
call.getArgument(0).getExpr() = node.asExpr()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
module SqlInjectionFlow = TaintTracking::Global<SqlInjectionConfig>;
|
||||
|
||||
from DataFlow::Node sourceNode, DataFlow::Node sinkNode
|
||||
where SqlInjectionFlow::flow(sourceNode, sinkNode)
|
||||
select sinkNode, "This query depends on a $@.", sourceNode, "user-provided value"
|
||||
|
||||
Further reading
|
||||
---------------
|
||||
|
||||
- ":ref:`Exploring data flow with path queries <exploring-data-flow-with-path-queries>`"
|
||||
|
||||
|
||||
.. include:: ../reusables/swift-further-reading.rst
|
||||
.. include:: ../reusables/codeql-ref-tools-further-reading.rst
|
||||
@@ -0,0 +1,131 @@
|
||||
.. _basic-query-for-swift-code:
|
||||
|
||||
Basic query for Swift code
|
||||
==========================
|
||||
|
||||
Learn to write and run a simple CodeQL query using Visual Studio Code with the CodeQL extension.
|
||||
|
||||
.. include:: ../reusables/swift-beta-note.rst
|
||||
.. include:: ../reusables/vs-code-basic-instructions/setup-to-run-queries.rst
|
||||
|
||||
About the query
|
||||
---------------
|
||||
|
||||
The query we're going to run performs a basic search of the code for ``if`` expressions that are redundant, in the sense that they have an empty ``then`` branch. For example, code such as:
|
||||
|
||||
.. code-block:: swift
|
||||
|
||||
if error {
|
||||
// we should handle the error
|
||||
}
|
||||
|
||||
.. include:: ../reusables/vs-code-basic-instructions/find-database.rst
|
||||
|
||||
Running a quick query
|
||||
---------------------
|
||||
|
||||
.. include:: ../reusables/vs-code-basic-instructions/run-quick-query-1.rst
|
||||
|
||||
#. In the quick query tab, delete the content and paste in the following query.
|
||||
|
||||
.. code-block:: ql
|
||||
|
||||
import swift
|
||||
|
||||
from IfStmt ifStmt
|
||||
where ifStmt.getThen().(BraceStmt).getNumberOfElements() = 0
|
||||
select ifStmt, "This 'if' statement is redundant."
|
||||
|
||||
.. include:: ../reusables/vs-code-basic-instructions/run-quick-query-2.rst
|
||||
|
||||
.. image:: ../images/codeql-for-visual-studio-code/basic-swift-query-results-1.png
|
||||
:align: center
|
||||
|
||||
If any matching code is found, click a link in the ``ifStmt`` column to open the file and highlight the matching ``if`` statement.
|
||||
|
||||
.. image:: ../images/codeql-for-visual-studio-code/basic-swift-query-results-2.png
|
||||
:align: center
|
||||
|
||||
.. include:: ../reusables/vs-code-basic-instructions/note-store-quick-query.rst
|
||||
|
||||
About the query structure
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
After the initial ``import`` statement, this simple query comprises three parts that serve similar purposes to the FROM, WHERE, and SELECT parts of an SQL query.
|
||||
|
||||
+------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------+
|
||||
| Query part | Purpose | Details |
|
||||
+==================================================================+===================================================================================================================+=================================================================================================+
|
||||
| ``import swift`` | Imports the standard CodeQL AST libraries for Swift. | Every query begins with one or more ``import`` statements. |
|
||||
+------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------+
|
||||
| ``from IfStmt ifStmt`` | Defines the variables for the query. | We use: an ``IfStmt`` variable for ``if`` statements. |
|
||||
| | Declarations are of the form: | |
|
||||
| | ``<type> <variable name>`` | |
|
||||
+------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------+
|
||||
| ``where ifStmt.getThen().(BraceStmt).getNumberOfElements() = 0`` | Defines a condition on the variables. | ``ifStmt.getThen()``: gets the ``then`` branch of the ``if`` expression. |
|
||||
| | | ``.(BraceStmt)``: requires that the ``then`` branch is a brace statement (``{ }``). |
|
||||
| | | ``.getNumberOfElements() = 0``: requires that the brace statement contains no child statements. |
|
||||
+------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------+
|
||||
| ``select ifStmt, "This 'if' statement is redundant."`` | Defines what to report for each match. | Reports the resulting ``if`` statement with a string that explains the problem. |
|
||||
| | | |
|
||||
| | ``select`` statements for queries that are used to find instances of poor coding practice are always in the form: | |
|
||||
| | ``select <program element>, "<alert message>"`` | |
|
||||
+------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------+
|
||||
|
||||
Extend the query
|
||||
----------------
|
||||
|
||||
Query writing is an inherently iterative process. You write a simple query and then, when you run it, you discover examples that you had not previously considered, or opportunities for improvement.
|
||||
|
||||
Remove false positive results
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Browsing the results of our basic query shows that it could be improved. Among the results you are likely to find examples of ``if`` statements with an ``else`` branch, where an empty ``then`` branch does serve a purpose. For example:
|
||||
|
||||
.. code-block:: swift
|
||||
|
||||
if (option == "-verbose") {
|
||||
// nothing to do - handled earlier
|
||||
} else {
|
||||
handleError("unrecognized option")
|
||||
}
|
||||
|
||||
In this case, identifying the ``if`` statement with the empty ``then`` branch as redundant is a false positive. One solution to this is to modify the query to select ``if`` statements where both the ``then`` and ``else`` branches are missing.
|
||||
|
||||
To exclude ``if`` statements that have an ``else`` branch:
|
||||
|
||||
#. Add the following to the where clause:
|
||||
|
||||
.. code-block:: ql
|
||||
|
||||
and not exists(ifStmt.getElse())
|
||||
|
||||
The ``where`` clause is now:
|
||||
|
||||
.. code-block:: ql
|
||||
|
||||
where
|
||||
ifStmt.getThen().(BraceStmt).getNumberOfElements() = 0 and
|
||||
not exists(ifStmt.getElse())
|
||||
|
||||
#. Re-run the query.
|
||||
|
||||
There are now fewer results because ``if`` expressions with an ``else`` branch are no longer included.
|
||||
|
||||
Further reading
|
||||
---------------
|
||||
|
||||
.. include:: ../reusables/swift-further-reading.rst
|
||||
.. include:: ../reusables/codeql-ref-tools-further-reading.rst
|
||||
|
||||
.. Article-specific substitutions for the reusables used in docs/codeql/reusables/vs-code-basic-instructions
|
||||
|
||||
.. |language-text| replace:: Swift
|
||||
|
||||
.. |language-code| replace:: ``swift``
|
||||
|
||||
.. |example-url| replace:: https://github.com/alamofire/alamofire
|
||||
|
||||
.. |image-quick-query| image:: ../images/codeql-for-visual-studio-code/quick-query-tab-swift.png
|
||||
|
||||
.. |result-col-1| replace:: The first column corresponds to the expression ``ifStmt`` and is linked to the location in the source code of the project where ``ifStmt`` occurs.
|
||||
18
docs/codeql/codeql-language-guides/codeql-for-swift.rst
Normal file
18
docs/codeql/codeql-language-guides/codeql-for-swift.rst
Normal file
@@ -0,0 +1,18 @@
|
||||
.. _codeql-for-swift:
|
||||
|
||||
CodeQL for Swift
|
||||
================
|
||||
|
||||
Experiment and learn how to write effective and efficient queries for CodeQL databases generated from Swift codebases.
|
||||
|
||||
.. include:: ../reusables/swift-beta-note.rst
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
basic-query-for-swift-code
|
||||
analyzing-data-flow-in-swift
|
||||
|
||||
- :doc:`Basic query for Swift code <basic-query-for-swift-code>`: Learn to write and run a simple CodeQL query.
|
||||
|
||||
- :doc:`Analyzing data flow in Swift <analyzing-data-flow-in-swift>`: You can use CodeQL to track the flow of data through a Swift program to places where the data is used.
|
||||
@@ -14,3 +14,4 @@ Experiment and learn how to write effective and efficient queries for CodeQL dat
|
||||
codeql-for-javascript
|
||||
codeql-for-python
|
||||
codeql-for-ruby
|
||||
codeql-for-swift
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 105 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 132 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
@@ -17,4 +17,6 @@
|
||||
* - Python
|
||||
- ``python``
|
||||
* - Ruby
|
||||
- ``ruby``
|
||||
- ``ruby``
|
||||
* - Swift
|
||||
- ``swift``
|
||||
@@ -278,3 +278,34 @@ and the CodeQL library pack ``codeql/ruby-all`` (`changelog <https://github.com/
|
||||
Ruby on Rails, Web framework
|
||||
rubyzip, Compression library
|
||||
typhoeus, HTTP client
|
||||
|
||||
Swift built-in support
|
||||
================================
|
||||
|
||||
.. include:: ../reusables/swift-beta-note.rst
|
||||
|
||||
Provided by the current versions of the
|
||||
CodeQL query pack ``codeql/swift-queries`` (`changelog <https://github.com/github/codeql/tree/codeql-cli/latest/swift/ql/src/CHANGELOG.md>`__, `source <https://github.com/github/codeql/tree/codeql-cli/latest/swift/ql/src>`__)
|
||||
and the CodeQL library pack ``codeql/swift-all`` (`changelog <https://github.com/github/codeql/tree/codeql-cli/latest/swift/ql/lib/CHANGELOG.md>`__, `source <https://github.com/github/codeql/tree/codeql-cli/latest/swift/ql/lib>`__).
|
||||
|
||||
.. csv-table::
|
||||
:header-rows: 1
|
||||
:class: fullWidthTable
|
||||
:widths: auto
|
||||
|
||||
Name, Category
|
||||
`AEXML <https://github.com/tadija/AEXML>`__, XML processing library
|
||||
`Alamofire <https://github.com/Alamofire/Alamofire>`__, Network communicator
|
||||
`Core Data <https://developer.apple.com/documentation/coredata/>`__, Database
|
||||
`CryptoKit <https://developer.apple.com/documentation/cryptokit/>`__, Cryptography library
|
||||
`CryptoSwift <https://github.com/krzyzanowskim/CryptoSwift>`__, Cryptography library
|
||||
`Foundation <https://developer.apple.com/documentation/foundation>`__, Utility library
|
||||
`GRDB <https://github.com/groue/GRDB.swift>`__, Database
|
||||
`JavaScriptCore <https://developer.apple.com/documentation/javascriptcore>`__, Scripting library
|
||||
`Libxml2 <https://gitlab.gnome.org/GNOME/libxml2>`__, XML processing library
|
||||
`Network <https://developer.apple.com/documentation/network>`__, Network communicator
|
||||
`Realm Swift <https://realm.io/realm-swift/>`__, Database
|
||||
`RNCryptor <https://github.com/RNCryptor/RNCryptor>`__, Cryptography library
|
||||
`SQLite3 <https://sqlite.org/index.html>`__, Database
|
||||
`SQLite.swift <https://github.com/stephencelis/SQLite.swift>`__, Database
|
||||
`WebKit <https://developer.apple.com/documentation/webkit>`__, User interface library
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
JavaScript,ECMAScript 2022 or lower,Not applicable,"``.js``, ``.jsx``, ``.mjs``, ``.es``, ``.es6``, ``.htm``, ``.html``, ``.xhtm``, ``.xhtml``, ``.vue``, ``.hbs``, ``.ejs``, ``.njk``, ``.json``, ``.yaml``, ``.yml``, ``.raml``, ``.xml`` [7]_"
|
||||
Python [8]_,"2.7, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11",Not applicable,``.py``
|
||||
Ruby [9]_,"up to 3.2",Not applicable,"``.rb``, ``.erb``, ``.gemspec``, ``Gemfile``"
|
||||
TypeScript [10]_,"2.6-5.0",Standard TypeScript compiler,"``.ts``, ``.tsx``, ``.mts``, ``.cts``"
|
||||
Swift [10]_,"Swift 5.4-5.7","Swift compiler","``.swift``"
|
||||
TypeScript [11]_,"2.6-5.0",Standard TypeScript compiler,"``.ts``, ``.tsx``, ``.mts``, ``.cts``"
|
||||
|
||||
.. container:: footnote-group
|
||||
|
||||
@@ -37,4 +38,5 @@
|
||||
.. [7] JSX and Flow code, YAML, JSON, HTML, and XML files may also be analyzed with JavaScript files.
|
||||
.. [8] The extractor requires Python 3 to run. To analyze Python 2.7 you should install both versions of Python.
|
||||
.. [9] Requires glibc 2.17.
|
||||
.. [10] TypeScript analysis is performed by running the JavaScript extractor with TypeScript enabled. This is the default.
|
||||
.. [10] Swift support is currently in beta. Support for the analysis of Swift 5.4-5.7 requires macOS. Swift 5.7.3 can also be analyzed using Linux.
|
||||
.. [11] TypeScript analysis is performed by running the JavaScript extractor with TypeScript enabled. This is the default.
|
||||
|
||||
4
docs/codeql/reusables/swift-beta-note.rst
Normal file
4
docs/codeql/reusables/swift-beta-note.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
.. pull-quote:: Note
|
||||
|
||||
CodeQL analysis for Swift is currently in beta. During the beta, analysis of Swift code,
|
||||
and the accompanying documentation, will not be as comprehensive as for other languages.
|
||||
4
docs/codeql/reusables/swift-further-reading.rst
Normal file
4
docs/codeql/reusables/swift-further-reading.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
- `CodeQL queries for Swift <https://github.com/github/codeql/tree/main/swift/ql/src/queries>`__
|
||||
- `Example queries for Swift <https://github.com/github/codeql/tree/main/swift/ql/examples>`__
|
||||
- `CodeQL library reference for Swift <https://codeql.github.com/codeql-standard-libraries/swift/>`__
|
||||
|
||||
Reference in New Issue
Block a user