mirror of
https://github.com/github/codeql.git
synced 2025-12-16 08:43:11 +01:00
Docs: Rename default branch
This commit is contained in:
@@ -9,7 +9,7 @@ You can use the [interactive query console](https://lgtm.com/help/lgtm/using-que
|
||||
|
||||
## Contributing
|
||||
|
||||
We welcome contributions to our standard library and standard checks. Do you have an idea for a new check, or how to improve an existing query? Then please go ahead and open a pull request! Before you do, though, please take the time to read our [contributing guidelines](CONTRIBUTING.md). You can also consult our [style guides](https://github.com/github/codeql/tree/master/docs) to learn how to format your code for consistency and clarity, how to write query metadata, and how to write query help documentation for your query.
|
||||
We welcome contributions to our standard library and standard checks. Do you have an idea for a new check, or how to improve an existing query? Then please go ahead and open a pull request! Before you do, though, please take the time to read our [contributing guidelines](CONTRIBUTING.md). You can also consult our [style guides](https://github.com/github/codeql/tree/main/docs) to learn how to format your code for consistency and clarity, how to write query metadata, and how to write query help documentation for your query.
|
||||
|
||||
## License
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ generates html slide shows in the ``<slides-output>`` directory when run from
|
||||
the ``ql-training`` source directory.
|
||||
|
||||
For more information about creating slides for QL training and variant analysis
|
||||
examples, see the `template slide deck <https://github.com/github/codeql/blob/master/docs/language/ql-training/template.rst>`__.
|
||||
examples, see the `template slide deck <https://github.com/github/codeql/blob/main/docs/language/ql-training/template.rst>`__.
|
||||
|
||||
Viewing the current version of the CodeQL documentation
|
||||
*******************************************************
|
||||
|
||||
@@ -14,7 +14,7 @@ CodeQL includes queries to find the most relevant and interesting problems for e
|
||||
You can add custom queries to `custom query packs <https://lgtm.com/help/lgtm/about-queries#what-are-query-packs>`__ to analyze your projects in `LGTM <https://lgtm.com>`__, use them to analyze a database with the "`CodeQL CLI <https://help.semmle.com/codeql/codeql-cli.html>`__," or you can contribute to the standard CodeQL queries in our `open source repository on GitHub <https://github.com/github/codeql>`__.
|
||||
|
||||
This topic is a basic introduction to query files. You can find more information on writing queries for specific programming languages `here <https://help.semmle.com/QL/learn-ql/>`__, and detailed technical information about QL in the `QL language reference <https://help.semmle.com/QL/ql-handbook/index.html>`__.
|
||||
For more information on how to format your code when contributing queries to the GitHub repository, see the `CodeQL style guide <https://github.com/github/codeql/blob/master/docs/ql-style-guide.md>`__.
|
||||
For more information on how to format your code when contributing queries to the GitHub repository, see the `CodeQL style guide <https://github.com/github/codeql/blob/main/docs/ql-style-guide.md>`__.
|
||||
|
||||
Basic query structure
|
||||
*********************
|
||||
@@ -42,7 +42,7 @@ Query metadata
|
||||
|
||||
Query metadata is used to identify your custom queries when they are added to the GitHub repository or used in your analysis. Metadata provides information about the query's purpose, and also specifies how to interpret and display the query results. For a full list of metadata properties, see ":doc:`Metadata for CodeQL queries <query-metadata>`." The exact metadata requirement depends on how you are going to run your query:
|
||||
|
||||
- If you are contributing a query to the GitHub repository, please read the `query metadata style guide <https://github.com/github/codeql/blob/master/docs/query-metadata-style-guide.md>`__.
|
||||
- If you are contributing a query to the GitHub repository, please read the `query metadata style guide <https://github.com/github/codeql/blob/main/docs/query-metadata-style-guide.md>`__.
|
||||
- If you are adding a custom query to a query pack for analysis using LGTM , see `Writing custom queries to include in LGTM analysis <https://lgtm.com/help/lgtm/writing-custom-queries>`__.
|
||||
- If you are analyzing a database using the `CodeQL CLI <https://help.semmle.com/codeql/codeql-cli.html>`__, your query metadata must contain ``@kind``.
|
||||
- If you are running a query in the query console on LGTM or with the CodeQL extension for VS Code, metadata is not mandatory. However, if you want your results to be displayed as either an 'alert' or a 'path', you must specify the correct ``@kind`` property, as explained below. For more information, see `Using the query console <https://lgtm.com/help/lgtm/using-query-console>`__ on LGTM.com and "`Analyzing your projects <https://help.semmle.com/codeql/codeql-for-vscode/procedures/using-extension.html>`__" in the CodeQL for VS Code help.
|
||||
@@ -120,15 +120,15 @@ You can also find examples of queries developed to find security vulnerabilities
|
||||
Contributing queries
|
||||
********************
|
||||
|
||||
Contributions to the standard queries and libraries are very welcome. For more information, see our `contributing guidelines <https://github.com/github/codeql/blob/master/CONTRIBUTING.md>`__.
|
||||
Contributions to the standard queries and libraries are very welcome. For more information, see our `contributing guidelines <https://github.com/github/codeql/blob/main/CONTRIBUTING.md>`__.
|
||||
If you are contributing a query to the open source GitHub repository, writing a custom query for LGTM, or using a custom query in an analysis with the CodeQL CLI, then you need to include extra metadata in your query to ensure that the query results are interpreted and displayed correctly. See the following topics for more information on query metadata:
|
||||
|
||||
- ":doc:`Metadata for CodeQL queries <query-metadata>`"
|
||||
- `Query metadata style guide on GitHub <https://github.com/github/codeql/blob/master/docs/query-metadata-style-guide.md>`__
|
||||
- `Query metadata style guide on GitHub <https://github.com/github/codeql/blob/main/docs/query-metadata-style-guide.md>`__
|
||||
|
||||
Query contributions to the open source GitHub repository may also have an accompanying query help file to provide information about their purpose for other users. For more information on writing query help, see the `Query help style guide on GitHub <https://github.com/github/codeql/blob/master/docs/query-help-style-guide.md>`__ and the ":doc:`Query help files <query-help>`."
|
||||
Query contributions to the open source GitHub repository may also have an accompanying query help file to provide information about their purpose for other users. For more information on writing query help, see the `Query help style guide on GitHub <https://github.com/github/codeql/blob/main/docs/query-help-style-guide.md>`__ and the ":doc:`Query help files <query-help>`."
|
||||
|
||||
Query help files
|
||||
****************
|
||||
|
||||
When you write a custom query, we also recommend that you write a query help file to explain the purpose of the query to other users. For more information, see the `Query help style guide <https://github.com/github/codeql/blob/master/docs/query-help-style-guide.md>`__ on GitHub, and the ":doc:`Query help files <query-help>`."
|
||||
When you write a custom query, we also recommend that you write a query help file to explain the purpose of the query to other users. For more information, see the `Query help style guide <https://github.com/github/codeql/blob/main/docs/query-help-style-guide.md>`__ on GitHub, and the ":doc:`Query help files <query-help>`."
|
||||
|
||||
@@ -4,7 +4,7 @@ Query help files
|
||||
Query help files tell users the purpose of a query, and recommend how to solve the potential problem the query finds.
|
||||
|
||||
This topic provides detailed information on the structure of query help files.
|
||||
For more information about how to write useful query help in a style that is consistent with the standard CodeQL queries, see the `Query help style guide <https://github.com/github/codeql/blob/master/docs/query-help-style-guide.md>`__ on GitHub.
|
||||
For more information about how to write useful query help in a style that is consistent with the standard CodeQL queries, see the `Query help style guide <https://github.com/github/codeql/blob/main/docs/query-help-style-guide.md>`__ on GitHub.
|
||||
|
||||
|
||||
.. pull-quote::
|
||||
@@ -13,7 +13,7 @@ For more information about how to write useful query help in a style that is con
|
||||
|
||||
You can access the query help for CodeQL queries by visiting the `Built-in query pages <https://help.semmle.com/wiki/display/QL/Built-in+queries>`__.
|
||||
You can also access the raw query help files in the `GitHub repository <https://github.com/github/codeql>`__.
|
||||
For example, see the `JavaScript security queries <https://github.com/github/codeql/tree/master/javascript/ql/src/Security>`__ and `C/C++ critical queries <https://github.com/github/codeql/tree/master/cpp/ql/src/Critical>`__.
|
||||
For example, see the `JavaScript security queries <https://github.com/github/codeql/tree/main/javascript/ql/src/Security>`__ and `C/C++ critical queries <https://github.com/github/codeql/tree/main/cpp/ql/src/Critical>`__.
|
||||
|
||||
For queries run by default on LGTM, there are several different ways to access the query help. For further information, see `Where do I see the query help for a query on LGTM? <https://lgtm.com/help/lgtm/query-help#where-query-help-in-lgtm>`__ in the LGTM user help.
|
||||
|
||||
@@ -169,7 +169,7 @@ The ``include`` element can be used as a section or block element. The content o
|
||||
Section-level include elements
|
||||
------------------------------
|
||||
|
||||
Section-level ``include`` elements can be located beneath the top-level ``qhelp`` element. For example, in `StoredXSS.qhelp <https://github.com/github/codeql/blob/master/csharp/ql/src/Security%20Features/CWE-079/StoredXSS.qhelp>`__, a full query help file is reused:
|
||||
Section-level ``include`` elements can be located beneath the top-level ``qhelp`` element. For example, in `StoredXSS.qhelp <https://github.com/github/codeql/blob/main/csharp/ql/src/Security%20Features/CWE-079/StoredXSS.qhelp>`__, a full query help file is reused:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
@@ -177,12 +177,12 @@ Section-level ``include`` elements can be located beneath the top-level ``qhelp`
|
||||
<include src="XSS.qhelp" />
|
||||
</qhelp>
|
||||
|
||||
In this example, the `XSS.qhelp <https://github.com/github/codeql/blob/master/csharp/ql/src/Security%20Features/CWE-079/XSS.qhelp>`__ file must conform to the standard for a full query help file as described above. That is, the ``qhelp`` element may only contain non-``fragment``, section-level elements.
|
||||
In this example, the `XSS.qhelp <https://github.com/github/codeql/blob/main/csharp/ql/src/Security%20Features/CWE-079/XSS.qhelp>`__ file must conform to the standard for a full query help file as described above. That is, the ``qhelp`` element may only contain non-``fragment``, section-level elements.
|
||||
|
||||
Block-level include elements
|
||||
----------------------------
|
||||
|
||||
Block-level ``include`` elements can be included beneath section-level elements. For example, an ``include`` element is used beneath the ``overview`` section in `ThreadUnsafeICryptoTransform.qhelp <https://github.com/github/codeql/blob/master/csharp/ql/src/Likely%20Bugs/ThreadUnsafeICryptoTransform.qhelp>`__:
|
||||
Block-level ``include`` elements can be included beneath section-level elements. For example, an ``include`` element is used beneath the ``overview`` section in `ThreadUnsafeICryptoTransform.qhelp <https://github.com/github/codeql/blob/main/csharp/ql/src/Likely%20Bugs/ThreadUnsafeICryptoTransform.qhelp>`__:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
@@ -193,7 +193,7 @@ Block-level ``include`` elements can be included beneath section-level elements.
|
||||
...
|
||||
</qhelp>
|
||||
|
||||
The included file, `ThreadUnsafeICryptoTransformOverview.qhelp <https://github.com/github/codeql/blob/master/csharp/ql/src/Likely%20Bugs/ThreadUnsafeICryptoTransformOverview.qhelp>`_, may only contain one or more ``fragment`` sections. For example:
|
||||
The included file, `ThreadUnsafeICryptoTransformOverview.qhelp <https://github.com/github/codeql/blob/main/csharp/ql/src/Likely%20Bugs/ThreadUnsafeICryptoTransformOverview.qhelp>`_, may only contain one or more ``fragment`` sections. For example:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ About query metadata
|
||||
|
||||
Any query that is run as part of an analysis includes a number of properties, known as query metadata. Metadata is included at the top of each query file as the content of a `QLDoc <https://help.semmle.com/QL/ql-spec/qldoc.html>`__ comment.
|
||||
This metadata tells LGTM and the CodeQL `extension for VS Code <https://help.semmle.com/codeql/codeql-for-vscode.html>`__ how to handle the query and display its results correctly.
|
||||
It also gives other users information about what the query results mean. For more information on query metadata, see the `query metadata style guide <https://github.com/github/codeql/blob/master/docs/query-metadata-style-guide.md>`__ in our `open source repository <https://github.com/github/codeql>`__ on GitHub.
|
||||
It also gives other users information about what the query results mean. For more information on query metadata, see the `query metadata style guide <https://github.com/github/codeql/blob/main/docs/query-metadata-style-guide.md>`__ in our `open source repository <https://github.com/github/codeql>`__ on GitHub.
|
||||
|
||||
.. pull-quote::
|
||||
|
||||
@@ -34,7 +34,7 @@ The following properties are supported by all query files:
|
||||
| ``@name`` | ``<text>`` | A statement that defines the label of the query. The name is written in plain text, and uses single quotes (``'``) to enclose code elements. |
|
||||
+-----------------------+---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| ``@tags`` | | ``correctness`` | These tags group queries together in broad categories to make it easier to search for them and identify them. In addition to the common tags listed here, there are also a number of more specific categories. For more information, see the |
|
||||
| | | ``maintainability`` | `Query metadata style guide <https://github.com/github/codeql/blob/master/docs/query-metadata-style-guide.md>`__. |
|
||||
| | | ``maintainability`` | `Query metadata style guide <https://github.com/github/codeql/blob/main/docs/query-metadata-style-guide.md>`__. |
|
||||
| | | ``readability`` | |
|
||||
| | | ``security`` | |
|
||||
+-----------------------+---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
@@ -134,4 +134,4 @@ Model answer, step 4
|
||||
and sink.getNode() instanceof UnsafeDeserializationSink
|
||||
select sink.getNode().(UnsafeDeserializationSink).getMethodAccess(), source, sink, "Unsafe deserialization of $@.", source, "user input"
|
||||
|
||||
More full-featured version: https://github.com/github/security-lab/tree/master/CodeQL_Queries/java/Apache_Struts_CVE-2017-9805
|
||||
More full-featured version: https://github.com/github/security-lab/tree/main/CodeQL_Queries/java/Apache_Struts_CVE-2017-9805
|
||||
@@ -54,7 +54,7 @@ Code injection in Apache struts
|
||||
.. note::
|
||||
|
||||
More details on the CVE can be found here: https://securitylab.github.com/research/apache-struts-CVE-2018-11776 and
|
||||
https://github.com/github/security-lab/tree/master/CodeQL_Queries/java/Apache_Struts_CVE-2018-11776
|
||||
https://github.com/github/security-lab/tree/main/CodeQL_Queries/java/Apache_Struts_CVE-2018-11776
|
||||
|
||||
More details on OGNL can be found here: https://commons.apache.org/proper/commons-ognl/
|
||||
|
||||
|
||||
@@ -65,6 +65,6 @@ Entity types are rarely used directly, the usual pattern is to define a class th
|
||||
|
||||
For example, the database schemas for C/++, C#, and Java CodeQL databases are here:
|
||||
|
||||
- https://github.com/github/codeql/blob/master/cpp/ql/src/semmlecode.cpp.dbscheme
|
||||
- https://github.com/github/codeql/blob/master/csharp/ql/src/semmlecode.csharp.dbscheme
|
||||
- https://github.com/github/codeql/blob/master/java/ql/src/config/semmlecode.dbscheme
|
||||
- https://github.com/github/codeql/blob/main/cpp/ql/src/semmlecode.cpp.dbscheme
|
||||
- https://github.com/github/codeql/blob/main/csharp/ql/src/semmlecode.csharp.dbscheme
|
||||
- https://github.com/github/codeql/blob/main/java/ql/src/config/semmlecode.dbscheme
|
||||
@@ -1,4 +1,4 @@
|
||||
- `CodeQL queries for C and C++ <https://github.com/github/codeql/tree/master/cpp/ql/src>`__
|
||||
- `Example queries for C and C++ <https://github.com/github/codeql/tree/master/cpp/ql/examples>`__
|
||||
- `CodeQL queries for C and C++ <https://github.com/github/codeql/tree/main/cpp/ql/src>`__
|
||||
- `Example queries for C and C++ <https://github.com/github/codeql/tree/main/cpp/ql/examples>`__
|
||||
- `CodeQL library reference for C and C++ <https://help.semmle.com/qldoc/cpp/>`__
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
- `CodeQL queries for C# <https://github.com/github/codeql/tree/master/csharp/ql/src>`__
|
||||
- `Example queries for C# <https://github.com/github/codeql/tree/master/csharp/ql/examples>`__
|
||||
- `CodeQL queries for C# <https://github.com/github/codeql/tree/main/csharp/ql/src>`__
|
||||
- `Example queries for C# <https://github.com/github/codeql/tree/main/csharp/ql/examples>`__
|
||||
- `CodeQL library reference for C# <https://help.semmle.com/qldoc/csharp/>`__
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
- `CodeQL queries for Go <https://github.com/github/codeql-go/tree/master/ql/src>`__
|
||||
- `Example queries for Go <https://github.com/github/codeql-go/tree/master/ql/examples>`__
|
||||
- `CodeQL queries for Go <https://github.com/github/codeql-go/tree/main/ql/src>`__
|
||||
- `Example queries for Go <https://github.com/github/codeql-go/tree/main/ql/examples>`__
|
||||
- `CodeQL library reference for Go <https://help.semmle.com/qldoc/go/>`__
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
- `CodeQL queries for Java <https://github.com/github/codeql/tree/master/java/ql/src>`__
|
||||
- `Example queries for Java <https://github.com/github/codeql/tree/master/java/ql/examples>`__
|
||||
- `CodeQL queries for Java <https://github.com/github/codeql/tree/main/java/ql/src>`__
|
||||
- `Example queries for Java <https://github.com/github/codeql/tree/main/java/ql/examples>`__
|
||||
- `CodeQL library reference for Java <https://help.semmle.com/qldoc/java/>`__
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
- `CodeQL queries for JavaScript <https://github.com/github/codeql/tree/master/javascript/ql/src>`__
|
||||
- `Example queries for JavaScript <https://github.com/github/codeql/tree/master/javascript/ql/examples>`__
|
||||
- `CodeQL queries for JavaScript <https://github.com/github/codeql/tree/main/javascript/ql/src>`__
|
||||
- `Example queries for JavaScript <https://github.com/github/codeql/tree/main/javascript/ql/examples>`__
|
||||
- `CodeQL library reference for JavaScript <https://help.semmle.com/qldoc/javascript/>`__
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
- `CodeQL queries for Python <https://github.com/github/codeql/tree/master/python/ql/src>`__
|
||||
- `Example queries for Python <https://github.com/github/codeql/tree/master/python/ql/examples>`__
|
||||
- `CodeQL queries for Python <https://github.com/github/codeql/tree/main/python/ql/src>`__
|
||||
- `Example queries for Python <https://github.com/github/codeql/tree/main/python/ql/examples>`__
|
||||
- `CodeQL library reference for Python <https://help.semmle.com/qldoc/python/>`__
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ Query files have the extension `.ql`. Each file has two distinct areas:
|
||||
* Query definition–defined using QL. The query includes a select statement, which defines the content and format of the results. For further information about writing QL, see the following topics:
|
||||
* [Learning CodeQL](https://help.semmle.com/QL/learn-ql/index.html)
|
||||
* [QL language reference](https://help.semmle.com/QL/ql-handbook/index.html)
|
||||
* [CodeQL style guide](https://github.com/github/codeql/blob/master/docs/ql-style-guide.md)
|
||||
* [CodeQL style guide](https://github.com/github/codeql/blob/main/docs/ql-style-guide.md)
|
||||
|
||||
|
||||
For examples of query files for the languages supported by CodeQL, visit the following links:
|
||||
|
||||
Reference in New Issue
Block a user