Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

OpenSCA is an open source software supply chain security solution that supports the detection of open source dependencies, vulnerabilities and license compliance with a widely noticed accuracy by the community.

License

NotificationsYou must be signed in to change notification settings

XmirrorSecurity/OpenSCA-cli

logo

Manage Open Source Risks via Open Source Solution

ReleaseJetbrains PluginVSCode PluginLICENSEGitHub all releasesDocker Pulls

English|中文

Introduction

OpenSCA is intended for scanning third-party dependencies, vulnerabilities and licenses.

Our website:https://opensca.xmirror.cn

ClickSTAR to leave encouragement.


Detection Ability

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.

LANGUAGEPACKAGE MANAGERFILE
JavaMavenpom.xml
JavaGradle.gradle.gradle.kts
JavaScriptNpmpackage-lock.jsonpackage.jsonyarn.lock
PHPComposercomposer.jsoncomposer.lock
Rubygemgemfile.lock
Golanggomodgo.modgo.sumGopkg.tomlGopkg.lock
RustcargoCargo.lock
ErlangRebarrebar.lock
PythonPipPipfilePipfile.locksetup.pyrequirements.txtrequirements.in(For the latter two, pipenv environment & internet connection are needed)

Download & Deployment

  1. Download the appropriate executable file according to your system architecture fromreleases.

  2. Or download the source code and compile (go 1.18 and above is needed)

    // github linux/macgit clone https://github.com/XmirrorSecurity/OpenSCA-cli.git opensca&&cd opensca&& go build// gitee linux/macgit clone https://gitee.com/XmirrorSecurity/OpenSCA-cli.git opensca&&cd opensca&& go build// github windowsgit clone https://github.com/XmirrorSecurity/OpenSCA-cli.git opensca;cd opensca; go build// gitee windowsgit clone https://gitee.com/XmirrorSecurity/OpenSCA-cli.git opensca;cd opensca; go build

    The 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.

    • DisableCGO_ENABLEDCGO_ENABLED=0
    • Set the operating systemGOOS=${OS} \\ darwin,liunx,windows
    • Set the architectureGOARCH=${arch} \\ amd64,arm64

Use OpenSCA

Parameters

PARAMETERTYPEDescripationSAMPLE
configstringSet the path of the configuration file-config config.json
pathstringSet the path of the target file or directory-path ./foo
outstringSave the result to the specified file whose format is defined by the suffix-out out.json, out.html
logstringSpecify the path of log file-log my_log.txt
tokenstringCloud service verification from our offical website-token xxx
projstringSaaS projecttoken to sync report withOpenSCA 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 inconfig.json

v3.0.2 and above allows OpenSCA-cli to snyc reports with OpenSCA SaaS (viaproj), 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:

  1. config.json under the working directory
  2. opensca_config.json under the user directory
  3. config.json underopensca-cli directory

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 ofurl, which could be done via both CMD and configuration file. Example:-url https://opensca.xmirror.cn

Report Formats

Files supported by theout parameter are listed below:

TYPEFORMATSPECIFIED SUFFIXVERSION
REPORTjson.json*
xml.xml*
html.htmlv1.0.6 and above
sqlite.sqlitev1.0.13 and above
csv.csvv1.0.13 and above
sarif.sarif
SBOMspdx.spdx.spdx.json.spdx.xmlv1.0.8 and above
cdx.cdx.json.cdx.xmlv1.0.11and above
swid.swid.json.swid.xmlv1.0.11and above
dsdx.dsdx.dsdx.json.dsdx.xmlv3.0.0and above

Sample

# 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

Scan & Report via Docker Container

# 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. Saveconfig.json to the mounted directory ofsrc 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:

terminalpwd
bash$(pwd)
zsh${PWD}
cmd%cd%
powershell(Get-Location).Path

For more information, visitDocker Hub Page

Local Vulnerability Database

The Format of the Vulnerability Database File

