Skip to content

Commit fc86347

Browse files
committed
Add section about using the API to download dbs
1 parent faf1d0a commit fc86347

File tree

5 files changed

+20
-42
lines changed

5 files changed

+20
-42
lines changed

docs/codeql/codeql-cli/creating-codeql-databases.rst

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -379,17 +379,15 @@ The following example shows how you could use indirect build tracing in an Azure
379379
# `codeql database analyze`
380380
# then `codeql github upload-results` ...
381381

382-
Obtaining databases from LGTM.com
383-
---------------------------------
384-
385-
`LGTM.com <https://lgtm.com>`__ analyzes thousands of open-source projects using
386-
CodeQL. For each project on LGTM.com, you can download an archived CodeQL
387-
database corresponding to the most recently analyzed revision of the code. These
388-
databases can also be analyzed using the CodeQL CLI or used with the CodeQL
389-
extension for Visual Studio Code.
390-
391-
.. include:: ../reusables/download-lgtm-database.rst
392-
382+
Obtaining databases from GitHub.com
383+
-----------------------------------
384+
385+
.. include:: ../reusables/download-github-database.rst
386+
387+
Before running an analysis, unzip the databases and try :doc:`upgrading <upgrading-codeql-databases>` the
388+
unzipped databases to ensure they are compatible with your local copy of the
389+
CodeQL queries and libraries.
390+
393391
.. pull-quote::
394392

395393
Note

docs/codeql/codeql-cli/getting-started-with-the-codeql-cli.rst

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,9 @@ Conditions <https://securitylab.github.com/tools/codeql/license>`__.
4747

4848
.. pull-quote:: Important
4949

50-
There are different versions of the CLI available to download, depending
51-
on your use case:
52-
53-
- If you want to use the most up to date CodeQL tools and features, download the
54-
version tagged ``latest``.
55-
56-
- If you want to create CodeQL databases to upload to LGTM Enterprise, download
57-
the version that is compatible with the relevant LGTM Enterprise version
58-
number. Compatibility information is included in the description for each
59-
release on the `CodeQL CLI releases page
60-
<https://github.com/github/codeql-cli-binaries/releases>`__ on GitHub. Using the
61-
correct version of the CLI ensures that your CodeQL databases are
62-
compatible with your version of LGTM Enterprise. For more information,
63-
see `Preparing CodeQL databases to upload to LGTM
64-
<https://help.semmle.com/lgtm-enterprise/admin/help/prepare-database-upload.html>`__
65-
in the LGTM admin help.
50+
There are several different versions of the CLI available to download, depending
51+
on your use case. If you want to use the most up to date CodeQL tools and features, download the
52+
version tagged ``latest``.
6653

6754
If you use Linux, Windows, or macOS version 10.14 ("Mojave") or earlier, simply
6855
`download the zip archive
@@ -232,15 +219,7 @@ see ":doc:`About CodeQL packs <about-codeql-packs>`."
232219
- For the most up to date CodeQL queries, check out the ``main`` branch.
233220
This branch represents the very latest version of CodeQL's analysis.
234221

235-
- For the queries used in a particular LGTM Enterprise release, check out the
236-
branch tagged with the relevant release number. For example, the branch
237-
tagged ``v1.27.0`` corresponds to LGTM Enterprise 1.27. You must use this
238-
version if you want to upload data to LGTM Enterprise. For further
239-
information, see `Preparing CodeQL databases to upload to LGTM
240-
<https://help.semmle.com/lgtm-enterprise/admin/help/prepare-database-upload.html>`__
241-
in the LGTM admin help.
242-
243-
1. Extract the zip archive
222+
4. Extract the zip archive
244223
~~~~~~~~~~~~~~~~~~~~~~~~~~
245224

246225
For Linux, Windows, and macOS users (version 10.14 "Mojave", and earlier)

docs/codeql/codeql-for-visual-studio-code/analyzing-your-projects.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ If you have a CodeQL database saved locally, as an unarchived folder or as a ZIP
3737

3838
For more information about running query tests, see ":ref:`Testing custom queries <testing-custom-queries>`" in the CodeQL CLI help.
3939

40+
.. include:: ../reusables/download-github-database.rst
41+
4042
Running a query
4143
------------------------
4244

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
GitHub also stores CodeQL databases for over 200,000 repos on GitHub.com, which you can download using the API. The list of repos is constantly growing and evolving to make sure that it includes the most interesting codebases for security research.
2+
3+
To download a database from GitHub.com using the `GitHub CLI <https://cli.github.com/manual/gh_api>`__, use the following command::
4+
5+
gh api /repos/<owner>/<repo>/code-scanning/codeql/databases/<language> -H 'Accept: application/zip' > path/to/local/database.zip

docs/codeql/reusables/download-lgtm-database.rst

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)