Skip to content

Commit 49ec539

Browse files
committed
Updates following initial PM review
1 parent 29802af commit 49ec539

File tree

2 files changed

+21
-26
lines changed

2 files changed

+21
-26
lines changed

docs/codeql/codeql-for-visual-studio-code/running-codeql-queries-at-scale-with-mrva.rst

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,23 @@ When you write a query to find variants of a security vulnerability and finish t
1414

1515
The core functionality of the CodeQL extension helps you write queries and run them locally against a CodeQL database. In contrast, variant analysis allows you to send your CodeQL query to GitHub.com to be tested against a list of repositories.
1616

17-
When you run variant analysis against a list of repositories, your query is run against each repository that has a CodeQL database available to analyze. GitHub creates and stores CodeQL databases for thousands of public repositories, including every repository that runs code scanning using CodeQL. If you want to include your repositories in variant analysis, you need to enable code scanning using CodeQL on GitHub.com before adding your repository to a list for analysis. For information about enabling code scanning using CodeQL, see "`Configuring code scanning automatically <https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning-for-a-repository#configuring-code-scanning-automatically>`__."
17+
When you run variant analysis against a list of repositories, your query is run against each repository that has a CodeQL database available to analyze. GitHub creates and stores CodeQL databases for thousands of public repositories, including every repository that runs code scanning using CodeQL. If you want to run variant analysis on your repositories, you need to enable code scanning using CodeQL on GitHub.com before adding your repository to a list for analysis (either default setup, or advanced setup using the CodeQL action). For information about enabling code scanning using CodeQL, see "`Configuring code scanning automatically <https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning-for-a-repository#configuring-code-scanning-automatically>`__."
1818

1919
.. _controller-repository:
2020

2121
Setting a controller repository for variant analysis
2222
----------------------------------------------------
2323

24-
When you run variant analysis, the analysis is run entirely using GitHub Actions. You don't need to create any workflows, but you must specify which GitHub repository the CodeQL extension should use as the "controller repository." Controller repositories can be empty, but they must have at least one commit and the ``GITHUB_TOKEN`` must have "Read and write permissions" when running workflows. For more information, see "`Managing GitHub Actions settings for a repository <https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#setting-the-permissions-of-the-github_token-for-your-repository>`__."
24+
When you run variant analysis, the analysis is run entirely using GitHub Actions. You don't need to create any workflows, but you must specify which GitHub repository the CodeQL extension should use as the "controller repository." Controller repositories can be empty, but they must have at least one commit. The ``GITHUB_TOKEN`` must also have "Read and write permissions" to run workflows in that repository. For more information, see "`Managing GitHub Actions settings for a repository <https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#setting-the-permissions-of-the-github_token-for-your-repository>`__."
2525

2626
.. pull-quote::
2727

2828
Note
2929

3030
- The controller repository visibility can be "public" if you plan to analyze public repositories. The variant analysis will be free.
31-
- The controller repository visibility must be "private" if you need to analyze any private repositories. Any actions minutes used by variant analysis, above the free limit, will be charged to the repository owner. For more information about free minutes and billing, see "`About billing for GitHub Actions <https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions>`__."
31+
- The controller repository visibility must be "private" if you need to analyze any private or internal repositories. Any actions minutes used by variant analysis, above the free limit, will be charged to the repository owner. For more information about free minutes and billing, see "`About billing for GitHub Actions <https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions>`__."
3232

33-
TODO: Check on "internal" repositories.
34-
35-
Setting up variant analysis
36-
---------------------------
37-
38-
You can define a controller repository before running your first variant analysis.
33+
You must define a controller repository before you can run your first variant analysis.
3934

4035
.. image:: ../images/codeql-for-visual-studio-code/controller-repository.png
4136
:width: 350
@@ -58,18 +53,16 @@ Running a query at scale using variant analysis
5853

5954
#. Select which GitHub repository or repositories you want to run your query against.
6055

61-
- Select **Top X repositories**.
62-
- Click **Add new database**, the **+** icon, to select either a single repository, or all repositories in an organization.
63-
- Click **LIST-NAME** to select a custom list that you have created previously.
64-
- Click **Add new list**, the folder icon, to create a custom list (see later in this article for details).
65-
56+
- Click **Top X repositories** to select this list of public repositories for analysis.
57+
- Click **LIST-NAME** to select a custom list for analysis (see :ref:`later in this article <custom-lists>` for details).
58+
- Click **Add new database**, the **+** icon, to add a repository or an organization to the panel, then click to select it for analysis.
6659
.. image:: ../images/codeql-for-visual-studio-code/variant-analysis-repo-lists.png
6760
:width: 350
68-
:alt: Screenshot of the CodeQL extension in Visual Studio Code. The "Variant Analysis Repositories" section is expanded and the header buttons are highlighted with a dark orange outline. The "Top 10 repositories" item has a checkmark to show that it is currently selected.
61+
:alt: Screenshot of the CodeQL extension in Visual Studio Code. The "Variant Analysis Repositories" section is expanded. The "Top 10 repositories" item has a checkmark to show that it is currently selected. Examples of a custom list, "example-list", a full organization, "octo-org", and a single repository, "octo-org/octo-repo", are shown in the list of repositories available for variant analysis.
6962

7063
#. Open the query you want to run, right-click in the query file, and select **CodeQL: Run Variant Analysis** to start variant analysis.
7164

