Fortify Source Analyzer and Apache Lenya

被刻印的时光 ゝ 提交于 2019-12-04 10:24:27

I'm not sure whether you have access to the Fortify documentation, but that will definitely help. You should refer to the SCA User's Guide to understand how to use the sourceanalyzer executable.

To cut things short, there are two ways of getting the FPR file:

  1. (The long way) Write a script to translate and analyse the source code by providing the path of the source code and the classpath to the sourceanalyzer executable.
  2. (The short way) Use the SCACompiler instead of javac as the compiler. You'll need to modify the build script for this.

I prefer the former due to its customizability when handling large code bases.

PS: Which version of Fortify is this?

Don't use the touchless command, that is for C/C++ Integration. Since Lenya is written in Java, you're better off with other commands. Try this for your first translation step (run from your base lenya dir):

sourceanalyzer -b lenya -Xmx1200M -source 1.5 -cp "**/*.jar" "**/*"

The command you used actually could work with Java builds, except that it has some limitations. Using the touchless build wrapper creates a number of compiler wrappers, e.g. for javac, and puts the wrappers at the front of the PATH environment variable.

If your build.sh script contains fully qualified references to javac, for example /usr/java/bin/javac, then the touchless build integration will not work.

user233276's instructions are the most broadly useful. If you want to experiment with Fortify SCA build integration, I would suggest the technique would be to modify build.sh (see http://svn.apache.org/viewvc/lenya/trunk/build.sh?view=markup&pathrev=400414) and change line 43 from:

"$ANT_HOME/bin/ant" -logger org.apache.tools.ant.NoBannerLogger -emacs $@

to:

sourceanalyzer -b Lenya "$ANT_HOME/bin/ant" -logger org.apache.tools.ant.NoBannerLogger -emacs $@

See the Fortify SCA User Guide for the three types of ant integration:

  1. Override the build.compiler property:

    ant -lib sourceanalyzer.jar {Fortify ant options} {ant options}

  2. Shortcut to the above:

    sourceanalyzer -b {Fortify options} ant {ant options}

  3. Or, if you make a custom build.xml as shown in the appendix:

    ant -lib sourceanalyzer.jar {ant options}

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!