CodeQL databases or logs produced by the CodeQL CLI may, in some circumstances, contain the environment variables from the time of database creation, including any secrets that were exposed as environment variables to the process. Users with access to these artifacts would be able to access these secrets.
For Kotlin, the complete environment is logged by default when the --keep-trap
option is passed to the CodeQL CLI or CodeQL database creation fails to complete before finalization.
For Java, C/C++, and Swift, the complete environment is only logged when specific environment variables are set. These are not enabled by default or in debug mode on the CodeQL Action, and so impact is limited to advanced users manually enabling these options via the CLI.
This could be dangerous if you are storing secrets in environment variables and you are subsequently persisting the database or logs. In this case, you would be saving secrets to disk.
Impact detailsThe vulnerability only manifests under the following circumstances:
Kotlinjava
, kotlin
, or java-kotlin
), running in a repository containing Kotlin source code.--keep-trap
option is passed to the CodeQL CLI OR CodeQL database creation fails to complete before finalization.In CodeQL CLI versions >= 2.9.2 and <= 2.20.2, the CodeQL Kotlin extractor logs all environment variables into an intermediate file during the process of creating a CodeQL database for Kotlin code.
The intermediate file containing environment variables is deleted by default when finalizing the Kotlin database, so it is not included in a successfully created database.
However, a database that has not been finalized (for example, due to errors during database creation) will leave the intermediate files containing logged environment variables in the unfinalized database. Similarly, if the --keep-trap
option is set during database creation, the intermediate files will not be deleted when the database is finalized.
java
, kotlin
, or java-kotlin
), running in a repository containing Java or Kotlin source code.ODASA_JAVAC_VERBOSE
is set to 1 or higher. This is not enabled by default or in debug mode on the CodeQL Action, and so impact is limited to advanced users manually enabling this option via the CLI. Without this setting, by default, only a limited subset of environment variables are logged: PATH
, PWD
, and variables with the prefixes ODASA_
, SEMMLE_
, JAVA_
, or CODEQL_
.c
, cpp
, or c-cpp
), running in a repository containing C/C++ source code.cpp.log_verbosity
, the environment variable CODEQL_EXTRACTOR_CPP_OPTION_LOG_VERBOSITY
, or the direct extractor command-line flag --codeql-verbosity
are set to 3. This is not enabled by default or in debug mode on the CodeQL Action, and so impact is limited to advanced users manually enabling this option via the CLI.swift
), running in a repository containing Swift source code.CODEQL_EXTRACTOR_SWIFT_LOG_LEVELS
is set to out:text:trace
or out:text:debug
. This is not enabled by default or in debug mode on the CodeQL Action, and so impact is limited to advanced users manually enabling this option via the CLI.Update to CodeQL CLI version 2.20.3 or later.
While using CodeQL CLI <= 2.20.2, avoid uploading, archiving, or saving unfinalized CodeQL databases from Kotlin analysis to persistent storage. These should be considered sensitive information and should be purged as soon as the CodeQL job, workflow, pipeline, or script is finished. If you have saved these unfinalized databases, rotate any secrets that were present in the environment when the databases were created.
PatchesThis vulnerability will be fixed in CodeQL CLI version 2.20.3, in which database creation no longer logs the complete environment by default for any language.
PATH
, PWD
, and internal variables with the prefixes ODASA_
, SEMMLE_
, JAVA_
, or CODEQL_
. Logging of the complete environment is disabled by default, and enabled only when the environment variable CODEQL_EXTRACTOR_JAVA_OPTION_LOG_FULL_ENVIRONMENT
is set to true
.CODEQL_EXTRACTOR_SWIFT_LOG_LEVELS
is set to out:text:trace
or out:text:debug
, only environment variables starting with CODEQL_
and SEMMLE_
are logged.RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4