[  {"vendor":"org.apache.logging.log4j","product":"log4j-core","version":"[2.0-beta9,2.12.2)||[2.13.0,2.15.0)","language":"java","name":"Apache Log4j2 远程代码执行漏洞","id":"XMIRROR-2021-44228","cve_id":"CVE-2021-44228","cnnvd_id":"CNNVD-202112-799","cnvd_id":"CNVD-2021-95914","cwe_id":"CWE-502,CWE-400,CWE-20","description":"Apache Log4j是美国阿帕奇(Apache)基金会的一款基于Java的开源日志记录工具。\r\nApache Log4J 存在代码问题漏洞,攻击者可设计一个数据请求发送给使用 Apache Log4j工具的服务器,当该请求被打印成日志时就会触发远程代码执行。","description_en":"Apache Log4j2 2.0-beta9 through 2.12.1 and 2.13.0 through 2.15.0 JNDI features used in configuration, log messages, and parameters do not protect against attacker controlled LDAP and other JNDI related endpoints. An attacker who can control log messages or log message parameters can execute arbitrary code loaded from LDAP servers when message lookup substitution is enabled. From log4j 2.15.0, this behavior has been disabled by default. From version 2.16.0, this functionality has been completely removed. Note that this vulnerability is specific to log4j-core and does not affect log4net, log4cxx, or other Apache Logging Services projects.","suggestion":"2.12.1及以下版本可以更新到2.12.2,其他建议更新至2.15.0或更高版本,漏洞详情可参考:https://github.com/apache/logging-log4j2/pull/608\r\n1、临时解决方案,适用于2.10及以上版本:\r\n\t(1)设置jvm参数:“-Dlog4j2.formatMsgNoLookups=true”;\r\n\t(2)设置参数:“log4j2.formatMsgNoLookups=True”;","attack_type":"远程","release_date":"2021-12-10","security_level_id":1,"exploit_level_id":1  }]

Explanations of Vulnerability Database Fields

FIELDDescripationREQUIRED OR NOT
vendorthe manufacturer of the componentN
productthe name of the componentY
versionthe versions of the component affected by the vulnerabilityY
languagethe programming language of the componentY
namethe name of the vulnerabilityN
idcustom identifierY
cve_idcve identifierN
cnnvd_idcnnvd identifierN
cnvd_idcnvd identifierN
cwe_idcwe identifierN
descriptionthe descripation of the vulnerabilityN
description_enthe descripation of the vulnerability in EnglishN
suggestionthe suggestion for fixing the vulnerabilityN
attack_typethe type of attackN
release_datethe release date of the vulnerabilityN
security_level_idthe security level of the vulnerability (diminishing from 1 to 4)N
exploit_level_idthe exploit level of the vulnerability (0-N/A 1-Available)N

*There are several pre-set values to the "language" field, including java, javascript, golang, rust, php, ruby and python. Other languages are not limited to the pre-set value.

Sample of Setting the Vulnerability Database

{"origin":{"json":"db.json","mysql":{"dsn":"user:password@tcp(ip:port)/dbname","table":"table_name"    },"sqlite":{"dsn":"sqlite.db","table":"table_name"    }  }}

FAQ

Is the environment variable needed while using OpenSCA?

No. OpenSCA can be directly executed by the command in CLI/CRT after decompression.

About the vulnerability database?

OpenSCA allows configuring the local vulnerability database. It has to be sorted according tothe Format of the Vulnerability Database File.

Meanwhile, OpenSCA also offers a cloud vulnerability database covering official databases including CVE/CWE/NVD/CNVD/CNNVD.

About the time cost of OpenSCA scanning?

It depends on the size of the package, the network condition and the language.

From v1.0.11, we add aliyun mirror database as the backup to the official maven repository to solve the lag caused by network connection.

For v1.0.10 and below, if the time is abnormally long and error information about connection failure to the maven repository gets reported in the log file, users of versions between v1.0.6 and v1.0.10 can fix the problem by setting themaven field inconfig.json like below:

{"maven": [        {"repo":"https://maven.aliyun.com/repository/public","user":"","password":""        }    ]}

After setting, saveconfig.json to the same folder of opensca-cli.exe and execute the command. Eg:

opensca-cli -token {token} -path {path} -out output.html -config config.json

Users of v1.0.5 and below may have to modify the source code. We recommend an upgrade to higher versions.

For more other FAQs, please checkFAQs.

Contact Us

ISSUEs are warmly welcome.

Add WeChat for further consults is also an option:

QR Code

Our QQ Group: 832039395

Mailbox:opensca@anpro-tech.com

Authors

  • Tao Zhang
  • Chi Zhang
  • Zhong Chen
  • Enzhi Liu
  • Ge Ning

Contributing

OpenSCA is an open source project, we appreciate your contribution!

To contribute, please read ourContributing Guideline.

About

OpenSCA is an open source software supply chain security solution that supports the detection of open source dependencies, vulnerabilities and license compliance with a widely noticed accuracy by the community.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp