Ror*_*ter 6 java eclipse maven fortify fortify-source
我想针对Maven Eclipse项目运行Fortify扫描.
我应该从哪里开始?
我知道我需要更新我的pom.xml文件以包含Fortify插件,但是我还需要在我的机器上安装Fortify SCA吗?(我正在运行MacOS X).我一直试图找到一个下载Fortify SCA的地方,但一直找不到它.
我很感激,如果有人可以分享一些链接,指出我在正确的方向上完成设置.
小智 6
实际上不需要配置文件,只需要插件配置.
<build>
<plugins>
<plugin>
<groupId>com.fortify.ps.maven.plugin</groupId>
<artifactId>sca-maven-plugin</artifactId>
<version>4.30</version>
<configuration>
<findbugs>true</findbugs>
<htmlReport>true</htmlReport>
<maxHeap>800M</maxHeap>
<source>myJavaVersion</source>
<buildId>myBuildId</buildId>
<verbose>true</verbose>
<skipTests>true</skipTests>
<toplevelArtifactId>myTopLevelId</toplevelArtifactId>
</configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
通过使用单个Jenkins作业,您可以编写shell脚本作为预备步骤:
mvn clean sca:clean -DskipTests
mvn sca:translate -DskipTests
Run Code Online (Sandbox Code Playgroud)
然后将实际的"目标和选项"定义为:
install sca:scan -DskipTests
Run Code Online (Sandbox Code Playgroud)
将它们作为单独的命令行使用是在一个Jenkins作业中完成sca-clean,translate和scan(以及发送到Fortify的报告文件)的唯一方法.
希望这也适合你!
我认为不需要 Fortify 安装,但是如果没有它,很难获得 maven sca 插件。如果您安装在另一台机器上,您可以只复制插件,但是您将无法使用 Audit Workbench 应用程序来处理生成的 FPR。正如@Eric 所说,您必须通过 HP 获得它,并且没有许可证将无法使用。
安装完成后,将配置文件添加到 pom.xml 以执行 sca 目标:
<profile>
<id>sca-clean</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.fortify.ps.maven.plugin</groupId>
<artifactId>sca-maven-plugin</artifactId>
<version>4.30</version>
<configuration>
<jre64>true</jre64>
<buildId>myproject</buildId>
<toplevelArtifactId>myproject.parent</toplevelArtifactId>
<skipTests>true</skipTests>
</configuration>
<executions>
<execution>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>sca-translate</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.fortify.ps.maven.plugin</groupId>
<artifactId>sca-maven-plugin</artifactId>
<version>4.30</version>
<configuration>
<jre64>true</jre64>
<jreStack>8M</jreStack>
<maxHeap>12000M</maxHeap>
<verbose>true</verbose>
<buildId>myproject</buildId>
<toplevelArtifactId>myproject.parent</toplevelArtifactId>
<skipTests>true</skipTests>
<failOnSCAError>true</failOnSCAError>
</configuration>
<executions>
<execution>
<goals>
<goal>translate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>sca-scan</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.fortify.ps.maven.plugin</groupId>
<artifactId>sca-maven-plugin</artifactId>
<version>4.30</version>
<configuration>
<jre64>true</jre64>
<jreStack>8M</jreStack>
<maxHeap>12000M</maxHeap>
<verbose>true</verbose>
<buildId>myproject</buildId>
<toplevelArtifactId>myproject.parent</toplevelArtifactId>
<failOnSCAError>true</failOnSCAError>
<upload>false</upload>
<projectName>My Project Main Development</projectName>
<projectVersion>${project.version}</projectVersion>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Run Code Online (Sandbox Code Playgroud)
从命令行运行扫描:
mvn -Dmaven.test.skip=true -Dfortify.sca.buildId=myproject -Dfortify.sca.toplevel.artifactId=myproject.parent com.fortify.ps.maven.plugin:sca-maven-plugin:clean
Run Code Online (Sandbox Code Playgroud)
显然,您必须弄清楚 buildId 和 artifactId 的命名,并且根据您是使用 parent、aggregator 还是什么都不使用,它会有所不同。
| 归档时间: |
|
| 查看次数: |
19321 次 |
| 最近记录: |