OpenSCA is an open source software supply chain security solution that supports the detection of open source dependencies, vulnerabilities and license complianc
OpenSCA is an open source software supply chain security solution that supports the detection of open source dependencies, vulnerabilities and license complianc
English|中文
OpenSCA is intended for scanning third-party dependencies, vulnerabilities and licenses.
Our website: https://opensca.xmirror.cn
Click STAR to leave encouragement.
OpenSCA is now capable of parsing configuration files in the listed programming languages and correspondent package managers. The team is now dedicated to introducing more languages and enriching the parsing of relevant configuration files gradually.
| LANGUAGE | PACKAGE MANAGER | FILE |
|---|---|---|
Java |
Maven |
pom.xml |
Java |
Gradle |
.gradle .gradle.kts |
JavaScript |
Npm |
package-lock.json package.json yarn.lock |
PHP |
Composer |
composer.json composer.lock |
Ruby |
gem |
gemfile.lock |
Golang |
gomod |
go.mod go.sum Gopkg.toml Gopkg.lock |
Rust |
cargo |
Cargo.lock |
Erlang |
Rebar |
rebar.lock |
Python |
Pip |
Pipfile Pipfile.lock setup.py requirements.txt requirements.in(For the latter two, pipenv environment & internet connection are needed) |
OpenSCA-cli is available for Windows, Linux and MacOS. The installation method is as follows:
opensca-cli directly.curl -sSL https://raw.githubusercontent.com/XmirrorSecurity/OpenSCA-cli/master/scripts/install.sh | sh
# Try this when internet connection fails
curl -sSL https://gitee.com/XmirrorSecurity/OpenSCA-cli/raw/master/scripts/install.sh | sh -s -- giteeiex "&{$(irm https://raw.githubusercontent.com/XmirrorSecurity/OpenSCA-cli/master/scripts/install.ps1)}"
# Try this when internet connection fails
iex "&{$(irm https://gitee.com/XmirrorSecurity/OpenSCA-cli/raw/master/scripts/install.ps1)} gitee"brew install opensca-cliClone the source code and compile (go 1.18 and above is needed)
# github linux/mac
git clone https://github.com/XmirrorSecurity/OpenSCA-cli.git opensca && cd opensca && go build
# gitee linux/mac
git clone https://gitee.com/XmirrorSecurity/OpenSCA-cli.git opensca && cd opensca && go build
# github windows
git clone https://github.com/XmirrorSecurity/OpenSCA-cli.git opensca ; cd opensca ; go build
# gitee windows
git clone https://gitee.com/XmirrorSecurity/OpenSCA-cli.git opensca ; cd opensca ; go buildThe default option is to generate the program of the current system architecture. If you want to try it for other system architectures, you can set the following environment variables before compiling.
CGO_ENABLED CGO_ENABLED=0GOOS=${OS} \\ darwin,liunx,windowsGOARCH=${arch} \\ amd64,arm64| PARAMETER | TYPE | Descripation | SAMPLE |
|---|---|---|---|
config |
string |
Set the path of the configuration file | -config config.json |
path |
string |
Set the path of the target file or directory | -path ./foo |
out |
string |
Save the result to the specified file whose format is defined by the suffix | -out out.json, out.html |
log |
string |
Specify the path of log file | -log my_log.txt |
token |
string |
Cloud service verification from our offical website | -token xxx |
proj |
string |
SaaS project token to sync report with OpenSCA SaaS |
-proj xxx |
From v3.0.0, apart from these parameters available for CMD/CRT, there are also others for different requirements which have to be set in the configuration file.
Full introduction about each parameters can be found in config.json
v3.0.2 and above allows OpenSCA-cli to snyc reports with OpenSCA SaaS (via proj), so that all reports of multiple projects can be managed together.
If the configuration parameter conflicts with the command-line input parameter, the latter will be taken.
When there's no configuration file in the set path, one in default settings will be generated there.
If no path of configuration file is set, the following ones will be checked:
config.json under the working directoryopensca_config.json under the user directoryconfig.json under opensca-cli directoryUse optional.ignore in the configuration file to skip files or directories during scanning. OpenSCA only reads ignore rules from the current configuration file and does not automatically load the project's .gitignore. The rules are compatible with common .gitignore syntax, including directory matches, wildcards, and ! negation.
{
"optional": {
"ignore": [
"JarCollection/",
"*.jar",
"!libs/keep.jar"
]
}
}From v3.0.0, url has been put in the configuration file. The default set goes to our cloud vulnerability database. Other online database in accordance with our database structure can also be set through configuration file.
Using previous versions to connect the cloud databse will still need the setting of url, which could be done via both CMD and configuration file. Example: -url https://opensca.xmirror.cn
Files supported by the out parameter are listed below:
| TYPE | FORMAT | SPECIFIED SUFFIX | VERSION |
|---|---|---|---|
| REPORT | json |
.json |
* |
xml |
.xml |
* |
|
html |
.html |
v1.0.6 and above |
|
sqlite |
.sqlite |
v1.0.13 and above |
|
csv |
.csv |
v1.0.13 and above |
|
sarif |
.sarif |
||
| SBOM | spdx |
.spdx .spdx.json .spdx.xml |
v1.0.8 and above |
cdx |
.cdx.json .cdx.xml |
v1.0.11and above |
|
swid |
.swid.json .swid.xml |
v1.0.11and above |
|
dsdx |
.dsdx .dsdx.json .dsdx.xml |
v3.0.0and above |
|
bomsw |
.bomsw.json |
v3.0.8and above |
# Use opensca-cli to scan with CMD parameters:
opensca-cli -path ${project_path} -config ${config_path} -out ${filename}.${suffix} -token ${token}
# Start scanning after setting down the configuration file:
opensca-cli# Detect dependencies in the current directory:
docker run -ti --rm -v ${PWD}:/src opensca/opensca-cli
# Connect to the cloud vulnerability database:
docker run -ti --rm -v ${PWD}:/src opensca/opensca-cli -token ${put_your_token_here}You can also use the configuration file for advanced settings. Save config.json to the mounted directory of src or set other paths within the container through -config. The writing method for mounting the current directory on different terminals varies, we list common ones here FYI:
| terminal | pwd |
|---|---|
bash |
$(pwd) |
zsh |
${PWD} |
cmd |
%cd% |
powershell |
(Get-Location).Path |
For more information, visit Docker Hub Page
…| FIELD | Descripation | REQUIRED OR NOT |
|---|---|---|
vendor |
the manufacturer of the component | N |
product |
the name of the component | Y |
version |
the versions of the component affected by the vulnerability |
No open issues yet, or sync has not completed.