![]() |
坚强的柿子 · ckeditor图片上传及预览展示问题解决_ ...· 1 年前 · |
![]() |
含蓄的汉堡包 · SQL优化实战:如何通过缓存给MySQL查询 ...· 1 年前 · |
![]() |
个性的啄木鸟 · Windows进程通信之共享内存通信_win ...· 1 年前 · |
![]() |
孤独的脆皮肠 · 在IE11中使用`window.locati ...· 1 年前 · |
![]() |
八块腹肌的柑橘 · 聚类及可视化 - 知乎· 1 年前 · |
gemnasium_db
advisory database
Error response from daemon: error processing tar file: docker-tar: relocation error
gl-dependency-scanning-report.json: no matching files
dependency_scanning is used for configuration only, and its script should not be executed
strconv.ParseUint: parsing "0.0": invalid syntax
<file> does not exist in <commit SHA>
DS_MAJOR_VERSION
or
DS_ANALYZER_IMAGE
use_2to3 is invalid
error
pg_config executable not found
error
NoSuchOptionException
when using
poetry config http-basic
with
CI_JOB_TOKEN
<number>
unresolved dependencies
If you’re using GitLab CI/CD , you can use dependency scanning to analyze your dependencies for known vulnerabilities. GitLab scans all dependencies, including transitive dependencies (also known as nested dependencies). You can take advantage of dependency scanning by either:
.gitlab-ci.yml
file.
GitLab checks the dependency scanning report, compares the found vulnerabilities between the source and target branches, and shows the information on the merge request. The results are sorted by the severity of the vulnerability.
For an overview, see Dependency Scanning .
CS_DISABLE_LANGUAGE_VULNERABILITY_SCAN
variable
.
CS_DISABLE_LANGUAGE_VULNERABILITY_SCAN
variable
.
Turning this variable on can result in some duplicate findings, as we do not yet
de-duplicate results between Container Scanning and Dependency Scanning. For more details,
efforts to de-duplicate these findings can be tracked in
this epic
.
The following table summarizes which types of dependencies each scanning tool can detect:
Feature | Dependency Scanning | Container Scanning | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Identify the manifest, lock file, or static file that introduced the dependency | |||||||||||
Development dependencies | |||||||||||
Dependencies in a lock file committed to your repository | 1 | Binaries built by Go | 2 3 | Dynamically-linked language-specific dependencies installed by the Operating System | 3 | Operating system dependencies | |||||
Language-specific dependencies installed on the operating system (not built by your project) |
To run dependency scanning jobs, by default, you need GitLab Runner with the
docker
or
kubernetes
executor.
If you’re using the shared runners on GitLab.com, this is enabled by default. The analyzer images
provided are for the Linux/amd64 architecture.
19.03.0
. See
troubleshooting information
for details.
The language detection relies on CI job
rules
and searches a
maximum of two directory levels from the repository’s root. For example, the
gemnasium-dependency_scanning
job is enabled if a repository contains either
Gemfile
,
api/Gemfile
, or
api/client/Gemfile
, but not if the only supported dependency file is
api/v1/client/Gemfile
.
For Java and Python, when a supported dependency file is detected, Dependency Scanning attempts to build the project and execute some Java or Python commands to get the list of dependencies. For all other projects, the lock file is parsed to obtain the list of dependencies without needing to build the project first.
When a supported dependency file is detected, all dependencies, including transitive dependencies are analyzed. There is no limit to the depth of nested or transitive dependencies that are analyzed.
The following languages and dependency managers are supported:
pnpm 4
requirements.txt
requirements.pip
requires.txt
Language | Language Versions | Package Manager | Supported files | Processes multiple files? |
---|---|---|---|---|
.NET | All versions | NuGet |
packages.lock.json
|
Y |
C | All versions | Conan |
conan.lock
|
Y |
Go | All versions | Go |
go.mod
go.sum
|
Y |
Java and Kotlin (not Android)
1
8 LTS,
11 LTS,
13
2
,
14
2
,
15
2
,
16
2
,
or 17 LTS
Gradle
3
build.gradle
build.gradle.kts
|
N | |||
Maven |
pom.xml
|
N | ||
JavaScript and TypeScript | All versions | npm |
package-lock.json
npm-shrinkwrap.json
|
Y |
yarn |
yarn.lock
|
Y | ||
pnpm-lock.yaml
|
Y | |||
PHP | All versions | Composer |
composer.lock
|
Y |
Python | 3.9 | setuptools |
setup.py
|
N |
N | ||||
Pipenv |
Pipfile
Pipfile.lock
5
Poetry
6
|
poetry.lock
|
N | |
Ruby | All versions | Bundler |
Gemfile.lock
gems.locked
|
Y |
Scala | All versions | sbt 7 |
build.sbt
|
N |
gemnasium-maven
. Official support is limited to LTS versions only. Although it may be possible to use Dependency Scanning with other versions by building a custom dependency scanning image, this approach is not officially supported by GitLab.
Gradle is not supported when
FIPS mode
is enabled.
Support for
pnpm
lockfiles was
introduced in GitLab 15.11
.
pnpm
lockfiles do not store bundled dependencies, so the reported dependencies may differ from
npm
or
yarn
.
The presence of a
Pipfile.lock
file alone will
not
trigger the analyzer; the presence of a
Pipfile
is
still required in order for the analyzer to be executed. However, if a
Pipfile.lock
file is found, it is used by
Gemnasium
to scan the exact package versions listed in this file.
Support for
Pipfile.lock
files without requiring the presence of a
Pipfile
is tracked in
issue:
Dependency Scanning of Pipfile.lock without
installing project dependencies
.
Support for
Poetry
projects with a
poetry.lock
file was
added in GitLab 15.0
.
Support for projects without a
poetry.lock
file is tracked in issue:
Poetry's pyproject.toml support for dependency scanning.
Support for
sbt
1.3 and above was added in GitLab 13.9.
GitLab analyzers obtain dependency information using one of the following two methods:
The following package managers use lockfiles that GitLab analyzers are capable of parsing directly:
Package Manager | Supported File Format Versions | Tested Versions | |||||||
---|---|---|---|---|---|---|---|---|---|
Bundler | Not applicable | 1.17.3 , 2.1.4 | Composer | Not applicable | 1.x | ||||
Conan | 0.4 | 1.x | |||||||
Go | Not applicable | 1.x 1 | NuGet | v1 | 4.9 | ||||
npm | v1, v2, v3 2 6.x , 7.x , 9.x | pnpm | v5.3, v5.4, v6 | 7.x , 8.x | yarn | v1, v2 3 , v3 3 1.x , 2.x , 3.x | Poetry | v1 | 1.x |
go.sum
if it's unable to generate the build list
used by the Go project.
Support for
lockfileVersion = 3
was
introduced
in GitLab 15.7.
Support for Yarn
v2
and
v3
was
introduced in GitLab 15.11
. However, this feature is also available to versions of GitLab 15.0 and later.
The following features are not supported for Yarn
v2
or
v3
:
workspaces
yarn patch
Yarn files that contain a patch, a workspace, or both, are still processed, but these features are ignored.
To support the following package managers, the GitLab analyzers proceed in two steps:
Package Manager | Pre-installed Versions | Tested Versions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sbt | 1.6.1 | 1.0.4 , 1.1.6 , 1.2.8 , 1.3.12 , 1.4.6 , 1.5.8 , 1.6.1 | Maven | 3.6.3 | 3.6.3 1 | Gradle | 6.7.1 2 , 7.3.3 2 5.6.4 , 6.7 , 6.9 , 7.3 | setuptools | 58.1.0 | >= 65.6.3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
pip | 22.0.4 | 20.x | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Pipenv | 2022.1.8 | 2022.1.8 3 , 2022.1.8 | Go | 1.18 |
1.18
4
Different versions of Java require different versions of Gradle. The versions of Gradle listed in the above table are pre-installed
in the analyzer image. The version of Gradle used by the analyzer depends on whether your project uses a
gradlew
(Gradle wrapper) file or not:
If your project
does not use
a
gradlew
file, then the analyzer automatically switches to one of the
pre-installed Gradle versions, based on the version of Java specified by the
DS_JAVA_VERSION
variable.
By default, the analyzer uses Java 17 and Gradle 7.3.3.
For Java versions
8
and
11
, Gradle
6.7.1
is automatically selected, and for Java versions
13
to
17
, Gradle
7.3.3
is automatically selected.
If your project
does use
a
gradlew
file, then the version of Gradle pre-installed in the analyzer image is
ignored, and the version specified in your
gradlew
file is used instead.
This test confirms that if a
Pipfile.lock
file is found, it is used by
Gemnasium
to scan the exact package versions listed in this file.
Because of the implementation of
go build
, the Go build process requires network access, a pre-loaded mod cache via
go mod download
, or vendored dependencies. For more information,
refer to the Go documentation on
compiling packages and dependencies
.
How analyzers are triggered
GitLab relies on
The current detection logic limits the maximum search depth to two levels. For example, the
When a supported dependency file is detected, all dependencies, including transitive dependencies are analyzed. There is no limit to the depth of nested or transitive dependencies that are analyzed. How multiple files are processedPythonJava and Scala
pom.xml
for single or
multi-module
Maven projects.
The search begins with the root directory and then continues with subdirectories if no builds are found in the root directory. Consequently an sbt build file in the root directory would be detected before a Gradle build file in a subdirectory. JavaScript
Supports multiple lockfiles
From GitLab 14.8 the
Go
Multiple files are supported. When a
PHP, C, C++, .NET, C#, Ruby, JavaScriptThe analyzer for these languages supports multiple lockfiles. Support for additional languages
Contribute your scannerThe Security Scanner Integration documentation explains how to integrate other security scanners into GitLab. Configuration
To enable dependency scanning for GitLab 11.9 and later, you must
include
the
Add the following to your
The included template creates dependency scanning jobs in your CI/CD pipeline and scans your project’s source code for possible vulnerabilities. The results are saved as a dependency scanning report artifact that you can later download and analyze. Due to implementation limitations, we always take the latest dependency scanning artifact available. Enable Dependency Scanning via an automatic merge request
Version history
Introduced
in GitLab 14.1
with a flag
named
sec_dependency_scanning_ui_enable
. Enabled by default.
sec_dependency_scanning_ui_enable
removed
in GitLab 14.2.
To enable Dependency Scanning in a project, you can create a merge request:
Pipelines now include a dependency scanning job. Customizing the dependency scanning settings
The Dependency Scanning settings can be changed through
CI/CD variables
by using the
Because template is evaluated before the pipeline configuration, the last mention of the variable takes precedence.
Overriding dependency scanning jobs
Beginning in GitLab 13.0, the use of
only
and
except
is no longer supported. When overriding the template, you must use
rules
instead.
To override a job definition (for example, to change properties like
To override the
Available CI/CD variablesDependency scanning can be configured using environment variables.
All customization of GitLab security scanning tools should be tested in a merge request before
merging these changes to the default branch. Failure to do so can give unexpected results,
including a large number of false positives.
Configuring dependency scanningThe following variables allow configuration of global dependency scanning settings.
Configuring specific analyzers used by dependency scanning
Other variables
For example, to pass the non-GitLab environment variable
Alternatively we may use it in specific jobs, like Dependency Scanning:
As we have not tested all variables you may find some do work and others do not. If one does not work and you need it we suggest submitting a feature request or contributing to the code to enable it to be used. Using a custom SSL CA certificate authority
You can use the
The
Using private Maven repositoriesRead more on how to use private Maven repositories . FIPS-enabled imagesIntroduced in GitLab 14.10. GitLab also offers FIPS-enabled Red Hat UBI versions of the Gemnasium images. You can therefore replace standard images with FIPS-enabled images. Gemnasium scanning jobs automatically use FIPS-enabled image when FIPS mode is enabled in the GitLab instance. ( Introduced in GitLab 15.0.)
To manually switch to FIPS-enabled images, set the variable
To ensure compliance with FIPS, the FIPS-enabled image of
Dependency scanning for Gradle projects and auto-remediation for Yarn projects are not supported in FIPS mode. Interacting with the vulnerabilitiesOnce a vulnerability is found, you can interact with it. Read more on how to address the vulnerabilities . Solutions for vulnerabilitiesSome vulnerabilities can be fixed by applying the solution that GitLab automatically generates. Read more about the solutions for vulnerabilities . Security DashboardThe Security Dashboard is a good place to get an overview of all the security vulnerabilities in your groups, projects and pipelines. Read more about the Security Dashboard . Vulnerabilities database updateFor more information about the vulnerabilities database update, see the maintenance table . Dependency ListAn additional benefit of dependency scanning is the ability to view your project’s dependencies and their known vulnerabilities. Read more about the Dependency List . Reports JSON formatThe dependency scanning tool emits a JSON report file. For more information, see the schema for this report . Here’s an example dependency scanning report:
CycloneDX Software Bill of Materials
In addition to the
JSON report file
, the
Gemnasium
Dependency Scanning tool outputs a
CycloneDX
Software Bill of Materials (SBOM) for
each supported lock or build file it detects. These CycloneDX SBOMs are named
For example, if your project has the following structure:
Then the Gemnasium scanner generates the following CycloneDX SBOMs:
You can download CycloneDX SBOMs the same way as other job artifacts . Merging multiple CycloneDX SBOMsYou can use a CI/CD job to merge multiple CycloneDX SBOMs into a single SBOM. For example: GitLab uses CycloneDX Properties to store implementation-specific details in the metadata of each CycloneDX SBOM, such as the location of build and lock files. If multiple CycloneDX SBOMs are merged together, this information is removed from the resulting merged file. Versioning and release processCheck the Release Process documentation . Contributing to the vulnerability database
To find a vulnerability, you can search the
Running dependency scanning in an offline environmentFor self-managed GitLab instances in an environment with limited, restricted, or intermittent access to external resources through the internet, some adjustments are required for dependency scanning jobs to run successfully. For more information, see Offline environments . Requirements for offline dependency scanningHere are the requirements for using dependency scanning in an offline environment:
GitLab Runner has a
default
Make GitLab dependency scanning analyzer images available inside your Docker registry
For dependency scanning with all
supported languages and frameworks
,
import the following default dependency scanning analyzer images from
The process for importing Docker images into a local offline Docker registry depends on your network security policy . Consult your IT staff to find an accepted and approved process by which external resources can be imported or temporarily accessed. These scanners are periodically updated with new definitions, and you may be able to make occasional updates on your own.
For details on saving and transporting Docker images as a file, see the Docker documentation on
Support for Custom Certificate AuthoritiesSupport for custom certificate authorities was introduced in the following versions.
Set dependency scanning CI/CD job variables to use local dependency scanning analyzers
Add the following configuration to your
See explanations of the variables above in the configuration section . Specific settings for languages and package managersSee the following sections for configuring specific languages and package managers. JavaScript (npm and yarn) projects
Add the following to the variables section of
Ruby (gem) projects
Add the following to the variables section of
Python (pip)Python (setuptools)
Hosting a copy of the
Host a copy of the advisory database
Use a local clone
Warnings
Python projects
Troubleshooting
Increase log verbosity
Working around missing support for certain languages or package managers
|
![]() |
八块腹肌的柑橘 · 聚类及可视化 - 知乎 1 年前 |