Skip to content

Commit 78a8760

Browse files
subatoisaritaifelicitymayshati-patelsabrowning1
authored
[17th April 2024] VS Code CodeQL content megabranch (#49056)
Co-authored-by: Sarita Iyer <[email protected]> Co-authored-by: Felicity Chapman <[email protected]> Co-authored-by: Shati Patel <[email protected]> Co-authored-by: Sam Browning <[email protected]> Co-authored-by: github-actions <[email protected]> Co-authored-by: James Fletcher <[email protected]> Co-authored-by: Joe Clark <[email protected]>
1 parent 840a1f7 commit 78a8760

File tree

48 files changed

+1436
-27
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1436
-27
lines changed
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

content/code-security/code-scanning/managing-your-code-scanning-configuration/editing-your-configuration-of-default-setup.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ If you use frameworks and libraries that are not recognized by the standard libr
8686

8787
For default setup, you need to define the models of your additional dependencies in {% data variables.product.prodname_codeql %} model packs. You can extend coverage in default setup with {% data variables.product.prodname_codeql %} model packs for individual repositories, or at scale for all repositories in an organization.
8888

89-
For more information about {% data variables.product.prodname_codeql %} model packs and writing your own, see [Using the {% data variables.product.prodname_codeql %} model editor](https://codeql.github.com/docs/codeql-for-visual-studio-code/using-the-codeql-model-editor) in the {% data variables.product.prodname_codeql %} documentation.
89+
For more information about {% data variables.product.prodname_codeql %} model packs and writing your own, see "[AUTOTITLE](/code-security/codeql-for-vs-code/using-the-advanced-functionality-of-the-codeql-for-vs-code-extension/using-the-codeql-model-editor)."
9090

9191
### Extending coverage for a repository
9292

content/code-security/codeql-cli/getting-started-with-the-codeql-cli/about-the-codeql-cli.md

+1-20
Original file line numberDiff line numberDiff line change
@@ -109,23 +109,4 @@ codeql github upload-results \
109109
--sarif=python-results.sarif
110110
```
111111

112-
## About the {% data variables.product.prodname_dotcom %} {% data variables.product.prodname_codeql %} license
113-
114-
**License notice:** If you don’t have a {% data variables.product.prodname_enterprise %} license then, by installing this product, you are agreeing to the [{% data variables.product.prodname_dotcom %} {% data variables.product.prodname_codeql %} Terms and Conditions](https://securitylab.github.com/tools/codeql/license).
115-
116-
{% data variables.product.prodname_dotcom %} {% data variables.product.prodname_codeql %} is licensed on a per-user basis. Under the license restrictions, you can use {% data variables.product.prodname_codeql %} to perform the following tasks:
117-
118-
- To perform academic research.
119-
- To demonstrate the software.
120-
- To test {% data variables.product.prodname_codeql %} queries that are released under an OSI-approved License to confirm that new versions of those queries continue to find the right vulnerabilities.
121-
122-
Where "OSI-approved License" means an Open Source Initiative (OSI)-approved open source software license.
123-
124-
If you are working with an Open Source Codebase (that is, a codebase that is released under an OSI-approved License) you can also use {% data variables.product.prodname_codeql %} for the following tasks:
125-
126-
- To perform analysis of the Open Source Codebase.
127-
- If the Open Source Codebase is hosted and maintained on {% data variables.product.prodname_dotcom_the_website %}, to generate {% data variables.product.prodname_codeql %} databases for or during automated analysis, continuous integration, or continuous delivery.
128-
129-
{% data variables.product.prodname_codeql %} can’t be used for automated analysis, continuous integration or continuous delivery, whether as part of normal software engineering processes or otherwise, except in the express cases set forth herein unless you have a license for {% data variables.product.prodname_GH_advanced_security %}.
130-
131-
{% data reusables.advanced-security.ghas-trial %}
112+
{% data reusables.code-scanning.codeql-license %}

content/code-security/codeql-cli/getting-started-with-the-codeql-cli/setting-up-the-codeql-cli.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ For Linux, Windows, and macOS users (version 10.14 "Mojave", and earlier) simply
6868
{% note %}
6969

7070
**Note:** If you add `codeql` to your `PATH`, it can be accessed by {% data variables.product.prodname_codeql %} for {% data variables.product.prodname_vscode %} to compile and run queries.
71-
For more information about configuring {% data variables.product.prodname_vscode_shortname %} to access the {% data variables.product.prodname_codeql_cli %}, see "[Setting up {% data variables.product.prodname_codeql %} in {% data variables.product.prodname_vscode %}](https://codeql.github.com/docs/codeql-for-visual-studio-code/setting-up-codeql-in-visual-studio-code/#setting-up-codeql-in-visual-studio-code)."
71+
For more information about configuring {% data variables.product.prodname_vscode_shortname %} to access the {% data variables.product.prodname_codeql_cli %}, see "[AUTOTITLE](/code-security/codeql-for-vs-code/using-the-advanced-functionality-of-the-codeql-for-vs-code-extension/configuring-access-to-the-codeql-cli)."
7272

7373
{% endnote %}
7474

content/code-security/codeql-cli/using-the-advanced-functionality-of-the-codeql-cli/advanced-setup-of-the-codeql-cli.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ If you want to use the latest {% data variables.product.prodname_codeql %} featu
107107

108108
{% data variables.product.prodname_dotcom %} stores {% data variables.product.prodname_codeql %} databases for over 200,000 repositories on {% data variables.product.prodname_dotcom_the_website %}, which you can download using the REST API. The list of repositories is constantly growing and evolving to make sure that it includes the most interesting codebases for security research.
109109

110-
You can also analyze databases from {% data variables.product.prodname_dotcom_the_website %} using the {% data variables.product.prodname_codeql %} for {% data variables.product.prodname_vscode_shortname %} extension. For more information, see "[Analyzing your projects](https://codeql.github.com/docs/codeql-for-visual-studio-code/analyzing-your-projects)."
110+
You can also analyze databases from {% data variables.product.prodname_dotcom_the_website %} using the {% data variables.product.prodname_codeql %} for {% data variables.product.prodname_vscode_shortname %} extension. For more information, see "[AUTOTITLE](/code-security/codeql-for-vs-code/getting-started-with-codeql-for-vs-code/running-codeql-queries)."
111111

112112
You can check if a repository has any {% data variables.product.prodname_codeql %} databases available for download using the `/repos/<owner>/<repo>/code-scanning/codeql/databases` endpoint. For example, to check for {% data variables.product.prodname_codeql %} databases using the [{% data variables.product.prodname_cli %}](https://cli.github.com/manual/gh_api) you would run:
113113

content/code-security/codeql-cli/using-the-advanced-functionality-of-the-codeql-cli/creating-and-working-with-codeql-packs.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ The `codeql pack init` command creates the directory structure and configuration
7878

7979
{% data reusables.code-scanning.beta-model-packs %}
8080

81-
Model packs can be used to expand {% data variables.product.prodname_code_scanning %} analysis to recognize libraries and frameworks that are not supported by default. Model packs use data extensions, which are implemented as YAML and describe how to add data for new dependencies. When a model pack is specified, the data extensions in that pack will be added to the {% data variables.product.prodname_code_scanning %} analysis automatically. For more information about {% data variables.product.prodname_codeql %} model packs and data extensions, see [Using the {% data variables.product.prodname_codeql %} model editor](https://codeql.github.com/docs/codeql-for-visual-studio-code/using-the-codeql-model-editor) in the {% data variables.product.prodname_codeql %} documentation.
81+
Model packs can be used to expand {% data variables.product.prodname_code_scanning %} analysis to recognize libraries and frameworks that are not supported by default. Model packs use data extensions, which are implemented as YAML and describe how to add data for new dependencies. When a model pack is specified, the data extensions in that pack will be added to the {% data variables.product.prodname_code_scanning %} analysis automatically. For more information about {% data variables.product.prodname_codeql %} model packs and data extensions, see "[AUTOTITLE](/code-security/codeql-for-vs-code/using-the-advanced-functionality-of-the-codeql-for-vs-code-extension/using-the-codeql-model-editor)."
8282

8383
A model pack is a {% data variables.product.prodname_codeql %} pack with the following characteristics in the `qlpack.yml` file:
8484

content/code-security/codeql-cli/using-the-advanced-functionality-of-the-codeql-cli/testing-custom-queries.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,9 @@ This information may be sufficient to debug trivial test failures.
227227

228228
For failures that are harder to debug, you can import `EmptyThen.testproj`
229229
into {% data variables.product.prodname_codeql %} for {% data variables.product.prodname_vscode_shortname %}, execute `EmptyThen.ql`, and view the results in the
230-
`Test.java` example code. For more information, see "[Analyzing your projects](https://codeql.github.com/docs/codeql-for-visual-studio-code/analyzing-your-projects/#analyzing-your-projects)" in the {% data variables.product.prodname_codeql %} for {% data variables.product.prodname_vscode_shortname %} help.
230+
`Test.java` example code. For more information, see "[AUTOTITLE](/code-security/codeql-for-vs-code/getting-started-with-codeql-for-vs-code/managing-codeql-databases#choosing-a-database-to-analyze)."
231231

232232
## Further reading
233233

234234
- "[{% data variables.product.prodname_codeql %} queries](https://codeql.github.com/docs/writing-codeql-queries/codeql-queries/#codeql-queries)"
235-
- "[Testing {% data variables.product.prodname_codeql %} queries in {% data variables.product.prodname_vscode %}](https://codeql.github.com/docs/codeql-for-visual-studio-code/testing-codeql-queries-in-visual-studio-code/#testing-codeql-queries-in-visual-studio-code)."
235+
- "[AUTOTITLE](/code-security/codeql-for-vs-code/using-the-advanced-functionality-of-the-codeql-for-vs-code-extension/testing-codeql-queries-in-vs-code)."
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
title: About CodeQL for VS Code
3+
shortTitle: About the extension
4+
versions:
5+
fpt: '*'
6+
ghec: '*'
7+
ghes: '*'
8+
topics:
9+
- Advanced Security
10+
- Code scanning
11+
- CodeQL
12+
type: reference
13+
intro: 'You can write, run, and test {% data variables.product.prodname_codeql %} queries inside {% data variables.product.prodname_vscode %} with the {% data variables.product.prodname_codeql %} extension.'
14+
---
15+
16+
## About {% data variables.product.prodname_codeql %} for {% data variables.product.prodname_vscode %}
17+
18+
You can run {% data variables.product.prodname_codeql %} queries on databases generated from source code, in order to find errors and security vulnerabilities in a codebase. For more information about {% data variables.product.prodname_codeql %} {% data variables.product.prodname_code_scanning %}, see "[AUTOTITLE](/code-security/code-scanning/introduction-to-code-scanning/about-code-scanning-with-codeql)."
19+
20+
With the {% data variables.product.prodname_codeql %} for {% data variables.product.prodname_vscode %} extension, you can:
21+
22+
- Write custom {% data variables.product.prodname_codeql %} queries and supporting libraries.
23+
- Directly view and use the {% data variables.product.prodname_codeql %} security queries from the large, open-source [`github/codeql`](https://github.com/github/codeql) repository.
24+
- Run queries over one or more {% data variables.product.prodname_codeql %} databases.
25+
- Track the flow of data through a program, highlighting areas that are potential security vulnerabilities.
26+
- View, create, and edit all types of {% data variables.product.prodname_codeql %} packs of queries or libraries that you can use or publish to share with others.
27+
- Run unit tests for {% data variables.product.prodname_codeql %} queries.
28+
- Use a dedicated editor for viewing, creating, and editing {% data variables.product.prodname_codeql %} model packs, which are used to extend standard {% data variables.product.prodname_codeql %} analysis.
29+
30+
The {% data variables.product.prodname_codeql %} for {% data variables.product.prodname_vscode %} extension also adds a {% data variables.product.prodname_codeql %} sidebar view to {% data variables.product.prodname_vscode_shortname %}. This contains a list of local {% data variables.product.prodname_codeql %} databases, an overview of the queries that you have run in the current session, and a variant analysis view for large-scale analysis.
31+
32+
### IntelliSense
33+
34+
The extension provides standard IntelliSense features for query files (extension `.ql`) and library files (extension `.qll`) that you open in the {% data variables.product.prodname_vscode_shortname %} editor. These include:
35+
36+
- Syntax highlighting
37+
- Right-click options (such as **Go To Definition**)
38+
- Autocomplete suggestions
39+
- Hover information
40+
41+
For more information about Intellisense in {% data variables.product.prodname_vscode_shortname %}, see [IntelliSense](https://code.visualstudio.com/docs/editor/intellisense) in the {% data variables.product.prodname_vscode %} documentation.
42+
43+
You can also use the {% data variables.product.prodname_vscode_shortname %} **Format Document** command to format your code according to the [{% data variables.product.prodname_codeql %} style guide](https://github.com/github/codeql/blob/main/docs/ql-style-guide.md).
44+
45+
### The {% data variables.product.prodname_vscode_command_palette_shortname %}
46+
47+
You can run commands for the {% data variables.product.prodname_codeql %} for {% data variables.product.prodname_vscode %} extension from the {% data variables.product.prodname_vscode_command_palette_shortname %}. For more information about the {% data variables.product.prodname_vscode_command_palette_shortname %}, see "[User Interface](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette)" in the {% data variables.product.prodname_vscode_shortname %} documentation.
48+
49+
## Data and telemetry
50+
51+
If you specifically opt in to permit {% data variables.product.prodname_dotcom %} to do so, {% data variables.product.prodname_dotcom %} will collect usage data and metrics for the purposes of helping the core developers to improve the {% data variables.product.prodname_codeql %} for {% data variables.product.prodname_vscode %} extension. For more information, see "[AUTOTITLE](/code-security/codeql-for-vs-code/using-the-advanced-functionality-of-the-codeql-for-vs-code-extension/telemetry-in-codeql-for-visual-studio-code)."
52+
53+
{% data reusables.code-scanning.codeql-license %}
54+
55+
## Next steps
56+
57+
To learn about how to install the {% data variables.product.prodname_codeql %} for {% data variables.product.prodname_vscode %} extension, see "[AUTOTITLE](/code-security/codeql-for-vs-code/getting-started-with-codeql-for-vs-code/installing-codeql-for-vs-code)."
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: Exploring data flow with path queries
3+
shortTitle: Explore data flow
4+
versions:
5+
fpt: '*'
6+
ghec: '*'
7+
ghes: '*'
8+
topics:
9+
- Advanced Security
10+
- Code scanning
11+
- CodeQL
12+
type: reference
13+
intro: 'You can run {% data variables.product.prodname_codeql %} queries in {% data variables.product.prodname_vscode %} to help you track the flow of data through a program, highlighting areas that are potential security vulnerabilities.'
14+
---
15+
16+
## About path queries
17+
18+
A path query is a {% data variables.product.prodname_codeql %} query with the property `@kind path-problem`. You can find a number of these in the standard {% data variables.product.prodname_codeql %} libraries.
19+
20+
You can run the standard {% data variables.product.prodname_codeql %} path queries to identify security vulnerabilities and manually look through the results. For more information about how {% data variables.product.prodname_codeql %} tracks data flow, see "[About data flow analysis](https://codeql.github.com/docs/writing-codeql-queries/about-data-flow-analysis/)" in the {% data variables.product.prodname_codeql %} documentation.
21+
22+
Once you're familiar with data flow analysis and existing queries, you can write your own path queries in {% data variables.product.prodname_codeql %}. For more information, see "[Next steps](#next-steps)."
23+
24+
## Running path queries in {% data variables.product.prodname_vscode_shortname %} locally
25+
26+
1. Open a path query in {% data variables.product.prodname_vscode_shortname %}.
27+
1. Right-click in the window with the query open, and select **{% data variables.product.prodname_codeql %}: Run Query on Selected Database**. Alternatively, you can also run this from the {% data variables.product.prodname_vscode_command_palette_shortname %}.
28+
1. Once the query has finished running, you can see the results in the "Results" view (under `alerts` in the dropdown menu). Each query result describes the flow of information between a source and a sink.
29+
1. Expand the result to see the individual steps that the data follows.
30+
1. Click each step to jump to it in the source code and investigate the problem further.
31+
32+
## Next steps
33+
34+
{% ifversion codeql-vs-code-mrva %}
35+
36+
When you are ready to run a path query at scale, you can use the "Variant Analysis Repositories" view to run the query against up to 1,000 repositories on {% data variables.product.prodname_dotcom_the_website %}. For more information, see "[AUTOTITLE](/code-security/codeql-for-vs-code/getting-started-with-codeql-for-vs-code/running-codeql-queries-at-scale-with-multi-repository-variant-analysis)."
37+
38+
{% endif %}
39+
40+
For information about how to use the correct format and metadata for your own path queries, see "[Creating path queries](https://codeql.github.com/docs/writing-codeql-queries/creating-path-queries/#creating-path-queries)" in the {% data variables.product.prodname_codeql %} documentation. The {% data variables.product.prodname_codeql %} documentation also contains detailed information about how to define new sources and sinks, as well as templates and examples of how to extend the standard {% data variables.product.prodname_codeql %} libraries to suit your analysis.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
title: Getting started with the {% data variables.product.prodname_codeql %} for Visual Studio Code extension
3+
shortTitle: Getting started
4+
intro: 'The {% data variables.product.prodname_codeql %} extension for {% data variables.product.prodname_vscode %} makes it easy to run a query to find problems in codebases.'
5+
product: '{% data reusables.gated-features.codeql %}'
6+
versions:
7+
fpt: '*'
8+
ghes: '*'
9+
ghec: '*'
10+
topics:
11+
- Advanced Security
12+
- Code scanning
13+
- CodeQL
14+
children:
15+
- /about-codeql-for-vs-code
16+
- /installing-codeql-for-vs-code
17+
- /managing-codeql-databases
18+
- /running-codeql-queries
19+
- /exploring-data-flow-with-path-queries
20+
- /running-codeql-queries-at-scale-with-multi-repository-variant-analysis
21+
---
22+

0 commit comments

Comments
 (0)