72-
The CodeQL extension builds a CodeQL pack with your library and any library dependencies. The CodeQL pack and your selected repository list are posted to an API endpoint on GitHub.com which triggers a GitHub Actions dynamic workflow in your controller repository. The workflow spins up multiple parallel jobs to execute the CodeQL query against the repositories in the list, optimizing query execution. As each repository is analyzed, the results are processed and displayed in a variant analysis results view in Visual Studio Code.
65+
The CodeQL extension builds a CodeQL pack with your library and any library dependencies. The CodeQL pack and your selected repository list are posted to an API endpoint on GitHub.com which triggers a GitHub Actions dynamic workflow in your controller repository. The workflow spins up multiple parallel jobs to execute the CodeQL query against the repositories in the list, optimizing query execution. As each repository is analyzed, the results are processed and displayed in a Variant Analysis Results view in Visual Studio Code.
7366

7467
.. pull-quote::
7568

@@ -93,7 +86,7 @@ For each repository, you can see:
9386
- Visibility of the repository
9487
- Whether analysis is still running (black, moving circle) or finished (green checkmark)
9588
- Number of stars the repository has on GitHub
96-
- How long ago the CodeQL database that was analyzed was created
89+
- When the repository was last updated
9790

9891
To see the results for a repository:
9992

@@ -107,23 +100,25 @@ To see the results for a repository:
107100
Exporting your results
108101
----------------------
109102

110-
You can export your results for further analysis or to discuss them with collaborators. In the results view, click **Export results** to export the results to a secret gist on GitHub.com or to a markdown file.
103+
You can export your results for further analysis or to discuss them with collaborators. In the results view, click **Export results** to export the results to a secret gist on GitHub.com or to a markdown file in your workspace.
104+
105+
.. _custom-lists:
111106

112107
Creating custom lists of repositories
113-
---------------------------------------
108+
-------------------------------------
114109

115-
After you have defined a controller repository, the Variant analysis repositories panel shows the lists of repositories that you can select for variant analysis. You can use the options in the panel header to select a specific repository or organization for variant analysis, and to create and manage custom lists of repositories for variant analysis.
110+
After you have defined a controller repository, the Variant Analysis Repositories panel shows the lists of repositories that you can select for variant analysis. You can use the options in the panel header to add a specific repository or organization to the panel, and to create and manage custom lists of repositories for variant analysis.
116111

117112
.. pull-quote::
118113

119114
Note
120115

121-
CodeQL analysis always requires a CodeQL database to run queries against. When you run variant analysis against a list of repositories, your query will only be executed against the repositories that currently have a CodeQL database available to download. So the best way to make a repository available for variant analysis is to enable code scanning with CodeQL.
116+
CodeQL analysis always requires a CodeQL database to run queries against. When you run variant analysis against a list of repositories, your query will only be executed against the repositories that currently have a CodeQL database available to download. So the best way to make a repository available for variant analysis is to enable code scanning with CodeQL. For information about enabling code scanning using CodeQL, see "`Configuring code scanning automatically <https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning-for-a-repository#configuring-code-scanning-automatically>`__."
122117

123118
Selecting a single GitHub repository or organization for analysis
124119
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
125120

126-
#. In the Variant analysis repositories panel, click the **+**, add new database, icon.
121+
#. In the Variant Analysis Repositories panel, click the **+**, add new database, icon.
127122

128123
#. From the dropdown menu, click **From a GitHub repository** or **All repositories of GitHub org or owner**.
129124

@@ -136,17 +131,17 @@ Selecting a single GitHub repository or organization for analysis
136131
Creating a custom list of repositories
137132
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
138133

139-
#. In the Variant analysis repositories panel, click the |add-list| icon.
134+
#. In the Variant Analysis Repositories panel, click the |add-list| icon.
140135

141136
#. Type a name for the new list and press **Enter**.
142137

143138
#. Select your list in the panel and then click **+**, to add a repository to your list.
144139

145140
You can manage and edit your custom lists by right-clicking on either the list name, or a repository name within the list, and selecting an option from the context menu.
146141

147-
The custom lists are stored in your workspace in a ``databases.json`` file. If you want to edit this file directly, you can open by clicking **{ }** in the panel header.
142+
The custom lists are stored in your workspace in a ``databases.json`` file. If you want to edit this file directly, you can open it by clicking **{ }** in the panel header.
148143

149-
For example, if you want to continue analyzing a set of repositories that had results for your query, click **Copy repository list** in the Variant analysis results view to add a list of the repositories that have results for your query to the clipboard as JSON. For example:
144+
For example, if you want to continue analyzing a set of repositories that had results for your query, click **Copy repository list** in the Variant Analysis Results view to add a list of only the repositories that have results to the clipboard as JSON. For example:
150145

151146
.. code-block:: json
152147
@@ -157,7 +152,7 @@ For example, if you want to continue analyzing a set of repositories that had re
157152
]
158153
}
159154
160-
You can then insert the ``new-repo-list`` of repositories into your list of custom repository lists for easy access in the Variant analysis repositories panel.
155+
You can then insert the ``new-repo-list`` of repositories into your list of custom repository lists for easy access in the Variant Analysis Repositories panel.
161156

162157
Troubleshooting variant analysis
163158
--------------------------------
4.09 KB
Loading

0 commit comments

Comments
 (0)