Tec*_*ops 3 sca gradle fortify build.gradle fortify-source
我在build.gradle中使用以下配置来运行HP Fortify扫描:
// Fortify configuration
configurations {
fortify { extendsFrom compile }
}
// pull in the fortify libs for the new configuration
dependencies {
fortify 'com.fortify:sourceanalyzer:3.90'
}
task fortifyReport(dependsOn: compileJava) << {
ant.properties['build.compiler']='com.fortify.dev.ant.SCACompiler'
ant.typedef(name: 'sca', classname: 'com.fortify.dev.ant.SourceanalyzerTask', classpath: configurations.fortify.asPath)
ant.sca(jdk:"1.7",
debug:true ,
verbose:true ,
failonerror:true ,
scan:true ,
logFile:file("$buildDir/reports/fortify/Fortify.log"),
resultsFile:file("$buildDir/reports/fortify/${project.name}.fpr")
){
fileset(dir:'src/main') {
include(name:'**/*.java')
}
}
}
Run Code Online (Sandbox Code Playgroud)
但在执行时,我得到以下内容:
* What went wrong:
Execution failed for task ':fortifyReport'.
> Could not resolve all dependencies for configuration 'detachedConfiguration157'.
> Could not find com.fortify:sourceanalyzer:3.90.
Run Code Online (Sandbox Code Playgroud)
我无法在互联网上找到sourceanalyzer:3.90插件.请告知如何解决此问题.
从SCA 16.20开始,现在支持Gradle集成.
从官方文档HPE Security Fortify静态代码分析器用户指南 - 第13章:构建集成
Gradle集成
您可以翻译使用Gradle构建的项目,而无需对build.gradle文件进行任何修改.构建运行时,Fortify静态代码分析器会在编译源文件时对其进行转换.有关专为Gradle集成支持的平台和语言,请参阅"HPE Security Fortify软件系统要求"文档.项目中使用不支持的Gradle集成语言的任何文件都不会被翻译(没有错误报告).因此,不会分析这些文件,也不会检测到任何现有的潜在漏洞.
要将Fortify静态代码分析器集成到Gradle构建中,请确保sourceanalyzer可执行文件位于系统PATH上.使用以下sourceanalyzer命令添加Gradle命令行:
sourceanalyzer -b <build_id> <sca_options> gradle [<gradle_options>] <gradle tasks>
Run Code Online (Sandbox Code Playgroud)
例如:
sourceanalyzer -b buildxyz gradle clean build
sourceanalyzer -b buildxyz gradle --info assemble
Run Code Online (Sandbox Code Playgroud)
注意:如果使用Fortify Static Code Analyzer -verbose选项,则还必须包含该-gradle选项.例如:
sourceanalyzer -b buildxyz -gradle -verbose gradle assemble
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5418 次 |
| 最近记录: |