SCA Guide 20.2.0
SCA Guide 20.2.0
SCA Guide 20.2.0
User Guide
Legal Notices
Micro Focus
The Lawn
22-30 Old Bath Road
Newbury, Berkshire RG14 1QN
UK
https://www.microfocus.com
Warranty
The only warranties for products and services of Micro Focus and its affiliates and licensors (“Micro Focus”) are set forth in
the express warranty statements accompanying such products and services. Nothing herein should be construed as
constituting an additional warranty. Micro Focus shall not be liable for technical or editorial errors or omissions contained
herein. The information contained herein is subject to change without notice.
Copyright Notice
© Copyright 2003 - 2020 Micro Focus or one of its affiliates
Trademark Notices
All trademarks, service marks, product names, and logos included in this document are the property of their respective
owners.
Documentation Updates
The title page of this document contains the following identifying information:
l Software Version number
l Document Release Date, which changes each time the document is updated
l Software Release Date, which indicates the release date of this version of the software
This document was produced on December 09, 2020. To check for recent updates or to verify that you are using the most
recent edition of a document, go to:
https://www.microfocus.com/support/documentation
Contents
Preface 12
Contacting Micro Focus Fortify Customer Support 12
For More Information 12
About the Documentation Set 12
Change Log 13
Chapter 1: Introduction 17
Fortify Static Code Analyzer 17
Fortify ScanCentral SAST 18
Fortify Scan Wizard 18
Fortify Software Security Content 18
About the Analyzers 19
Related Documents 20
All Products 21
Micro Focus Fortify ScanCentral SAST 21
Micro Focus Fortify Software Security Center 22
Micro Focus Fortify Static Code Analyzer 22
Preface
l Download software
https://www.microfocus.com/support
Change Log
The following table lists changes made to this document. Revisions to this document are published
between software releases only if the changes made affect product functionality.
Software Release /
Document Version Changes
20.2.0 Added:
l "About Installing Fortify Static Code Analyzer and Applications" on
page 27 and "Using Docker to Install and Run Fortify Static Code
Analyzer" on page 33
l "Translating Dockerfiles" on page 103
l "Configuring Scan Speed with Speed Dial" on page 146
l "Fortify Java Annotations" on page 175 - Incorporated information
previously available in the javaAnnotations sample README.txt to this
guide
Updated:
l "Translating Visual Studio and MSBuild Projects" on page 58 - Updated
to reflect the translation improvements made over the past couple
releases (former chapter title: Translating .NET Code)
l "Translating COBOL Code" on page 84 - Describes the changes
introduced for analyzing COBOL code
l "Generating a BIRT Report" on page 136 - New supported report
template added: OWASP ASVS 4.0
l "Sample Projects" on page 170 - Added two new samples
l All references to Fortify ScanCentral were replaced with Fortify
ScanCentral SAST (product name change)
20.1.2 Added:
l "Translating Kotlin Code" on page 55
Updated:
Software Release /
Document Version Changes
20.1.0 Added:
l .NET Command-Line Options - Added a new option to exclude from
translation any disabled projects in a solution
Updated:
l "About Installing Fortify Static Code Analyzer and Applications" on
page 27 - Removed all mentions of Solaris as this operating system is no
longer supported
l "Installing Fortify Static Code Analyzer and Applications Silently
(Unattended)" on page 29 - Added more information to the instructions
for different operating systems
l "Generating a BIRT Report" on page 136 - Added support for new
report: CWE Top 25 2019
l "Generating a Legacy Report" on page 138 - Removed RTF as a possible
output format
l All references to Fortify CloudScan were replaced with Fortify
ScanCentral (product name change)
Removed:
l Incremental Analysis - Feature to be removed in the next release
19.2.0 Added:
l "Modular Analysis" on page 45 - New feature to scan Java/Java EE
libraries separately from the core project (related updated topics:
"Analysis Options" on page 114 and "fortify-sca.properties" on
page 182)
l "Translating Go Code" on page 77
Updated:
l "About Upgrading Fortify Static Code Analyzer and Applications" on
page 35 - Provided additional information
l "Translating JavaScript and TypeScript Code" on page 67 - Added
instructions for excluding NPM dependencies
l "Generating a BIRT Report" on page 136 - Support added for GDPR,
Software Release /
Document Version Changes
19.1.0 Added:
l This document now includes all content from the Micro Focus Fortify
Static Code Analyzer Installation Guide and the Micro Focus Fortify
Static Code Analyzer User Guide, which are no longer published as of
this release.
Updated:
l "Translating JavaScript and TypeScript Code" on page 67 - The Higher
Order Analyzer is now enabled by default for JavaScript and TypeScript
l "Using the Django Framework with Python" on page 72 and "Python
Command-Line Options" on page 72 - Added a description of a new
feature to automatically discover Django template locations
l "iOS Code Analysis Command-Line Syntax" on page 75 and "Android
Code Analysis Command-Line Syntax" on page 76 - Added examples
for translating property list files and configuration files
l "Importing the Transport Request" on page 90 - Clarified the supported
SAP version for the Fortify ABAP Extractor transport request and
added a suggestion if the import fails
l "Running the Fortify ABAP Extractor" on page 92 - Updated to provide
more details
l "Using the Fortify Maven Plugin" on page 110 - Clarified the two
different ways to analyze a maven project
l "Output Options" on page 117 - Added a description of the FVDL
Software Release /
Document Version Changes
can also offload the translation phase of the analysis to Fortify ScanCentral SAST. For information
about the specific supported language, see the Micro Focus Fortify Software System Requirements
document.
For detailed information about how to use Fortify ScanCentral SAST, see the Micro Focus Fortify
ScanCentral SAST Installation, Configuration, and Usage Guide.
Fortify provides the ability to write custom rules that add to the functionality of Fortify Static Code
Analyzer and the Secure Coding Rulepacks. For example, you might need to enforce proprietary
security guidelines or analyze a project that uses third-party libraries or other pre-compiled binaries that
are not already covered by the Secure Coding Rulepacks. You can also customize the external metadata
to map Fortify issues to different taxonomies, such as internal application security standards or
additional compliance obligations. For instructions on how to create your own custom rules or custom
external metadata, see the Micro Focus Fortify Static Code Analyzer Custom Rules Guide.
Fortify recommends that you periodically update the security content. You can use the fortifyupdate
utility to obtain the latest security content. For more information, see "Updating Security Content" on
page 127.
Analyzer Description
Buffer The Buffer Analyzer detects buffer overflow vulnerabilities that involve writing or
reading more data than a buffer can hold. The buffer can be either stack-allocated
or heap-allocated. The Buffer Analyzer uses limited interprocedural analysis to
determine whether there is a condition that causes the buffer to overflow. If any
execution path to a buffer leads to a buffer overflow, Fortify Static Code Analyzer
reports it as a buffer overflow vulnerability and points out the variables that could
cause the overflow. If the value of the variable causing the buffer overflow is tainted
(user-controlled), then Fortify Static Code Analyzer reports it as well and displays
the dataflow trace to show how the variable is tainted.
Configuration The Configuration Analyzer searches for mistakes, weaknesses, and policy violations
in application deployment configuration files. For example, the Configuration
Analyzer checks for reasonable timeouts in user sessions in a web application.
Content The Content Analyzer searches for security issues and policy violations in HTML
content. In addition to static HTML pages, the Content Analyzer performs these
checks on files that contain dynamic HTML, such as PHP, JSP, and classic ASP files.
Analyzer Description
Control Flow The Control Flow Analyzer detects potentially dangerous sequences of operations.
By analyzing control flow paths in a program, the Control Flow Analyzer determines
whether a set of operations are executed in a certain order. For example, the Control
Flow Analyzer detects time of check/time of use issues and uninitialized variables,
and checks whether utilities, such as XML readers, are configured properly before
being used.
Dataflow The Dataflow Analyzer detects potential vulnerabilities that involve tainted data
(user-controlled input) put to potentially dangerous use. The Dataflow Analyzer
uses global, interprocedural taint propagation analysis to detect the flow of data
between a source (site of user input) and a sink (dangerous function call or
operation). For example, the Dataflow Analyzer detects whether a user-controlled
input string of unbounded length is copied into a statically sized buffer, and detects
whether a user-controlled string is used to construct SQL query text.
Null Pointer The Null Pointer Analyzer detects dereferences of pointer variables that are
assigned the null value. The Null Pointer Analyzer detection is performed at the
intra-procedural level. Issues are detected only when the null assignment, the
dereference, and all the paths between them occur within a single function.
Semantic The Semantic Analyzer detects potentially dangerous uses of functions and APIs at
the intra-procedural level. Its specialized logic searches for buffer overflow, format
string, and execution path issues, but is not limited to these categories. For example,
the Semantic Analyzer detects deprecated functions in Java and unsafe functions in
C/C++, such as gets().
Structural The Structural Analyzer detects potentially dangerous flaws in the structure or
definition of the program. By understanding the way programs are structured, the
Structural Analyzer identifies violations of secure programming practices and
techniques that are often difficult to detect through inspection because they
encompass a wide scope involving both the declaration and use of variables and
functions. For example, the Structural Analyzer detects assignment to member
variables in Java servlets, identifies the use of loggers that are not declared static
final, and flags instances of dead code that is never executed because of a predicate
that is always false.
Related Documents
This topic describes documents that provide information about Micro Focus Fortify software products.
Note: You can find the Micro Focus Fortify Product Documentation at
https://www.microfocus.com/support/documentation. All guides are available in both PDF and
HTML formats.
All Products
The following documents provide general information for all products. Unless otherwise noted, these
documents are available on the Micro Focus Product Documentation website.
About Micro Focus Fortify Product This paper provides information about how to access Micro
Software Documentation Focus Fortify product documentation.
About_Fortify_Docs_<version>.pdf Note: This document is included only with the product
download.
Micro Focus Fortify Software System This document provides the details about the
Requirements environments and products supported for this version of
Fortify Software.
Fortify_Sys_Reqs_<version>.pdf
Micro Focus Fortify Software Release This document provides an overview of the changes made
Notes to Fortify Software for this release and important
information not included elsewhere in the product
FortifySW_RN_<version>.pdf
documentation.
What’s New in Micro Focus Fortify This document describes the new features in Fortify
Software <version> Software products.
Fortify_Whats_New_<version>.pdf
Micro Focus Fortify ScanCentral This document provides information about how to install,
SAST Installation, Configuration, and configure, and use Fortify ScanCentral SAST to streamline
Usage Guide the static code analysis process. It is written for anyone who
Micro Focus Fortify Software Security This document provides Fortify Software Security Center
Center User Guide users with detailed information about how to deploy and
use Software Security Center. It provides all of the
SSC_Guide_<version>.pdf
information you need to acquire, install, configure, and use
Software Security Center.
It is intended for use by system and instance
administrators, database administrators (DBAs), enterprise
security leads, development team managers, and
developers. Software Security Center provides security
team leads with a high-level overview of the history and
current status of a project.
Micro Focus Fortify Static Code This document describes how to install and use Fortify
Analyzer User Guide Static Code Analyzer to scan code on many of the major
programming platforms. It is intended for people
SCA_Guide_<version>.pdf
responsible for security audits and secure coding.
Micro Focus Fortify Static Code This document provides the information that you need to
Analyzer Custom Rules Guide create custom rules for Fortify Static Code Analyzer. This
guide includes examples that apply rule-writing concepts to
SCA_Cust_Rules_Guide_<version>.zip
real-world security issues.
Micro Focus Fortify Audit Workbench This document describes how to use Fortify Audit
User Guide Workbench to scan software projects and audit analysis
results. This guide also includes how to integrate with bug
AWB_Guide_<version>.pdf
trackers, produce reports, and perform collaborative
auditing.
Micro Focus Fortify Plugins for Eclipse This document provides information about how to install
User Guide and use the Fortify Complete and the Fortify Remediation
Plugins for Eclipse.
Eclipse_Plugins_Guide_<version>.pdf
Micro Focus Fortify Plugins for This document describes how to install and use both the
JetBrains IDEs and Android Studio Fortify Analysis Plugin for IntelliJ IDEA and Android Studio
User Guide and the Fortify Remediation Plugin for IntelliJ IDEA,
Android Studio, and other JetBrains IDEs.
JetBrains_AndStud_Plugins_Guide_
<version>.pdf
Micro Focus Fortify Jenkins Plugin This document describes how to install, configure, and use
User Guide the plugin. This documentation is available at
https://www.microfocus.com/documentation/fortify-
Jenkins_Plugin_Guide_<version>.pdf
jenkins-plugin.
Micro Focus Fortify Security Assistant This document describes how to install and use Fortify
Plugin for Eclipse User Guide Security Assistant plugin for Eclipse to provide alerts to
security issues as you write your Java code.
SecAssist_Eclipse_Guide_
<version>.pdf
Micro Focus Fortify Extension for This document provides information about how to install
Visual Studio User Guide and use the Fortify extension for Visual Studio to analyze,
audit, and remediate your code to resolve security-related
VS_Ext_Guide_<version>.pdf
issues in solutions and projects.
Micro Focus Fortify Static Code This document describes the properties used by Fortify
Component Description
Micro Focus Fortify Audit Provides a graphical user interface for Fortify Static Code Analyzer that
Workbench helps you organize, investigate, and prioritize analysis results so that
developers can fix security flaws quickly.
Micro Focus Fortify Adds the ability to scan and analyze the entire codebase of a project and
Plugin for Eclipse apply software security rules that identify the vulnerabilities in your Java
code from the Eclipse IDE. The results are displayed, along with
descriptions of each of the security issues and suggestions for their
elimination.
Component Description
Micro Focus Fortify Adds the ability to run Fortify Static Code Analyzer scans on the entire
Analysis Plugin for IntelliJ codebase of a project and apply software security rules that identify the
and Android Studio vulnerabilities in your code from the IntelliJ and Android Studio IDEs.
Micro Focus Fortify Adds the ability to scan and locate security vulnerabilities in your
Extension for Visual solutions and projects and displays the scan results in Visual Studio. The
Studio results include a list of issues uncovered, descriptions of the type of
vulnerability each issue represents, and suggestions on how to fix them.
This extension also includes remediation functionality that works with
audit results stored on a Micro Focus Fortify Software Security Center
server.
Micro Focus Fortify Scan A tool to quickly prepare a script that you can use to scan your code with
Wizard Fortify Static Code Analyzer and optionally, upload the results directly
to Fortify Software Security Center.
Command-line utilities There are several command-line utilities that are installed automatically
with Fortify Static Code Analyzer. For more information, see "Command-
Line Utilities" on page 125.
The following table describes the components that are included in the Fortify Static Code Analyzer and
Applications package. You install these components separately from the Fortify Static Code Analyzer
and Applications installer.
Component Description
Micro Focus Fortify Remediation Plugin for Works with Fortify Software Security Center for
Eclipse developers who want to remediate issues detected in
source code from the Eclipse IDE.
Micro Focus Fortify Remediation Plugin for Works in several JetBrains IDEs and Android Studio
JetBrains IDEs together with Fortify Software Security Center to
add remediation functionality to your security
analysis.
Component Description
Micro Focus Fortify Security Assistant Plugin Provides alerts to potential security issues as you
for Eclipse write your Java code. It provides detailed
information about security risks and
recommendations for how to secure the potential
issue.
Perform the installation using a standard install "Installing Fortify Static Code Analyzer and
wizard Applications" on the next page
Perform the installation silently (unattended) "Installing Fortify Static Code Analyzer and
Applications Silently (Unattended)" on page 29
Perform a text-based installation on non- "Installing Fortify Static Code Analyzer and
Windows systems Applications in Text-Based Mode on
Non-Windows Platforms" on page 32
Perform the installation using Docker "Using Docker to Install and Run Fortify Static
Code Analyzer" on page 33
For best performance, install Fortify Static Code Analyzer on the same local file system where the code
that you want to scan resides.
Note: On non-Windows systems, you must install Fortify SCA and Applications as a user that has a
home directory with write permission. Do not install Fortify SCA and Applications as a non-root
user that has no home directory.
After you complete the installation, see "Post-Installation Tasks" on page 38 for additional steps you
can perform to complete your system setup. You can also configure settings for runtime analysis,
output, and performance of Fortify Static Code Analyzer and its components by updating the installed
configuration files. For information about the configuration options for Fortify Static Code Analyzer,
see "Configuration Options" on page 180. For information about configuration options for Fortify
Static Code Analyzer component applications, see the Micro Focus Fortify Static Code Analyzer Tools
Properties Reference Guide.
5. If you are installing the Fortify extension for Visual Studio 2015 or 2017, you are prompted to
specify whether to install the extensions for the current install user or for all users.
The default is to install the extensions for the current install user.
6. Specify the path to the fortify.license file, and then click Next.
7. Specify the settings required to update your security content.
To update the security content for your installation:
Note: For installations on non-Windows platforms and for deployment environments that do
not have access to the Internet during installation, you can update the security content using
the fortifyupdate utility. See "Manually Installing Fortify Security Content" on page 32.
a. Specify the URL address of the update server. To use the Fortify Rulepack update server for
security content updates, specify the URL as: https://update.fortify.com.
b. (Optional) Specify the proxy host and port number of the update server.
c. Click Next.
8. Specify if you want to migrate from a previous installation of Fortify Static Code Analyzer on your
system.
Migrating from a previous Fortify Static Code Analyzer installation preserves Fortify Static Code
Analyzer artifact files. For more information, see "About Upgrading Fortify Static Code Analyzer
and Applications" on page 35.
Note: You can also migrate Fortify Static Code Analyzer artifacts using the scapostinstall
command-line utility. For information on how to use the post-install tool to migrate from a
previous Fortify Static Code Analyzer installation, see "Migrating Properties Files" on page 38.
10. Click Next to proceed to install Fortify Static Code Analyzer and applications.
11. After Fortify Static Code Analyzer is installed, select Update security content after installation
if you want to update the security content, and then click Finish.
The Security Content Update Result window displays the security content update results.
fortify_license_path=<license_file_location>
b. If you are using a different location for the Fortify Security Content updates than the default of
https://update.fortify.com, add the following line:
UpdateServer=<update_server_url>
Note: As previously mentioned, Fortify security content is not downloaded with a silent
installation. However, this information and the proxy information in the following step is
added to the <sca_install_dir>Core/config/server.properties file to use for
manually installing Fortify security content.
UpdateProxyServer=<proxy_server>
UpdateProxyPort=<port_number>
d. If you do not want to install the sample source code projects, add the following line.
On Windows:
InstallSamples=0
enable-components=Samples
For the enable-components option on Windows, you can specify the AWB_group parameter
to install Fortify Audit Workbench, Fortify Custom Rules Editor, and associate FPR files with
Fortify Audit Workbench. To install specific plugins, list each one by parameter name (the
Plugins_group parameter does not install all plugins and you do not need to include it).
The following example Windows options file specifies the location of the license file, the location
and proxy information for obtaining the Fortify Security Content, a request to migrate from a
previous release, installation of Audit Workbench, installation of Micro Focus Fortify Extension
for Visual Studio 2019 for all users, and the location of the Fortify SCA and Applications
installation directory:
fortify_license_path=C:\Users\admin\Desktop\fortify.license
UpdateServer=https://internalserver.abc.com
UpdateProxyServer=webproxy.abc.company.com
UpdateProxyPort=8080
MigrateSCA=1
enable-components=AWB_group,VS2019
VS_all_users=1
installdir=C:\Fortify
fortify_license_path=/opt/Fortify/fortify.license
UpdateServer=https://internalserver.abc.com
UpdateProxyServer=webproxy.abc.company.com
UpdateProxyPort=8080
MigrateSCA=1
enable-components=Samples
installdir=/opt/Fortify
macOS You must uncompress the ZIP file before you run the command.
Fortify_SCA_and_Apps_<version>_osx_x64.app/Contents/
MacOS/installbuilder.sh --mode unattended --optionfile <full_
path_to_option_file>
The installer creates an installer log file when the installation is complete. This log file is located in the
following location depending on your operating system.
Windows C:\Users\<username>\AppData\Local\Temp\FortifySCAandApps-
<version>-install.log
Linux /tmp/FortifySCAandApps-<version>-install.log
macOS /tmp/FortifySCAandApps-<version>-install.log
macOS You must uncompress the provided ZIP file before you run the command.
Fortify_SCA_and_Apps_<version>_osx_x64.app/Contents/
MacOS/installbuilder.sh --mode text
Note: You can only run Fortify Static Code Analyzer in Docker on supported Linux platforms.
2. Copy the Fortify SCA and Applications installer, the Fortify license file, and installation options file
to the Docker image using the COPY instruction.
For instructions on how to create an installation options file, see "Installing Fortify Static Code
Analyzer and Applications Silently (Unattended)" on page 29.
3. Run the Fortify SCA and Applications installer using the RUN instruction.
You must run the installer in unattended mode. For more information, see "Installing Fortify Static
Code Analyzer and Applications Silently (Unattended)" on page 29.
4. Run fortifyupdate to download the Fortify Security Content using the RUN instruction.
For more information about this utility, see "Manually Installing Fortify Security Content" on the
previous page.
5. To configure the image so you can run Fortify Static Code Analyzer, set the entry point to the
location of the installed sourceanalyzer executable using the ENTRYPOINT instruction.
The default sourceanalyzer installation path is: /opt/Fortify/Fortify_SCA_and_Apps_
<version>/bin/sourceanalyzer.
FROM registry.suse.com/suse/sles12sp4
COPY fortify.license ./
COPY Fortify_SCA_and_Apps_20.2.0_linux_x64.run ./
COPY installerSettings ./
RUN zypper -n install rpm-build
RUN ./Fortify_SCA_and_Apps_20.2.0_linux_x64.run --mode unattended \
--optionfile ./installerSettings && \
/opt/Fortify/Fortify_SCA_and_Apps_20.2.0/bin/fortifyupdate && \
rm Fortify_SCA_and_Apps_20.2.0_linux_x64.run fortify.license installerSettings
ENTRYPOINT [ "/opt/Fortify/Fortify_SCA_and_Apps_20.2.0/bin/sourceanalyzer" ]
To create the docker image using the Dockerfile from the current directory, you must use the docker
build command. For example:
Important! Include the Fortify Static Code Analyzer –fcontainer option in both the translate
and scan commands so that Fortify Static Code Analyzer detects and uses only the memory
dedicated to the container. Otherwise, by default Fortify Static Code Analyzer detects the total
system memory because -autoheap is enabled.
The following example mounts the temporary directory, and then runs Fortify Static Code Analyzer
from the container for the analysis phase:
Note: You can leave the previous version installed. If you have multiple versions installed on the
same system, the most recently installed version is invoked when you run the command from the
command line. Scanning source code from the Fortify Secure Code Plugins also uses the most
recently installed version of Fortify Static Code Analyzer.
Note: If you do not have administrative privileges and you are upgrading the Fortify Extension for
Visual Studio 2015, 2017, or 2019 that was previously installed using an administrative privileged
user account, you must first uninstall the Fortify Extension for Visual Studio from Visual Studio
2015, 2017, or 2019 using an administrative privilege account.
Fortify Static Code Analyzer that you are uninstalling. The Fortify Static Code Analyzer
(sca<version>) folder is not removed.
l Click No to retain the application settings on your system.
macOS Uninstall_FortifySCAandApps_<version>.app
3. You are prompted to indicate whether to remove all application settings. Do one of the following:
l Click Yes to remove the application setting folders for the tools installed with the version of
Fortify Static Code Analyzer that you are uninstalling. The Fortify Static Code Analyzer
(sca<version>) folder is not removed.
l Click No to retain the application settings on your system.
macOS Uninstall_FortifySCAandApps_
<version>.app/Contents/MacOS/installbuilder.sh
--mode unattended
Note: The uninstaller removes the application setting folders for the tools installed with the version
of Fortify Static Code Analyzer that you are uninstalling.
macOS Uninstall_FortifySCAandApps_
<version>.app/Contents/MacOS/installbuilder.sh --mode text
Post-Installation Tasks
Post-installation tasks prepare you to start using Fortify Static Code Analyzer and tools.
Specifying a Locale
English is the default locale for a Fortify Static Code Analyzer installation.
To change the locale for your Fortify Static Code Analyzer installation:
1. Navigate to the bin directory from the command line.
2. At the command prompt, type scapostinstall.
3. Type 2 to select Settings.
4. Type 1 to select General.
5. Type 1 to select Locale.
6. Type one of the following locale codes:
l English: en
l Spanish: es
l Japanese: ja
l Korean: ko
l Brazilian Portuguese: pt_BR
l Simplified Chinese: zh_CN
l Traditional Chinese: zh_TW
(option 6)
l The Fortify Software Security Center user name (option 7)
Analysis Process
There are four distinct phases that make up the analysis process:
1. Build Integration—Choose whether to integrate Fortify Static Code Analyzer into your build tool.
For descriptions of build integration options, see "Integrating into a Build" on page 105.
2. Translation—Gathers source code using a series of commands and translates it into an
intermediate format associated with a build ID. The build ID is usually the name of the project you
are translating. For more information, see "Translation Phase" on the next page.
3. Analysis—Scans source files identified in the translation phase and generates an analysis results
file (typically in the Fortify Project Results (FPR) format). FPR files have the .fpr file extension.
For more information, see "Analysis Phase" on page 44.
4. Verification of translation and analysis—Verifies that the source files were scanned using the
correct Rulepacks and that no errors were reported. For more information, see "Translation and
Analysis Phase Verification" on page 46.
The following is an example of the sequence of commands you use to translate and analyze code:
The three commands in the previous example illustrates the following steps in the analysis process:
1. Remove all existing Fortify Static Code Analyzer temporary files for the specified build ID.
Always begin an analysis with this step to analyze a project with a previously used build ID.
2. Translate the project code.
This step can consist of multiple calls to sourceanalyzer with the same build ID.
3. Analyze the project code and produce the Fortify Project Results file (FPR).
Parallel Processing
Fortify Static Code Analyzer runs in parallel analysis mode to reduce the scan time of large projects. This
takes advantage of all CPU cores available on your system. When you run Fortify Static Code Analyzer,
avoid running other substantial processes during the Fortify Static Code Analyzer execution because it
expects to have the full resources of your hardware available for the scan.
Translation Phase
To successfully translate a project that is normally compiled, make sure that you have any dependencies
required to build the project available. The chapters for each source code type describe any specific
requirements.
The basic command-line syntax to perform the first step of the analysis process, file translation, is:
or
The translation phase consists of one or more invocations of Fortify Static Code Analyzer using the
sourceanalyzer command. Fortify Static Code Analyzer uses a build ID (-b option) to tie the
invocations together. Subsequent invocations of sourceanalyzer add any newly specified source or
configuration files to the file list associated with the build ID.
After translation, you can use the -show-build-warnings directive to list any warnings and errors
that occurred in the translation phase:
To view the files associated with a build ID, use the -show-files directive:
The following chapters describe how to translate different types of source code:
l "Translating Java Code" on page 47
l "Translating Kotlin Code" on page 55
l "Translating Visual Studio and MSBuild Projects" on page 58
l "Translating C and C++ Code" on page 64
l "Translating JavaScript and TypeScript Code" on page 67
l "Translating Python Code" on page 71
l "Translating Code for Mobile Platforms" on page 74
l "Translating Go Code" on page 77
Note: Before version 16.10, the major portion of the Fortify Static Code Analyzer version number
was not the same as the Micro Focus Fortify Software Security Center version number.
To determine the Fortify Static Code Analyzer version number, type sourceanalyzer -version on
the command line.
where <file>.mbs is the file name you provide for the Fortify Static Code Analyzer mobile build
session.
Note: If necessary, you can obtain the build ID and Fortify Static Code Analyzer version from an
MBS file with the following command:
After you import your Fortify Static Code Analyzer mobile build session, you can proceed to the
analysis phase. Perform a scan with the same build ID that was used in the translation.
You cannot merge multiple mobile build sessions into a single MBS file. Each exported build session
must have a unique build ID. However, after all the build IDs are imported on the same Fortify Static
Code Analyzer installation, you can scan multiple build IDs in one scan with the -b option (see "Analysis
Phase" below).
Analysis Phase
The analysis phase scans the intermediate files created during translation and creates the vulnerability
results file (FPR).
The analysis phase consists of one invocation of sourceanalyzer. You specify the build ID and
include the -scan directive with any other required analysis or output options (see "Analysis Options"
on page 114 and "Output Options" on page 117).
An example of the basic command-line syntax for the analysis phase is:
Note: By default, Fortify Static Code Analyzer includes the source code in the FPR file.
To combine multiple builds into a single scan command, add the additional builds to the command line:
The use of antivirus software can negatively impact Fortify Static Code Analyzer performance. If you
notice long scan times, Fortify recommends that you temporarily exclude the internal Fortify Static
Code Analyzer files from your antivirus software scan. You can also do the same for the directories
where the source code resides, however the performance impact on the Fortify analysis is less than with
the internal directories.
By default, Fortify Static Code Analyzer creates internal files in the following location:
l On Windows: c:\Users\<user>\AppData\Local\Fortify\sca<version>
l On non-Windows: $HOME/.fortify/sca<version>
where <version> is the version of Fortify Static Code Analyzer you are using.
Higher-Order Analysis
Higher-Order Analysis (HOA) improves the ability to track dataflow through higher-order code. Higher-
order code manipulates functions as values, generating them with anonymous function expressions
(lambda expressions), passing them as arguments, returning them as values, and assigning them to
variables and to fields of objects. These code patterns are common in modern dynamic languages such
as JavaScript, TypeScript, Python, Ruby, and Swift.
By default, Fortify Static Code Analyzer performs Higher-Order Analysis when you scan JavaScript,
TypeScript, Python, Ruby, and Swift code. For a description of the Higher-Order Analysis properties,
see "fortify-sca.properties" on page 182 and search for "higher-order analysis."
Modular Analysis
This release includes a technology preview of modular analysis. With modular analysis, you can pre-scan
libraries (and sublibraries) separately from your core project. You can then include these pre-scanned
libraries when you scan the core project. Doing this might improve the core project analysis performance
because you are not rescanning the libraries every time you scan the core project. Modular analysis also
enables you to scan a project that references a library without requiring the library's source code, Fortify
Static Code Analyzer translated files, or custom rules used to scan the library. This has the added
benefit that you only need to audit issues in your core application. The analysis results are more
streamlined to code that you directly control and therefore you do not need to worry about issues in
code that you do not own.
Modular analysis is currently available for libraries and applications developed in Java and Java EE.
Note: In this release, you might not see any performance improvements from modular analysis.
Fortify is working to optimize the performance of modular analysis in future releases.
To translate and scan the core project and include multiple pre-scanned libraries:
For a description of the options shown in the previous examples, see "Analysis Options" on page 114.
To view result certification information, open the FPR file in Fortify Audit Workbench and select Tools
> Project Summary > Certification. For more information, see the Micro Focus Fortify Audit
Workbench User Guide.
For information about integrating Fortify Static Code Analyzer with Ant, see "Ant Integration" on
page 107.
To have Fortify Static Code Analyzer emulate the compiler, type:
where:
l <translation_options> are options passed to the compiler.
l -cp <classpath> specifies the class path to use for the Java source code.
A class path is the path that the Java runtime environment searches for classes and other resource
files. Include all JAR dependencies normally used to build the project. The format is the same as what
javac expects (colon- or semicolon-separated list of paths).
Similar to javac, Fortify Static Code Analyzer loads classes in the order they appear in the class path.
If there are multiple classes with the same name in the list, Fortify Static Code Analyzer uses the first
loaded class. In the following example, if both A.jar and B.jar include a class called
MyData.class, Fortify Static Code Analyzer uses the MyData.class from A.jar.
Fortify strongly recommends that you avoid using duplicate classes with the -cp option.
Fortify Static Code Analyzer loads JAR files in the following order:
a. From the -cp option
b. From jre/lib
c. From <sca_install_dir>/Core/default_jars
This enables you to override a library class by including the similarly-named class in a JAR specified
with the -cp option.
For descriptions of all the available Java-specific command-line options, see "Java Command-Line
Options" below.
-appserver-version Specifies the version of the application server. See the Micro
<version> Focus Fortify Software System Requirements document for
supported versions.
Equivalent Property Name:
com.fortify.sca.AppServerVersion
-cp <dirs> | Specifies the class path to use for analyzing Java source code.
-classpath <dirs> The format is the same as javac: a colon- or semicolon-
separated list of directories. You can use Fortify Static Code
Analyzer file specifiers as shown in the following example:
-cp "build/classes:lib/*.jar"
-java-build-dir <dirs> Specifies one or more directories that contain compiled Java
sources. You must specify this for FindBugs results as
described in "Analysis Options" on page 114.
-source <version> | Indicates the JDK version for which the Java code is written.
-jdk <version> See the Micro Focus Fortify Software System Requirements
document for supported versions. The default is Java 8.
Equivalent Property Name:
com.fortify.sca.JdkVersion
To translate all .java files in the src directory using all JAR files in the lib directory as a class path,
type:
To translate and compile the MyCode.java file with the javac compiler, type:
Java Warnings
You might see the following warnings for Java:
Using FindBugs
FindBugs (http://findbugs.sourceforge.net) is a static analysis tool that detects quality issues in Java
code. You can run FindBugs with Fortify Static Code Analyzer and the results are integrated into the
analysis results file. Unlike Fortify Static Code Analyzer, which runs on Java source files, FindBugs runs
on Java bytecode. Therefore, before you run an analysis on your project, first compile the project and
produce the class files.
To see an example of how to run FindBugs automatically with Fortify Static Code Analyzer, compile the
sample code Warning.java as follows:
1. Go to the following directory:
<sca_install_dir>/Samples/advanced/findbugs
mkdir build
3. Scan the sample with FindBugs and Fortify Static Code Analyzer as follows:
auditworkbench myresults.fpr
If you group by analyzer, you can see that the Structural Analyzer produced one issue and FindBugs
produced eight. The Object model violation issue Fortify Static Code Analyzer detected on line
25 is similar to the Equal objects must have equal hash codes issue that FindBugs detected.
In addition, FindBugs produces two sets of issues (Useless self-assignment and Dead local
store) about the same vulnerabilities on lines 6 and 7. To avoid overlapping results, use the -filter
option during the scan to apply the filter.txt filter file. Note that the filtering is not complete
because each tool filters at a different level of granularity. To see how to avoid overlapping results, scan
the sample code using filter.txt as follows:
where /**/*.jsp refers to the location of your JSP project files and /**/*.xml refers to the location
of your configuration and deployment descriptor files.
Could not locate the root (WEB-INF) of the web application. Please build
your web application and try again. Failed to parse the following jsp
files:
<list_of_jsp_files>
This warning indicates that your web application is not deployed in the standard WAR directory format
or does not contain the full set of required libraries. To resolve the warning, make sure that your web
application is in an exploded WAR directory format with the correct WEB-INF/lib and WEB-
INF/classes directories containing all of the .jar and .class files required for your application.
Also verify that you have all of the TLD files for all of your tags and the corresponding JAR files with
their tag implementations.
This specifies how Fortify Static Code Analyzer processes .class and .jar files.
2. In the Fortify Static Code Analyzer translation phase, specify the Java bytecode files that you want
to translate. For best performance, specify only the .jar or .class files that require scanning.
In the following example, the .class files are translated:
Failed to translate the following jsps into analysis model. Please see the
log file for any errors from the jsp parser and the user manual for hints
on fixing those
<list_of_jsp_files>
l You are missing some tag libraries or their definitions (TLD) for the application
To obtain more information about the problem, perform the following steps:
1. Open the Fortify Static Code Analyzer log file in an editor.
2. Search for the strings Jsp parser stdout: and Jsp parser stderr:.
The JSP parser generates these errors. Resolve the errors and rerun Fortify Static Code Analyzer.
For more information about scanning Java EE applications, see "Translating Java EE Applications" on
page 52.
where
l -cp <classpath> specifies the class path to use for the Kotlin source code.
A class path is the path that the Java runtime environment searches for classes and other resource
files. Include all JAR dependencies normally used to build the project. The format is a colon- or
semicolon-separated list of paths.
Fortify Static Code Analyzer loads classes in the order they appear in the class path. If there are
multiple classes with the same name in the list, Fortify Static Code Analyzer uses the first loaded class.
In the following example, if both A.jar and B.jar include a class called MyData.class, Fortify
Static Code Analyzer uses the MyData.class from A.jar.
Fortify strongly recommends that you avoid using duplicate classes with the -cp option.
For descriptions of all the available Kotlin-specific command-line options, see "Kotlin Command-Line
Options" on the next page.
-cp <paths> | Specifies the class path to use for translating Kotlin source
-classpath <dirs> code, which is a colon- or semicolon-separated list of
directories. You can use Fortify Static Code Analyzer file
specifiers as shown in the following example:
-cp "build/classes:lib/*.jar"
To translate all .kt files in the src directory using all JAR files in the lib directory as a class path, type:
To translate all files in the src directory using Java dependencies from src/java and all JAR files in
the lib directory and subdirectories as a class path, type:
This includes projects that target .NET Framework, .NET Core, and .NET Standard
l ASP.NET applications
This includes applications that make use of the ASP.NET Core framework
l Xamarin applications that target Android and iOS platforms
For the list of supported versions of relevant programming languages and frameworks, as well as Visual
Studio and MSBuild, see the Micro Focus Fortify Software System Requirements document.
This section contains the following topics:
Visual Studio and MSBuild Project Translation Prerequisites 58
Visual Studio and MSBuild Project Translation Command-Line Syntax 59
Handling Special Cases for Translating Visual Studio and MSBuild Projects 59
Alternative Ways to Translate Visual Studio and MSBuild Projects 62
Fortify recommends that each project you translate is complete and that you perform the translation in
an environment where you can build it without errors. A complete project contains the following:
l All necessary source code files (C/C++, C#, or VB.NET)
l All required reference libraries
This includes those from relevant frameworks, NuGet packages, and third-party libraries.
l For C/C++ projects, include all necessary header files that do not belong to the Visual Studio or
MSBuild installation
l For ASP.NET and ASP.NET Core projects, include all the necessary ASP.NET page files
The supported ASP.NET page types are ASPX, ASCX, ASAX, ASHX, ASMX, AXML, Master,
CSHTML, VBHTML, BAML, and XAML.
This command first builds the solution or project and then translates it. Fortify strongly recommends
you run this command from the Developer Command Prompt for Visual Studio to ensure an optimal
environment for the translation.
Important! When you translate from the Developer Command Prompt for Visual Studio
environment, Fortify recommends that you run the dotnet restore command before you run
the Fortify Static Code Analyzer translation. You must run this command from the top-level folder
of the project. This ensures that all required reference libraries are downloaded and installed in the
project.
After the translation is complete, you can perform the analysis phase as shown in the following example:
cmd.exe /k <vs_install_dir>/Common7/Tools/VSDevCmd.bat
Additionally, Fortify recommends that you translate Xamarin projects from the Visual Studio 2019
environment, even if you created the project with a different version of Visual Studio. Using a different
Visual Studio version environment for translation might reduce the quality of the analysis results.
Note: Support of this translation mode is limited and Fortify Static Code Analyzer might not
properly handle all possible combinations of targets and projects.
Important! If you use this translation mode, do not specify a clean target as the last target on the
list. This target removes dependencies that your Visual Studio or MSBuild project requires. This
drastically reduces the translation quality and can negatively impact the analysis results.
(a .NET project with .NET assembly name Sample2). Each project builds a separate executable file,
Sample1.exe and Sample2.exe, respectively.
For more information about the -binary-name option, see "Analysis Options" on page 114.
Note that Fortify Static Code Analyzer converts a devenv invocation to the equivalent MSBuild
invocation, therefore in this case the solution with this command is actually built by MSBuild instead
of the devenv tool.
There are several environment variables that you can set to configure the translation of your project.
Most of them have default values, which Fortify Static Code Analyzer uses if the variable is not set.
These variables are listed in the following table.
Environment
Variable Description Default Value
Important! The chapter describes how to translate C and C++ code that is not a part of a Visual
Studio or MSBuild project. For instructions on translating Visual Studio or MSBuild projects, see
"Translating Visual Studio and MSBuild Projects" on page 58.
where:
l <compiler> is the name of the C/C++ compiler you use, such as gcc, g++, or cl. See the Micro
Focus Fortify Software System Requirements document for a list of supported C/C++ compilers.
l <sca_options> are options passed to Fortify Static Code Analyzer.
The compiler command must successfully complete when executed on its own. If the compiler command
fails, then the Fortify Static Code Analyzer command prefixed to the compiler command also fails.
For example, if you compile a file with the following command:
then you can translate this file with the following command:
Fortify Static Code Analyzer executes the original compiler command as part of the translation phase. In
the previous example, the command produces both the translated source suitable for scanning, and the
object file hello.o from the gcc execution. You can use the Fortify Static Code Analyzer -nc option
to disable the compiler execution.
to:
Re-run the translation to print the errors that the translator encountered. If the output indicates an
incompatibility between your compiler and the Fortify Static Code Analyzer translator, send your
output to Micro Focus Fortify Customer Support for further investigation.
where <js_file_or_dir> is the either the name of the JavaScript file to be translated or a directory
that contains multiple JavaScript files. You can also translate multiple files by specifying *.js for the
<js_file_or_dir>.
Excluding Dependencies
You can avoid translating specific dependencies by adding them to the appropriate property setting in
the fortify-sca.properties file. Files specified in the following properties are not translated:
l com.fortify.sca.skip.libraries.ES6
l com.fortify.sca.skip.libraries.jQuery
l com.fortify.sca.skip.libraries.javascript
l com.fortify.sca.skip.libraries.typescript
Each property specifies a list of comma- or colon-separated file names (without path information).
The files specified in these properties apply to both local files and files on the internet. Suppose, for
example, that the JavaScript code includes the following file reference:
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js">
</script>
Note: You can also exclude local files or entire directories with the -exclude command-line option.
For more information about this option, see "Translation Options" on page 112.
When you set the com.fortify.sca.EnableDOMModeling property to true, this can decrease false
negative reports of DOM-related attacks, such as DOM-related cross-site scripting issues.
Note: If you enable this option, Fortify Static Code Analyzer generates JavaScript code to model
the DOM tree structure in the HTML files. The duration of the analysis phase might increase
(because there is more translated code to analyze).
If you set the com.fortify.sca.EnableDOMModeling property to true, you can also specify
additional HTML tags for Fortify Static Code Analyzer to include in the DOM modeling with the
com.fortify.sca.DOMModeling.tags property. By default, Fortify Static Code Analyzer includes
the following HTML tags: body, button, div, form, iframe, input, head, html, and p.
For example, to include the HTML tags ul and li in the DOM model, use the following command:
Note: You can also set this property globally in the fortify-sca.properties file.
For example, you might have the following statement in your HTML file:
If you are confident that the xyzdomain.com domain is a safe location from which to download files,
then you can include them in the translation phase by adding the following property specification on
the command line:
-Dcom.fortify.sca.JavaScript.src.domain.whitelist="xyzdomain.com/foo"
Note: You can omit the www. prefix from the domain in the property value. For example, if the src
tag in the original HTML file specifies to download files from www.google.com, you can specify
just the google.com domain.
To trust more than one domain, include each domain separated by the vertical bar character (|) as
shown in the following example:
-Dcom.fortify.sca.JavaScript.src.domain.whitelist=
"xyzdomain.com/foo|abcdomain.com|123.456domain.com”
If you are using a proxy server, then you need to include the proxy server information on the command
line as shown in the following example:
-Dhttp.proxyHost=example.proxy.com -Dhttp.proxyPort=8080
For a complete list of proxy server options, see the Networking Properties Java documentation.
/path_1/package_name/subpackageA
/path_2/package_name/subpackageB
com.fortify.sca.limiters.MaxPassthroughChainDepth=8
com.fortify.sca.limiters.MaxChainDepth=8
By default, Fortify Static Code Analyzer attempts to discover Django templates in the project root
folder. Any Django templates found are automatically added to the translation. If you do not want
Fortify Static Code Analyzer to automatically discover Django templates, use the -django-disable-
autodiscover option. If your project requires Django templates, but the project is configured such
that Django templates are in an unexpected location, use the -django-template-dirs option to
specify the directories that contain the templates in addition to the -django-disable-
autodiscover option.
You can specify additional locations of Django template files by adding the -django-template-dirs
option to the sourceanalyzer command:
-django-template-dirs <dirs>
-python-version Specifies the Python source code version you want to scan. The valid
<version> values for <version> are 2 and 3. The default value is 2.
-django-disable- Specifies that Fortify Static Code Analyzer does not automatically
autodiscover discover Django templates.
Equivalent Property Name:
com.fortify.sca.DjangoDisableAutodiscover
For information about translating Xamarin applications, see "Translating Visual Studio and MSBuild
Projects" on page 58.
This section contains the following topics:
Translating Apple iOS Projects 74
Translating Android Projects 75
where <compiler_options> are the supported options that are passed to the Xcode compiler.
Note: Xcodebuild compiles the source code when you run this command.
If your application uses any property list files (for example, <file>.plist), translate these files with a
separate sourceanalyzer command. Use the same build ID that you used to translate the project files.
The following is an example:
If your project uses CocoaPods, include -workspace to build the project. For example:
You can then perform the analysis phase, as shown in the following example:
The way you use Gradle is the same for either method.
Note: You can also scan Android code directly from Android Studio with the Micro Focus Fortify
Analysis Plugin for IntelliJ and Android Studio. For more information, see the Micro Focus Fortify
Plugins for JetBrains IDEs and Android Studio User Guide.
Go Command-Line Syntax
For best results, your project must be compilable and you must have all required dependencies available.
The following entities are excluded from the translation (and the scan):
l Vendor folder
l All projects defined by any go.mod files in subfolders, except the project defined by the go.mod file
under the %PROJECT_ROOT%
l All files with the _test.go suffix (unit tests)
The basic command-line syntax to translate Go code is:
Go Command-Line Options
The following table describes the command-line options that are specific for translating Go code.
Go Option Description
-gopath <path> Specifies the root directory of your project. Make sure that the directory
structure adheres to the Go workspace hierarchy
(https://golang.org/doc/gopath_code.html).
If this option is not specified, then the GOPATH system environment
variable is used.
You must specify the root directory as an absolute path. The following
examples are valid values for <path>:
Go Option Description
/home/projects/go_workspace/my_proj
C:\projects\go_workspace\my_proj
go_workspace/my_proj
-goroot <path> Specifies the location of the Go installation. If this option is not specified,
the GOROOT system environment variable is used.
If this option is not specified and the GOROOT system environment
variable is not set, then Fortify Static Code Analyzer uses the Go compiler
included in the Fortify Static Code Analyzer installation.
Resolving Dependencies
Fortify Static Code Analyzer supports two dependency management systems built-in into Go:
l GOPATH dependency resolution
If you are using a third-party dependency management system such as GoDeps or dep), you must
download all dependencies before you start the translation.
l Modules
Fortify Static Code Analyzer downloads all required dependencies using the native Go toolchain. If
access to the internet is restricted on the machine where you run Fortify Static Code Analyzer, then
do one of the following:
l If you are using an artifact management system such as Artifactory, set the GOPROXY
environment variable.
l Download all required dependencies using modules and vendoring.
where <file> is the name of the Ruby file you want to scan. To include multiple Ruby files, separate
them with a space, as shown in the following example:
In addition to listing individual Ruby files, you can use the asterisk (*) wildcard to select all Ruby files in a
specified directory. For example, to find all of the Ruby files in a directory called src, use the following
sourceanalyzer command:
-ruby-path <dirs> Specifies one or more paths to directories that contain Ruby libraries (see
"Adding Libraries " on the next page)
Equivalent Property Name:
com.fortify.sca.RubyLibraryPaths
-rubygem-path Specifies the path(s) to a RubyGems location (see "Adding Gem Paths" on
<dirs> the next page)
Equivalent Property Name:
com.fortify.sca.RubyGemPaths
Adding Libraries
If your Ruby source code requires a specific library, add the Ruby library to the sourceanalyzer
command. Include all ruby libraries that are installed with ruby gems. For example, if you have a
utils.rb file that resides in the /usr/share/ruby/myPersonalLibrary directory, then add the
following to the sourceanalyzer command:
-ruby-path /usr/share/ruby/myPersonalLibrary
To use multiple libraries, use a delimited list. On Windows, separate the paths with a semicolon; and on
all other platforms use a colon, as in the following non-Windows example:
-ruby-path /path/one:/path/two:/path/three
/home/myUser/gems/ruby-version
This directory contains another directory called gems, which contains directories for all the gem files
installed on the system. For this example, use the following in your command line:
-rubygem-path /home/myUser/gems/ruby-version/gems
If you have multiple gems directories, add them by specifying a delimited list of directories such as:
-rubygem-path /path/to/gems:/another/path/to/more/gems
Important! Supported file extensions for the source code files are: .cls, .trigger, .page, and
.component.
For descriptions of all the Apex- and Visualforce-specific command-line options, see "Apex and
Visualforce Command-Line Options" below.
-apex Directs Fortify Static Code Analyzer to use the Apex and
Visualforce translation for files with the .cls extension.
Without this option, Fortify Static Code Analyzer translates
*.cls files as Visual Basic code.
-apex-sobject-path <path> Specifies the location of the custom sObject JSON file
sobjects.json.
For instructions on how to use the sf_extractor tool, see
"Downloading Customized Salesforce Database Structure
Information" below.
Equivalent Property Name:
com.fortify.sca.ApexObjectPath
The following table describes the contents of the sf_extractor.zip file, which is located in <sca_
install_dir>/Tools.
where:
l <username> is your Salesforce cloud user name. For example, test@test.test.
l <password> is your Salesforce cloud password.
l <security_token> is the 25 alphanumeric character security token
l <org> is y if you are using a sandbox org or n if you are using a production org
The sf_extractor tool uses the credentials to access the Salesforce SOAP API. It downloads all the
sObjects with additional information from the current org, and then it downloads information about
fields in the sObjects. This is required to properly resolve types represented in current org.
This tool produces an sobjects.json file that you provide to Fortify Static Code Analyzer in the
translation command using the -apex-sobject-path option.
The following sections describe the default COBOL code translation. Information that pertains only to
the legacy COBOL translation is indicated as such.
For a list of supported technologies for translating COBOL code, see the Micro Focus Fortify Software
System Requirements document. Fortify Static Code Analyzer does not currently support custom rules
for COBOL applications.
Note: To scan COBOL with Fortify Static Code Analyzer, you must have a specialized Fortify license
specifically for COBOL scanning capabilities. Contact Micro Focus Fortify Customer Support for
more information about scanning COBOL and the required license.
Legacy COBOL Translation: Fortify Static Code Analyzer supports translation of COBOL source
files on the supported platforms and architectures listed in the Micro Focus Fortify Software
System Requirements document.
Before you can analyze a COBOL program, you must copy the following program components to the
Windows system where you run Fortify Static Code Analyzer:
l COBOL source code
Note: Fortify Static Code Analyzer translates COBOL source code files with or without file
extensions.
Legacy COBOL Translation: Fortify Static Code Analyzer translates copybook files with or
without file extensions.
COPY FOO
or
then FOO is the name of a COBOL copybook and the corresponding copybook file has the name
FOO.CPY or FOO.cpy.
Legacy COBOL Translation: Free-format COBOL is the default translation mode. Fortify Static
Code Analyzer supports the translation of fixed-format COBOL. To translate fixed-format COBOL,
you must specify the -fixed-format command-line option. For more information, see "Legacy
COBOL Translation Command-Line Options" on the next page.
-noextension-type COBOL
If you have COBOL source files with an arbitrary extension .xyz, then you must include the following in
the translation command line:
-Dcom.fortify.sca.fileextension.xyz=COBOL
The following example command translates COBOL source code without file extensions:
-cobol-legacy Specifies translation of COBOL code using legacy COBOL translation. This
option is required to enable legacy COBOL translation.
Equivalent Property Name:
com.fortify.sca.CobolLegacy
To translate a file where the source or the php.ini file entry includes a relative path name (starts with
./ or ../), consider setting the PHP source root as shown in the following example:
For more information about the -php-source-root option, see the description in "PHP Command-
Line Options" below.
-php-source-root Specifies an absolute path to the project root directory. The relative path
<path> name first expands from the current directory. If the file is not found, then
the path expands from the specified PHP source root directory.
Equivalent Property Name:
com.fortify.sca.PHPSourceRoot
-php-version Specifies the PHP version. The default version is 7.0. For a list of valid
<version> versions, see the Micro Focus Fortify Software System Requirements.
Equivalent Property Name:
com.fortify.sca.PHPVersion
This final list of names is used with READ REPORT to get code out of the SAP system. This method does
read classes and methods out as well as merely REPORTS, for the record.
Each READ REPORT call produces a file in the temporary folder on the local system. This set of files is
what Fortify Static Code Analyzer translates and scans, producing an FPR file that you can open with
Micro Focus Fortify Audit Workbench.
INCLUDE Processing
As source code is downloaded, the Fortify ABAP Extractor detects INCLUDE statements in the source.
When found, it downloads the include targets to the local machine for analysis.
<sca_install_dir>/Tools/SAP_Extractor.zip
The Fortify ABAP Extractor package, SAP_Extractor.zip, contains the following files:
l K900XXX.S9S (where the “XXX” is the release number)
l R900XXX.S9S (where the “XXX” is the release number)
These files make up the SAP transport request that you must import into your SAP system from
outside your local Transport Domain. Have your SAP administrator or an individual authorized to install
transport requests on the system import the transport request.
The NSP files contain a program, a transaction (YSCA), and the program user interface. After you
import them into your system, you can extract your code from the SAP database and prepare it for
Fortify Static Code Analyzer scanning.
Installation Note
The Fortify ABAP Extractor transport request is supported on a system running SAP release 7.02, SP
level 0006. If you are running a different SAP version and you get the transport request import error:
Install release does not match the current version, then the transport request
installation has failed.
To try to resolve this issue, perform the following steps:
1. Re-run the transport request import.
The Import Transport Request dialog box opens.
2. Click the Options tab.
3. Select the Ignore Invalid Component Version check box.
4. Complete the import procedure.
If this does not resolve the issue or if your system is running on an SAP version with a different table
structure, Fortify recommends that you export your ABAP file structure using your own technology so
that Fortify Static Code Analyzer can scan the ABAP code.
5. Click the Extract ABAP code and launch SCA link to launch the Fortify ABAP Extractor.
3. Provide the Fortify Static Code Analyzer specific information described in the following table.
Field Description
FPR File (Optional) Type or select the directory where you want to store the scan results
Path file (FPR). Include the name for the FPR file in the path name. You must provide
the FPR file path if you want to automatically scan the downloaded code on the
same machine where you are running the extraction process.
Working Type or select the directory where you want to store the extracted source code.
Directory
Build-ID (Optional) Type the build ID for the scan. Fortify Static Code Analyzer uses the
build ID to identify the translated source code, which is necessary to scan the code.
You must specify the build ID if you want to automatically translate the
downloaded code on the same machine where you are running the extraction
Field Description
process.
Translation (Optional) Type any additional Fortify Static Code Analyzer command-line
Parameters translation options. You must specify translation parameters if you want to
automatically translate the downloaded code on the same machine where you are
running the extraction process or you want to customize the translation options.
Scan (Optional) Type any Fortify Static Code Analyzer command-line scan options. You
Parameters must specify scan parameters if you want to scan the downloaded code
automatically on the same machine where you are running the process or you
want to customize the scan options.
ZIP File (Optional) Type a ZIP file name if you want your output in a compressed package.
Name
Field Description
Download Select this check box to have Fortify Static Code Analyzer download the source
code extracted from your SAP database.
Build Select this check box to have Fortify Static Code Analyzer translate all
Field Description
downloaded ABAP code and store it using the specified build ID. This action
requires that you have an installed version of Fortify Static Code Analyzer on
the machine where you are running the Fortify ABAP Extractor. It is often
easier to move the downloaded source code to a predefined Fortify Static Code
Analyzer machine.
Scan Select this check box to have Fortify Static Code Analyzer run a scan of the
specified build ID. This action requires that the translate (build) action was
previously performed. This action requires that you have an installed version of
Fortify Static Code Analyzer on the machine where you are running the Fortify
ABAP Extractor. It is often easier to move the downloaded source code to a
predefined Fortify Static Code Analyzer machine.
Launch AWB Select this check box to start Micro Focus Fortify Audit Workbench and open
the specified FPR file.
Create ZIP Select this check box to compress the output. You can also manually compress
File the output after the source code is extracted from your SAP database.
Export Select this check box to export SAP standard code in addition to custom code.
SAP standard
code
5. Click Execute.
where:
<libs> is a semicolon-separated list (Windows) or a colon-separated list (non-Windows systems) of
library names to which you want to "link" and <files> are the files to translate.
-flex-sdk-root The location of the root of a valid Flex SDK. This folder must contain a
<path> frameworks folder that contains a flex-config.xml file. It must also
contain a bin folder that contains an MXMLC executable.
Equivalent Property Name:
com.fortify.sca.FlexSdkRoot
Note: You can specify SWC or SWF files as Flex libraries (SWZ is not
currently supported).
Note: -flex-sdk-root and –flex-source-roots are primarily for MXML translation, and are
optional if you are scanning pure ActionScript. Use –flex-libraries for resolving all
ActionScript.
Fortify Static Code Analyzer translates MXML files into ActionScript and then runs them through an
ActionScript parser. The generated ActionScript is simple to analyze; not rigorously correct like the Flex
runtime model. As a consequence, you might get parse errors with MXML files. For instance, the XML
parsing could fail, translation to ActionScript could fail, and the parsing of the resulting ActionScript
could also fail. If you see any errors that do not have a clear connection to the original source code,
notify Micro Focus Fortify Customer Support.
This identifies the location of the libraries to include and the Flex SDK and the Flex source root
locations. The single MXML file, located in /my/app/FlexApp.mxml, results in translating the MXML
application as a single ActionScript class called FlexApp and located in the my.app package.
Example 2
The following example is for an application in which the source files are relative to the src directory. It
uses a single SWF library, MyLib.swf, and the Flex and framework libraries from the Flex SDK:
Example 3
In this example, the Flex SDK root and Flex libraries are specified in a properties file because typing in
the data is time consuming and the data is generally constant. Divide the application into two sections
and store them in folders: a main section folder and a modules folder. Each folder contains a src folder
where the paths start. File specifiers contain wild cards to pick up all the .mxml and .as files in both src
folders. An MXML file in main/src/com/foo/util/Foo.mxml is translated as an ActionScript class
named Foo in the package com.foo.util, for example, with the source roots specified here:
ActionScript Warnings
You might receive a message similar to the following:
The ActionScript front end was unable to resolve the following imports:
a.b at y.as:2. foo.bar at somewhere.as:5. a.b at foo.mxml:8.
This error occurs when Fortify Static Code Analyzer cannot find all of the required libraries. You might
need to specify additional SWC or SWF Flex libraries (-flex-libraries option or
com.fortify.sca.FlexLibraries property) so that Fortify Static Code Analyzer can complete the
analysis.
#com.fortify.sca.CfmlUndefinedVariablesAreTainted=true
This instructs the Dataflow Analyzer to watch out for register-globals-style vulnerabilities. However,
enabling this property interferes with Dataflow Analyzer findings in which a variable in an included page
is initialized to a tainted value in an earlier-occurring included page.
where:
l <build_id> specifies the build ID for the project
l <dir> specifies the root directory of the web application
l <files> | <file_specifiers> specifies the CFML source code files
For a description of how to use <file_specifiers>, see "Specifying Files and Directories" on
page 123.
Note: Fortify Static Code Analyzer calculates the relative path to each CFML source file with the
-source-base-dir directory as the starting point. Fortify Static Code Analyzer uses these
relative paths when it generates instance IDs. If you move the entire application source tree to a
different directory, the Fortify Static Code Analyzer- generated instance IDs remain the same if you
specify an appropriate parameter for the -source-base-dir option.
Translating SQL
On Windows platforms, Fortify Static Code Analyzer assumes that files with the .sql extension are T-
SQL rather than PL/SQL. If you have PL/SQL files with the .sql extension on Windows, you must
configure Fortify Static Code Analyzer to treat them as PL/SQL.
To specify the SQL type for translation on Windows platforms, type one of the following translation
commands:
or
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 100 of 216
User Guide
Chapter 15: Translating Other Languages and Configurations
Alternatively, you can change the default behavior for files with the .sql extension. In the fortify-
sca.properties file, set the com.fortify.sca.fileextensions.sql property to TSQL or
PLSQL.
The following example shows how to translate all PL/SQL files in the sources directory:
The following example shows how to translate all T-SQL files in the sources directory:
Important! If your project contains source code other than Scala, you must translate the Scala
code using the Lightbend's Scala translation plugin, and then translate the other source code with
sourceanalyzer using the same build ID before you run the scan phase.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 101 of 216
User Guide
Chapter 15: Translating Other Languages and Configurations
For example, you can have virtual directories named Include and Library that refer to the physical
directories C:\WebServer\CustomerOne\inc and C:\WebServer\CustomerTwo\Stuff,
respectively.
The following example shows the ASP/VBScript code for an application that uses virtual includes:
<!--#include virtual="Include/Task1/foo.inc"-->
For this example, the previous ASP code refers to the file in the following physical location:
C:\Webserver\CustomerOne\inc\Task1\foo.inc
The real directory replaces the virtual directory name Include in this example.
sourceanalyzer -Dcom.fortify.sca.ASPVirtualRoots.<virtual_
directory>=<full_path_to_corresponding_physical_directory>
Note: On Windows, if the physical path includes spaces, you must enclose the property setting in
quotes:
sourceanalyzer "-Dcom.fortify.sca.ASPVirtualRoots.<virtual_
directory>=<full_path_to_corresponding_physical_directory>"
To expand on the example in the previous section, pass the following property value to Fortify Static
Code Analyzer:
-Dcom.fortify.sca.ASPVirtualRoots.Include="C:\WebServer\CustomerOne\inc"
-Dcom.fortify.sca.ASPVirtualRoots.Library="C:\WebServer\CustomerTwo\Stuff"
Fortify Static Code Analyzer determines if the project contains a physical directory named Include. If
there is no such physical directory, Fortify Static Code Analyzer looks through its runtime properties
and finds the -Dcom.fortify.sca.ASPVirtualRoots.Include=
"C:\WebServer\CustomerOne\inc" setting. Fortify Static Code Analyzer then looks for this file:
C:\WebServer\CustomerOne\inc\Task1\foo.inc.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 102 of 216
User Guide
Chapter 15: Translating Other Languages and Configurations
Alternatively, you can set this property in the fortify-sca.properties file located in <sca_
install_dir>\Core\config. You must escape the backslash character (\) in the path of the physical
directory as shown in the following example:
com.fortify.sca.ASPVirtualRoots.Library=C:\\WebServer\\CustomerTwo\\Stuff
com.fortify.sca.ASPVirtualRoots.Include=C:\\WebServer\\CustomerOne\\inc
Note: The previous version of the ASPVirtualRoot property is still valid. You can use it on the
Fortify Static Code Analyzer command line as follows:
-Dcom.fortify.sca.ASPVirtualRoots=C:\WebServer\CustomerTwo\Stuff;
C:\WebServer\CustomerOne\inc
This prompts Fortify Static Code Analyzer to search through the listed directories in the order specified
when it resolves a virtual include directive.
C:\files\foo\bar.asp
-Dcom.fortify.sca.ASPVirtualRoots=C:\files\foo
This strips the /foo from the front of the virtual root. If you do not specify foo in the
com.fortify.sca.ASPVirtualRoots property, then Fortify Static Code Analyzer looks for
C:\files\bar.asp and fails.
The sequence to specify virtual roots is as follows:
1. Remove the first part of the path in the source.
2. Replace the first part of the path with the virtual root as specified on the command line.
Translating Dockerfiles
By default, Fortify Static Code Analyzer translates the following files as Dockerfiles: Dockerfile,
dockerfile, *.Dockerfile, and *.dockerfile.
Note: You can modify the file extension used to detect Dockerfiles using the
com.fortify.sca.fileextensions property. See "fortify-sca.properties" on page 182.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 103 of 216
User Guide
Chapter 15: Translating Other Languages and Configurations
Fortify Static Code Analyzer accepts the following escape characters in Dockerfiles: backslash (\) and
backquote (`). If the escape character is not set in the Dockerfile, then Fortify Static Code Analyzer
assumes that the backslash is the escape character.
The syntax to translate a directory that contains Dockerfiles is shown in the following example:
If the Dockerfile is malformed and Fortify Static Code Analyzer cannot parse the file, an error is written
to the log and analysis of the Dockerfile is skipped. The following is an example of the error written to
the log:
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 104 of 216
Chapter 16: Integrating into a Build
You can integrate the analysis into supported build tools.
This section contains the following topics:
Build Integration 105
Modifying a Build Script to Invoke Fortify Static Code Analyzer 106
Touchless Build Integration 107
Ant Integration 107
Gradle Integration 107
Maven Integration 109
Build Integration
You can translate entire projects in a single operation. Prefix your original build operation with the
sourceanalyzer command followed by the Fortify Static Code Analyzer options.
The basic command-line syntax to translate a complete project is:
where <build_tool> is the name of your build tool, such as make, gmake, msbuild, devenv, or
xcodebuild. See the Micro Focus Fortify Software System Requirements document for a list of
supported build tools. Fortify Static Code Analyzer executes your build tool and intercepts all compiler
operations to collect the specific command line used for each input.
Note: Fortify Static Code Analyzer only processes the compiler commands that the build tool
executes. If you do not clean your project before you execute the build, then Fortify Static Code
Analyzer only processes those files that the build tool re-compiles.
For information about integrating with Xcodebuild, see "iOS Code Analysis Command-Line Syntax" on
page 75. For information about integration with MSBuild, see "Translating Visual Studio and MSBuild
Projects" on page 58.
Successful build integration requires that the build tool:
l Executes a Fortify Static Code Analyzer-supported compiler
l Executes the compiler on the operating system path search, not with a hardcoded path (This
requirement does not apply to xcodebuild integration.)
l Executes the compiler, rather than executing a sub-process that then executes the compiler
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 105 of 216
User Guide
Chapter 16: Integrating into a Build
If you cannot meet these requirements in your environment, see "Modifying a Build Script to Invoke
Fortify Static Code Analyzer" below.
Make Example
If you build your project with the following build commands:
make clean
make
make install
then you can simultaneously translate and compile the entire project with the following commands:
make clean
sourceanalyzer -b <build_id> make
make install
CC=gcc
CXX=g++
LD=ld
AR=ar
You can prepend the tool references in the makefile with the sourceanalyzer command and the
appropriate Fortify Static Code Analyzer options.
When you use the same build ID for each operation, Fortify Static Code Analyzer automatically
combines each of the separately-translated files into a single translated project.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 106 of 216
User Guide
Chapter 16: Integrating into a Build
For example, you might use a python script called build.py to compute dependencies and execute
appropriately-ordered C compiler operations. Then to execute your build, run the following command:
python build.py
Fortify Static Code Analyzer does not have native support for such a build design. However, you can
use the touchless build tool to translate and build the entire project with the single command:
The same requirements for successful build integration with supported build systems described earlier
in this chapter (see "Build Integration" on page 105) apply to touchless integration with unsupported
build systems.
Ant Integration
Fortify Static Code Analyzer provides an easy way to translate Java source files for projects that use an
Ant build file. You can apply this integration on the command line without modifying the Ant
build.xml file. When the build runs, Fortify Static Code Analyzer intercepts all javac task invocations
and translates the Java source files as they are compiled.
Note: You must translate any JSP files, configuration files, or any other non-Java source files that
are part of the application in a separate step.
To use the Ant integration, make sure that the sourceanalyzer executable is on the system PATH.
Prepend your Ant command-line with the sourceanalyzer command as follows:
Gradle Integration
You can translate projects that are built with Gradle without any modification of the build.gradle
file. When the build runs, Fortify Static Code Analyzer translates the source files as they are compiled.
See the Micro Focus Fortify Software System Requirements document for platforms and languages
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 107 of 216
User Guide
Chapter 16: Integrating into a Build
supported specifically for Gradle integration. Any files in the project in unsupported languages for
Gradle integration are not translated (with no error reporting). These files are therefore not analyzed,
and any existing potential vulnerabilities can go undetected.
To integrate Fortify Static Code Analyzer into your Gradle build, make sure that the sourceanalyzer
executable is on the system PATH. Prepend the Gradle command line with the sourceanalyzer
command as follows:
For example:
If your build file name is different than build.gradle, then include the build file name with the --
build-file option as shown in the following example:
You can also use the Gradle Wrapper (gradlew) as shown in the following example:
If your application uses XML or property configuration files, translate these files with a separate
sourceanalyzer command. Use the same build ID that you used for the project files. The following
are examples:
After translating the project with gradle or gradlew, you can then perform the analysis phase as shown
in the following example:
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 108 of 216
User Guide
Chapter 16: Integrating into a Build
rename the build.gradle.orig file back to build.gradle and run sourceanalyzer again without
the -debug option.
Maven Integration
Fortify Static Code Analyzer includes a Maven plugin that provides a way to add the following
capabilities to your Maven project builds:
l Fortify Static Code Analyzer clean, translate, scan
l Fortify Static Code Analyzer export mobile build session (MBS) for a Fortify Static Code Analyzer
translated project
l Send translated code to Micro Focus Fortify ScanCentral SAST
You can use the plugin directly or integrate its functionality into your build process.
or
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 109 of 216
User Guide
Chapter 16: Integrating into a Build
set PATH=%PATH%;<sca_install_dir>/bin
mvn com.fortify.sca.plugins.maven:sca-maven-plugin:<ver>:clean
where <ver> is the version of the Fortify Maven Plugin you are using. If the version is not
specified, Maven uses the latest version of the Fortify Maven Plugin that is installed in the local
repository.
Note: To see the version of the Fortify Maven Plugin, open the pom.xml file that you
extracted in <root_dir> in a text editor. The Fortify Maven Plugin version is specified in the
<version> element.
5. If the command in step 4 completed successfully, then the Fortify Maven Plugin is installed
correctly. The Fortify Maven Plugin is not installed correctly if you get the following error message:
Check the Maven local repository and try to install the Fortify Maven Plugin again.
mvn com.fortify.sca.plugins.maven:sca-maven-plugin:<ver>:translate
To analyze your code this way, see the documentation included with the Fortify Maven Plugin. The
following table describes where to find the documentation after the Fortify Maven Plugin is properly
installed.
Binary <root_dir>/docs/index.html
Source <root_dir>/sca-maven-plugin/target/site/index.html
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 110 of 216
User Guide
Chapter 16: Integrating into a Build
In this method, prepend the maven command used to build your project with the sourceanalyzer
command and any Fortify Static Code Analyzer options. To analyze your files as part of a Fortify
Static Code Analyzer build integration:
a. Clean out the previous build:
For example:
The following additional example includes the Fortify Static Code Analyzer option to exclude
selected files from the analysis. To specify the files you want to exclude, add the -exclude
option to the translate step as shown in the following example:
Note: On Windows, separate the file names with a semicolon; and on all other platforms use
a colon.
See "Command-Line Interface" on page 112 for descriptions of available Fortify Static Code
Analyzer options.
c. Complete the analysis by running the scan as shown in the following example:
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 111 of 216
Chapter 17: Command-Line Interface
This chapter describes general Fortify Static Code Analyzer command-line options and how to specify
source files for analysis. Command-line options that are specific to a language are described in the
chapter for that language.
This section contains the following topics:
Translation Options 112
Analysis Options 114
Output Options 117
Other Options 120
Directives 122
Specifying Files and Directories 123
Translation Options
The following table describes the translation options.
-b <build_id> Specifies the build ID. Fortify Static Code Analyzer uses the build ID to
track which files are compiled and combined as part of a build, and
later, to scan those files.
Equivalent Property Name:
com.fortify.sca.BuildID
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 112 of 216
User Guide
Chapter 17: Command-Line Interface
-exclude Removes files from the list of files to translate. Separate multiple file
<file_specifiers> paths with semicolons (Windows) or colons (non-Windows systems).
See "Specifying Files and Directories" on page 123 for more
information on how to use file specifiers.
For example:
-encoding <encoding_ Specifies the source file encoding type. Fortify Static Code Analyzer
name> enables you to scan a project that contains differently encoded source
files. To work with a multi-encoded project, you must specify the -
encoding option in the translation phase, when Fortify Static Code
Analyzer first reads the source code file. Fortify Static Code Analyzer
remembers this encoding in the build session and propagates it into
the FVDL file.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 113 of 216
User Guide
Chapter 17: Command-Line Interface
-nc When specified before a compiler command line, Fortify Static Code
Analyzer translates the source file but does not run the compiler.
-noextension-type Specifies the file type for source files that have no file extension. The
<file_type> possible values are: ABAP, ACTIONSCRIPT, APEX, APEX_TRIGGER,
ARCHIVE, ASPNET, ASP, ASPX, BITCODE, BYTECODE, CFML,
COBOL, CSHARP, DOCKERFILE, GO, HTML, JAVA, JAVA_
PROPERTIES, JAVASCRIPT, JSP, JSPX, KOTLIN, MSIL, MXML, PHP,
PLSQL, PYTHON, RUBY, RUBY_ERB, SCALA, SWIFT, TLD, SQL,
TSQL, TYPESCRIPT, VB, VB6, VBSCRIPT, VISUAL_FORCE, and XML.
Analysis Options
The following table describes the analysis options.
-scan Causes Fortify Static Code Analyzer to perform analysis for the specified
build ID.
-scan-module Causes Fortify Static Code Analyzer to perform analysis for the specified
build ID as a separate module.
Note: Do not use this option together with the -scan option in the
same sourceanalyzer command.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 114 of 216
User Guide
Chapter 17: Command-Line Interface
-analyzers Specifies the analyzers you want to enable with a colon- or comma-
separated list of analyzers. The valid analyzer names are buffer,
content, configuration, controlflow, dataflow, findbugs,
nullptr, semantic, and structural. You can use this option to
disable analyzers that are not required for your security requirements.
Equivalent Property Name:
com.fortify.sca.DefaultAnalyzers
-p <level> | Scans the project with a scan precision level. Scans with a lower precision
-scan-precision level are performed faster. The valid values are 1 and 2. For more
<level> information, see "Configuring Scan Speed with Speed Dial" on page 146.
Equivalent Property Name:
com.fortify.sca.PrecisionLevel
-quick Scans the project in quick scan mode using the fortify-sca-
quickscan.properties file, providing a less in-depth analysis. By
default, it disables the Buffer Analyzer and the Control Flow Analyzer. In
addition, it applies the Quick View filter set.
Equivalent Property Name:
com.fortify.sca.QuickScanMode
-bin <binary> | Specifies a subset of source files to scan. Only the source files that were
-binary-name linked in the named binary at build time are included in the scan. You can
<binary> use this option multiple times to specify the inclusion of multiple binaries
in the scan.
Equivalent Property Name:
com.fortify.sca.BinaryName
-disable-default- Disables all rules of the specified type in the default Rulepacks. You can
rule-type use this option multiple times to specify multiple rule types.
<type>
The <type> parameter is the XML tag minus the suffix Rule. For
example, use DataflowSource for DataflowSourceRule elements. You
can also specify specific sections of characterization rules, such as
Characterization:Control flow, Characterization:Issue, and
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 115 of 216
User Guide
Chapter 17: Command-Line Interface
Characterization:Generic.
-filter <file> Specifies a results filter file. See "Filtering the Analysis" on page 165 for
more information about this option.
Equivalent Property Name:
com.fortify.sca.FilterFile
-findbugs Enables FindBugs analysis for Java code. You must specify the Java class
directories with the -java-build-dir option, which is described in "Java
Command-Line Options" on page 48.
Equivalent Property Name:
com.fortify.sca.EnableFindbugs
-no-default-issue- Disables rules in default Rulepacks that lead directly to issues. Still loads
rules rules that characterize the behavior of functions.
-no-default-rules Specifies not to load rules from the default Rulepacks. Fortify Static Code
Analyzer processes the Rulepacks for description elements and language
libraries, but processes no rules.
Equivalent Property Name:
com.fortify.sca.NoDefaultRules
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 116 of 216
User Guide
Chapter 17: Command-Line Interface
-project-template Specifies the issue template file to use for the scan. This only affects scans
on the local machine. If you upload the FPR to Micro Focus Fortify
Software Security Center server, it uses the issue template assigned to the
application version.
Equivalent Property Name:
com.fortify.sca.ProjectTemplate
-rules <file> | Specifies a custom Rulepack or directory. You can use this option multiple
<dir> times to specify multiple Rulepack files. If you specify a directory, includes
all of the files in the directory with the .bin and .xml extensions.
Equivalent Property Name:
com.fortify.sca.RulesFile
Output Options
The following table describes the output options.
-f <file> | Specifies the file to which results are written. If you do not specify an
-output-file output file, Fortify Static Code Analyzer writes the output to the terminal.
<file>
Equivalent Property Name:
com.fortify.sca.ResultsFile
-format <format> Controls the output format. Valid options are fpr, fvdl, fvdl.zip,
text, and auto. The default is auto, which selects the output format
based on the file extension of the file provided with the -f option.
The FVDL is an XML file that contains the detailed Fortify Static Code
Analyzer analysis results. This includes vulnerability details, rule
descriptions, code snippets, command-line options used in the scan, and
any scan errors or warnings.
The FPR is a package of the analysis results that includes the FVDL file as
well as additional information such as a copy of the source code used in
the scan, the external metadata, and custom rules (if applicable). Micro
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 117 of 216
User Guide
Chapter 17: Command-Line Interface
Note: If you use result certification, you must specify the fpr format.
See the Micro Focus Fortify Audit Workbench User Guide for
information about result certification.
You can prevent some of the information from being included in the FPR
or FVDL file to improve scan time or output file size. See other options in
this table and see the "fortify-sca.properties" on page 182.
Equivalent Property Name:
com.fortify.sca.Renderer
-append Appends results to the file specified with the -f option. The resulting FPR
contains the issues from the earlier scan as well as issues from the current
scan. The build information and program data (lists of sources and sinks)
sections are also merged. To use this option, the output file format must
be fpr or fvdl. For information on the -format output option, see the
description in this table.
The engine data, which includes Fortify security content information,
command-line options, system properties, warnings, errors, and other
information about the execution of Fortify Static Code Analyzer (as
opposed to information about the program being analyzed), is not
merged. Because engine data is not merged with the -append option,
Fortify does not certify results generated with -append.
If this option is not specified, Fortify Static Code Analyzer adds any new
findings to the FPR file, and labels the older result as previous findings.
In general, only use the -append option when it is not possible to analyze
an entire application at once.
Equivalent Property Name:
com.fortify.sca.OutputAppend
-build-label Specifies the label of the project being scanned. Fortify Static Code
<label> Analyzer does not use this label but includes it in the analysis results.
Equivalent Property Name:
com.fortify.sca.BuildLabel
-build-project Specifies the name of the project being scanned. Fortify Static Code
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 118 of 216
User Guide
Chapter 17: Command-Line Interface
<project> Analyzer does not use the name but includes it in the analysis results.
Equivalent Property Name:
com.fortify.sca.BuildProject
-build-version Specifies the version of the project being scanned. Fortify Static Code
<version> Analyzer does not use the version but includes it in the analysis results.
Equivalent Property Name:
com.fortify.sca.BuildVersion
-fvdl-no- Excludes the Fortify security content descriptions from the analysis results
descriptions file.
Equivalent Property Name:
com.fortify.sca.FVDLDisableDescriptions
-fvdl-no- Excludes the engine data from the analysis results file. The engine data
enginedata includes Fortify security content information, command-line options,
system properties, warnings, errors, and other information about the
execution of Fortify Static Code Analyzer.
Equivalent Property Name:
com.fortify.sca.FVDLDisableEngineData
-fvdl-no-progdata Excludes program data from the analysis results file. This removes the
taint source information from the Functions view in Fortify Audit
Workbench.
Equivalent Property Name:
com.fortify.sca.FVDLDisableProgramData
-fvdl-no-snippets Excludes the code snippets from the analysis results file.
Equivalent Property Name:
com.fortify.sca.FVDLDisableSnippets
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 119 of 216
User Guide
Chapter 17: Command-Line Interface
Other Options
The following table describes other options.
Note: By default, this file uses the JVM system encoding. You can
change the encoding by using the
com.fortify.sca.CmdlineOptionsFileEncoding property
specified in the fortify-sca.properties file. For more
information about this property, see "fortify-sca.properties" on
page 182.
-debug Includes debug information in the Fortify Support log file, which is only
useful for Micro Focus Fortify Customer Support to help troubleshoot.
Equivalent Property Name:
com.fortify.sca.Debug
-debug-verbose This is the same as the -debug option, but it includes more details,
specifically for parse errors.
Equivalent Property Name:
com.fortify.sca.DebugVerbose
-verbose Sends verbose status messages to the console and to the Fortify Support
log file.
Equivalent Property Name:
com.fortify.sca.Verbose
-logfile <file> Specifies the log file that Fortify Static Code Analyzer creates.
Equivalent Property Name:
com.fortify.sca.LogFile
-clobber-log Directs Fortify Static Code Analyzer to overwrite the log file for each run
of sourceanalyzer. Without this option, Fortify Static Code Analyzer
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 120 of 216
User Guide
Chapter 17: Command-Line Interface
-Xmx<size>M | G Specifies the maximum amount of memory Fortify Static Code Analyzer
uses.
Heap sizes between 32 GB and 48 GB are not advised due to internal JVM
implementations. Heap sizes in this range perform worse than at 32 GB.
Heap sizes smaller than 32 GB are optimized by the JVM. If your scan
requires more than 32 GB, then you probably need 64 GB or more. As a
guideline, assuming no other memory intensive processes are running, do
not allocate more than 2/3 of the available memory.
When you specify this option, make sure that you do not allocate more
memory than is physically available, because this degrades performance.
As a guideline, and the assumption that no other memory intensive
processes are running, do not allocate more than 2/3 of the available
memory.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 121 of 216
User Guide
Chapter 17: Command-Line Interface
Directives
Use the following directives to list information about previous translation commands. Use only one
directive at a time and do not use any directive in conjunction with normal translation or analysis
commands.
Directive Description
-clean Deletes all Fortify Static Code Analyzer intermediate files and build
records. If a build ID is specified, only files and build records relating to
that build ID are deleted.
-show-binaries Displays all objects that were created but not used in the production of
any other binaries. If fully integrated into the build, it lists all of the
binaries produced.
-show-build-tree When you scan with the -bin option, displays all files used to create the
binary and all files used to create those files in a tree layout. If the -bin
option is not present, the tree is displayed for each binary.
-show-build- Use with -b <build_id> to show any errors and warnings that occurred
warnings in the translation phase on the console.
-show-files Lists the files in the specified build ID. When the -bin option is present,
displays only the source files that went into the binary.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 122 of 216
User Guide
Chapter 17: Command-Line Interface
<files> | <file_dir_specifiers>
<dir> Matches all files in the named directory and any subdirectories
or the named directory when used for a directory parameter.
<dir>/**/*
<dir>/*.java Matches any file with the specified extension found in the
named directory.
<dir>/*.jar
<dir>/**/*.kt Matches any file with the specified extension found in the
named directory or any subdirectories.
<dir>/**/*.jar
<dir>/**/beta/** Matches all directories and files found in the named directory
that have beta in the path, including beta as a file name.
<dir>/**/classes/ Matches all directories and files with the name classes found
in the named directory and any subdirectories.
**/test/** Matches all files in the current directory tree that have a test
element in the path, including test as a file name.
l /src/main/java/org/owasp/webgoat
l /test/java/org/owasp/webgoat
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 123 of 216
User Guide
Chapter 17: Command-Line Interface
Note: Windows and many Linux shells automatically expand parameters that contain the asterisk
character (*), so you must enclose file-specifier expressions in quotes. Also, on Windows, you can
use the backslash character (\) as the directory separator instead of the forward slash (/).
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 124 of 216
Chapter 18: Command-Line Utilities
This section contains the following topics:
Fortify Static Code Analyzer Utilities 125
About Updating Security Content 126
Working with FPR Files from the Command Line 128
Generating Reports from the Command Line 135
Checking the Fortify Static Code Analyzer Scan Status 139
Note: By default, log files for most of the utilities are written to the following directory:
l On Windows: C:\Users\<username>\AppData\Local\Fortify\<utility_name>-
<version>\log
l On Linux and macOS: <userhome>/.fortify/<utility_name>-<version>\log
More
Utility Description Information
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 125 of 216
User Guide
Chapter 18: Command-Line Utilities
More
Utility Description Information
BIRTReportGenerator Generates BIRT reports and legacy reports from FPR files "Generating
Reports from
ReportGenerator
the Command
Line" on
page 135
scapostinstall After you install Fortify Static Code Analyzer, this utility "Running the
enables you to migrate properties files from a previous Post-Install
version of Fortify Static Code Analyzer, specify a locale, Tool" on
and specify a proxy server for security content updates and page 38
for Fortify Software Security Center.
SCAState Provides state analysis information on the JVM during the "Checking the
scan phase Fortify Static
Code
Analyzer Scan
Status" on
page 139
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 126 of 216
User Guide
Chapter 18: Command-Line Utilities
fortifyupdate [<options>]
-import <file>.zip Imports the ZIP file that contains archived security
content. Rulepacks are extracted to the <sca_
install_dir>/Core/config/rules directory.
-locale <locale> Specifies a locale. The default is the value set for the
locale property in the fortify.properties
configuration file.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 127 of 216
User Guide
Chapter 18: Command-Line Utilities
-acceptKey Accept the public key. When this is specified, you are not
prompted to provide a public key. Use this option to
accept the public key if you are updating from a non-
standard location (that you specify with the -url
option).
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 128 of 216
User Guide
Chapter 18: Command-Line Utilities
-project <primary>.fpr Specifies the primary FPR file to merge. Conflicts are resolved using
the values in this file.
-source <secondary>.fpr Specifies the secondary FPR file to merge. The primary project
overrides values if conflicts exist.
-f <output>.fpr Specifies the name of the merged output file. This file is the result
of the merged files.
Note: When you specify this option, neither of the original FPR
files are modified. If you do not use this option, the primary
FPR is overwritten with the merged results.
-forceMigration Forces the migration, even if the engine and the Rulepack versions
of the two projects are the same.
-useSourceIssueTemplate Specifies to use the filter sets and folders from the issue template in
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 129 of 216
User Guide
Chapter 18: Command-Line Utilities
Windows example:
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 130 of 216
User Guide
Chapter 18: Command-Line Utilities
l Obtain the number of issues for each analyzer, vulnerability category, or custom grouping
l Obtain lists of issues (including some basic information). You can filter these lists.
Note: By default, the result does not include suppressed and removed issues. To include
suppressed or removed issues, use the -includeSuppressed or -includeRemoved options.
To display information for issues in CSV format:
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 131 of 216
User Guide
Chapter 18: Command-Line Utilities
-versions
-functionsMeta The -mappings option displays the migration
-categoryIssueCounts mappings report.
-analyzerIssueCounts
-search -query <search_expression> The -errors option displays a full error report for the
-search -queryAll FPR.
-project <project>.fpr Specifies the FPR from which to extract the results
information.
-outputformat <format> Specifies the output format. The valid values are TEXT
and CSV. The default value is TEXT.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 132 of 216
User Guide
Chapter 18: Command-Line Utilities
<sink_filename>:<line_num> or
<sink_filename>:<line_num> (<category>
| <analyzer>)
"<instanceid>", "<category>",
"<sink_filename>:<line_num>",
"<analyzer>"
1 The project is signed, and some, but not all, of the signatures passed the validity test.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 133 of 216
User Guide
Chapter 18: Command-Line Utilities
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 134 of 216
User Guide
Chapter 18: Command-Line Utilities
-source <old_source_archive>.fsa Specifies the name of the existing archive. Use only if
you are merging an FPR file with an existing archive (-
mergeArchive option).
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 135 of 216
User Guide
Chapter 18: Command-Line Utilities
l ReportGenerator—Generates legacy reports from FPR files. You can specify a report template,
otherwise a default report template is used. See the Micro Focus Fortify Audit Workbench User
Guide for a description of the available report templates.
The following is an example of how to generate an OWASP Top 10 2017 report with additional options:
-template <template_name> (Required) Specifies the report template name. The valid
values for <template_name> are "CWE Top 25 2019",
"CWE/SANS Top 25", "Developer Workbook", "DISA
CCI 2", "DISA STIG", "FISMA Compliance", GDPR,
MISRA, "OWASP ASVS 4.0", "OWASP Mobile Top 10",
"OWASP Top 10", "PCI DSS Compliance" and
"PCI SSF Compliance".
-format pdf | doc | html | xls (Required) Specifies the generated report format.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 136 of 216
User Guide
Chapter 18: Command-Line Utilities
-output <report_file.***> (Required) Specifies the file to which the report is written.
-searchQuery audited:false
-filterSet <filterset_name> Specifies a filter set to use to generate the report (for
example, -filterSet "Quick View").
--Version <version> Specifies the version for the template. The valid values for
the template versions are listed below.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 137 of 216
User Guide
Chapter 18: Command-Line Utilities
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 138 of 216
User Guide
Chapter 18: Command-Line Utilities
-source <audited_proj>.fpr (Required) Specifies the audited project on which to base the
report.
-filterSet <filterset_ Specifies a filter set to use to generate the report (for example,
name> -filterset "Quick View").
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 139 of 216
User Guide
Chapter 18: Command-Line Utilities
SCAState [<options>]
-hd <filename> | Specifies the file to which the heap dump is written. The file is
--heap-dump <filename> interpreted relative to the remote scan’s working directory; this is not
necessarily the same directory where you are running SCAState.
-liveprogress Displays the ongoing status of a running scan. This is the default. If
possible, this information is displayed in a separate terminal window.
-nogui Causes the Fortify Static Code Analyzer state information to display
in the current terminal window instead of in a separate window.
-pi | Displays information about the source code being scanned, including
--program-info how many source files and functions it contains.
-pid <process_id> Specifies the currently running Fortify Static Code Analyzer process
ID. Use this option if there are multiple Fortify Static Code Analyzer
processes running simultaneously.
To obtain the process ID on Windows systems:
1. Open a command window.
2. Type tasklist at the command prompt.
A list of processes is displayed.
3. Find the java.exe process in the list and note its PID.
To find the process ID on Linux systems:
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 140 of 216
User Guide
Chapter 18: Command-Line Utilities
-scaversion Displays the Fortify Static Code Analyzer version number for the
sourceanalyzer that is currently running.
-timers Displays information from the timers and counters that are
instrumented in Fortify Static Code Analyzer.
Note: Fortify Static Code Analyzer writes Java process information to the location of the TMP
system environment variable. On Windows systems, the TMP system environment variable location
is C:\Users\<userID>\AppData\Local\Temp. If you change this TMP system environment
variable to point to a different location, SCAState cannot locate the sourceanalyzer Java
process and does not return the expected results. To resolve this issue, change the TMP system
environment variable to match the new TMP location. Fortify recommends that you run SCAState
as an administrator on Windows.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 141 of 216
Chapter 19: Improving Performance
This chapter provides guidelines and tips to optimize memory usage and performance when analyzing
different types of codebases with Fortify Static Code Analyzer.
This section contains the following topics:
Hardware Considerations 142
Sample Scans 143
Tuning Options 144
Quick Scan 145
Configuring Scan Speed with Speed Dial 146
Breaking Down Codebases 147
Limiting Analyzers and Languages 148
Optimizing FPR Files 149
Monitoring Long Running Scans 153
Hardware Considerations
The variety of source code makes accurate predictions of memory usage and scan times impossible. The
factors that affect memory usage and performance consists of many different factors including:
l Code type
l Codebase size and complexity
l Number of vulnerabilities
Fortify developed the following set of "best guess" hardware recommendations based on real-world
application scan results. The following table lists these recommendations based on the complexity of the
application. In general, increasing the number of available cores might improve scan times.
Application RAM
Complexity CPU Cores (GB) Description
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 142 of 216
User Guide
Chapter 19: Improving Performance
Application RAM
Complexity CPU Cores (GB) Description
Very Complex 32 256 A system that delivers content such as an application server,
database server, or content management system.
Note: TypeScript and JavaScript scans increase the analysis time significantly. If the total lines of
code in an application consist of more than 20% TypeScript or JavaScript, use the next highest
recommendation.
The Micro Focus Fortify Software System Requirements document describes the system requirements.
However, for large and complex applications, Fortify Static Code Analyzer requires more capable
hardware. This includes:
l Disk I/O—Fortify Static Code Analyzer is I/O intensive and therefore the faster the hard drive, the
more savings on the I/O transactions. Fortify recommends a 7,200 RPM drive, although a 10,000
RPM drive (such as the WD Raptor) or an SSD drive is better.
l Memory—See "Memory Tuning" on page 157 for more information about how to determine the
amount of memory required for optimal performance.
l CPU—Fortify recommends a 2.1 GHz or faster processor.
Sample Scans
These sample scans were performed using Fortify Static Code Analyzer version 20.2.0 on dedicated
virtual machines. These scans were run using Micro Focus Fortify Software Security Content 2020
Update 3. The following table shows the scan times you can expect for several common open-source
projects.
nasm 0.98.38 C/C++ 00:27 06:01 1,254 12,074 Linux VM with 4 CPUs and
32 GB of RAM
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 143 of 216
User Guide
Chapter 19: Improving Performance
WebGoat 7.0.1 Java 00:16 00:51 421 3,628 Linux VM with 8 CPUs and
32 GB of RAM
WordPress Java 00:17 01:29 665 10,055
Hackademic-next JavaScript 01:29 04:07 453 43,838 Linux VM with 8 CPUs and
32 GB of RAM
prisma TypeScript 00:57 02:39 52 22,911
Tuning Options
Fortify Static Code Analyzer can take a long time to process complex projects. The time is spent in
different phases:
l Translation
l Analysis
Fortify Static Code Analyzer can produce large analysis result files (FPRs), which can cause a long time
to audit and upload to Micro Focus Fortify Software Security Center. This is referred to as the following
phase:
l Audit/Upload
The following table lists tips on how to improve performance in the different time-consuming phases.
Analysis -quick Run a quick scan "Quick Scan" on the next page
Analysis -scan- Set the scan precision "Configuring Scan Speed with
precision Speed Dial" on page 146
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 144 of 216
User Guide
Chapter 19: Improving Performance
Analysis -Xmx<size>M | G Set maximum heap size "Memory Tuning" on page 157
Analysis -Xss<size>M | G Set stack size for each "Memory Tuning" on page 157
thread
Analysis -filter <file> Apply a filter using a "Filter Files" on page 149
filter file
Audit/Upload
Analysis -disable- Exclude source files from "Excluding Source Code from the
source- the FPR file FPR" on page 150
Audit/Upload bundling
Quick Scan
Quick scan mode provides a way to quickly scan your projects for critical- and high-priority issues.
Fortify Static Code Analyzer performs the scan faster by reducing the depth of the and applying the
Quick View filter set. Quick scan settings are configurable. For more details about the configuration of
quick scan mode, see "fortify-sca-quickscan.properties" on page 211.
Quick scans are a great way to get many applications through an assessment so that you can quickly
find issues and begin remediation. The performance improvement you get depends on the complexity
and size of the application. Although the scan is faster than a full scan, it does not provide as robust a
result set. Fortify recommends that you run full scans whenever possible.
Limiters
The depth of the Fortify Static Code Analyzer analysis sometimes depends on the available resources.
Fortify Static Code Analyzer uses a complexity metric to trade off these resources with the number of
vulnerabilities that it can find. Sometimes, this means giving up on a particular function when it does not
look like Fortify Static Code Analyzer has enough resources available.
Fortify Static Code Analyzer enables the user to control the “cutoff” point by using Fortify Static Code
Analyzer limiter properties. The different analyzers have different limiters. You can run a predefined set
of these limiters using a quick scan. See the "fortify-sca-quickscan.properties" on page 211 for
descriptions of the limiters.
To enable quick scan mode, use the -quick option with -scan option. With quick scan mode enabled,
Fortify Static Code Analyzer applies the properties from the <sca_install_
dir>/Core/config/fortify-sca-quickscan.properties file, in addition to the standard
<sca_install_dir>/Core/config/fortify-sca.properties file. You can adjust the limiters
that Fortify Static Code Analyzer uses by editing the fortify-sca-quickscan.properties file. If
you modify fortify-sca.properties, it also affects quick scan behavior. Fortify recommends that
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 145 of 216
User Guide
Chapter 19: Improving Performance
you do performance tuning in quick scan mode, and leave the full scan in the default settings to
produce a highly accurate scan. For description of the quick scan mode properties, see "Fortify Static
Code Analyzer Properties Files" on page 180.
Important! As this feature is a technology preview, be aware that if you modify the configuration
files they might be overwritten with an upgrade of Fortify Static Code Analyzer.
Notes:
l By default, Micro Focus Fortify Software Security Center blocks uploaded scans performed with
a precision level. However, you can configure your Fortify Software Security Center application
version so that uploaded audit projects scanned with these precision levels are processed.
l If you merge a speed dial scan with a full scan, this might remove issues from previous scans that
still exist in your application (and would be detected again with a full scan).
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 146 of 216
User Guide
Chapter 19: Improving Performance
To specify the speed dial setting for a scan, include the -scan-precision (or -p) option in the scan
phase as shown in the following example:
Note: You cannot use the speed dial setting and the -quick option in the same scan command.
The following table describes the two precision levels.
Precision
Level Description
1 This is the quickest scan and is recommended if you are scanning a few files. By default, a
scan with this precision level disables the Buffer Analyzer, Control Flow Analyzer,
Dataflow Analyzer, and Null Pointer Analyzer.
2 By default, a scan with this precision level enables all analyzers. The scan runs quicker by
performing with reduced limiters. This results in fewer issues detected.
You can also specify the scan precision level with the com.fortify.sca.PrecisionLevel property
in the fortify-sca.properties file. For example:
com.fortify.sca.PrecisionLevel=1
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 147 of 216
User Guide
Chapter 19: Improving Performance
The following table lists some useful Fortify Static Code Analyzer command-line options to break down
codebases.
Option Description
-bin <binary> Specifies a subset of source files to scan. Only the source files that were
linked in the named binary at build time are included in the scan. You can
use this option multiple times to specify the inclusion of multiple binaries
in the scan.
-show-binaries Displays all objects that were created but not used in the production of
any other binaries. If fully integrated into the build, it lists all of the
binaries produced.
-show-build-tree When used with the -bin option, displays all files used to create the
binary and all files used to create those files in a tree layout. If the -bin
option is not present, Fortify Static Code Analyzer displays the tree for
each binary.
Disabling Analyzers
To disable specific analyzers, include the -analyzers option to Fortify Static Code Analyzer at scan
time with a colon- or comma-separated list of analyzers you want to enable. The full list of analyzers is:
buffer, content, configuration, controlflow, dataflow, findbugs, nullptr, semantic, and
structural.
For example, to run a scan that only includes the Dataflow, Control Flow, and Buffer analyzers, use the
following scan command:
You can also do the same thing by setting com.fortify.sca.DefaultAnalyzers in the Fortify
Static Code Analyzer property file <sca_install_dir>/Core/config/fortify-
sca.properties. For example, to achieve the equivalent of the previous scan command, set the
following in the properties file:
com.fortify.sca.DefaultAnalyzers=dataflow:controlflow:buffer
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 148 of 216
User Guide
Chapter 19: Improving Performance
Disabling Languages
To disable specific languages, include the -disable-language option in the translation phase, which
specifies a list of languages that you want to exclude. The full list of valid language parameters is:
For example, to perform a translation that excludes SQL and PHP files, use the following command:
com.fortify.sca.DISabledLanguages=sql:php
Filter Files
Filter files are flat files that you can specify with a scan using the -filter option. Use a filter file to filter
out particular vulnerability instances, rules, and vulnerability categories. If you determine that a certain
issue category or rule is not relevant for a particular scan, you can stop Fortify Static Code Analyzer
from flagging these types of issues and adding them to the FPR. Using a filter file can reduce both the
scan time and results file size.
For example, if you are scanning a simple program that just reads a specified file, you might not want to
see path manipulation issues, because these are likely planned as part of the functionality. To filter out
path manipulation issues, create a file that contains a single line:
Path Manipulation
Save this file as filter.txt. Use the -filter option for the scan as shown in the following example:
The myresults.fpr does not include any issues with the category Path Manipulation.
For more information about filter files, see "Filtering the Analysis" on page 165.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 149 of 216
User Guide
Chapter 19: Improving Performance
This filter looks through the issues and if an issue does not map to an OWASP Top 10 2017
category with ‘A’ in the name, then it hides it. Because all OWASP Top 10 2017 categories start
with ‘A’ (A1, A2, …, A10), then any category without the letter ‘A’ is not in the OWASP Top 10
2017. The filter hides the issues from view in Fortify Audit Workbench, but they are still in the FPR.
2. In Fortify Audit Workbench, create a new filter set called OWASP_Filter_Set that contains the
previous filter, and then export the issue template to a file called IssueTemplate.xml.
3. You can then specify this filter at scan-time with the following command:
In the previous example, the inclusion of the -Dcom.fortify.sca.FilterSet property tells Fortify
Static Code Analyzer to use the OWASP_Filter_Set filter set from the issue template
IssueTemplate.xml. Any filters that hide issues from view are removed and are not written to the
FPR. Therefore, you can reduce the visible number of issues, make the scan very targeted, and reduce
the size of the resulting FPR file.
Note: Although filtering issues with a filter set can reduce the size of the FPR, they do not usually
reduce the scan time. Fortify Static Code Analyzer examines the filter set after it calculates the
issues to determine whether to write them to the FPR file. The filters in a filter set determine the
rule types that Fortify Static Code Analyzer loads.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 150 of 216
User Guide
Chapter 19: Improving Performance
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 151 of 216
User Guide
Chapter 19: Improving Performance
Command-Line Option:
-fvdl-no-descriptions
com.fortify.sca. This excludes the program data from the FPR. This
FVDLDisableProgramData removes the Taint Sources information from the
=true Functions view in Fortify Audit Workbench. This
Command-Line Option: property typically only has a minimal effect on the
-fvdl-no-progdata overall size of the FPR file.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 152 of 216
User Guide
Chapter 19: Improving Performance
com.fortify.model.
IssueCutOffStartIndex=0
com.fortify.model.
IssueCutOffEndIndex=101
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 153 of 216
User Guide
Chapter 19: Improving Performance
Note: These are third-party tools and Micro Focus does not provide or support them.
Using JConsole
JConsole is an interactive monitoring tool that complies with the JMX specification. The disadvantage of
JConsole is that you cannot save the output.
To use JConsole, you must first set some additional JVM parameters. Set the following environment
variable:
export SCA_VM_OPTS="-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=9090
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false"
After the JMX parameters are set, start a Fortify Static Code Analyzer scan. During the scan, start
JConsole to monitor Fortify Static Code Analyzer locally or remotely with the following command:
jconsole <host_name>:9090
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 154 of 216
User Guide
Chapter 19: Improving Performance
After the JVM parameters are set, start the scan. You can then start Java VisualVM to monitor the scan
either locally or remotely with the following command:
jvisualvm <host_name>:9090
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 155 of 216
Chapter 20: Troubleshooting
This section contains the following topics:
Exit Codes 156
Memory Tuning 157
Scanning Complex Functions 159
Issue Non-Determinism 161
Accessing Log Files 162
Configuring Log Files 162
Reporting Issues and Requesting Enhancements 164
Exit Codes
The following table describes the possible Fortify Static Code Analyzer exit codes.
Exit
Code Description
0 Success
1 Generic failure
4 Analysis completed with numbered warning messages written to the console and/or to the
log file
5 Analysis completed with numbered error messages written to the console and/or to the log
file
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 156 of 216
User Guide
Chapter 20: Troubleshooting
You can extend the default exit code options by setting the com.fortify.sca.ExitCodeLevel
property in the <sca_install_dir>/Core/Config/fortify-sca.properties file.
The valid values are:
l nothing—Returns exit codes 0, 1, 2, or 3. This is the default setting.
l warnings—Returns exit codes 0, 1, 2, 3, 4, or 5.
l errors—Returns exit codes 0, 1, 2, 3, or 5.
l no_output_file—Returns exit codes 0, 1, 2, 3, or 6.
Memory Tuning
The amount of physical RAM required for a scan depends on the complexity of the code. By default,
Fortify Static Code Analyzer automatically allocates the memory it uses based on the physical memory
available on the system. This is generally sufficient. As described in "Output Options" on page 117, you
can adjust the Java heap size with the -Xmx command-line option.
This section describes suggestions for what you can do if you encounter OutOfMemory errors during
the analysis.
Note: You can set the memory allocation options discussed in this section to run for all scans by
setting the SCA_VM_OPTS environment variable.
Resolution
To resolve a Java heap exhaustion problem, allocate more heap space to the Fortify Static Code
Analyzer Java virtual machine when you start the scan. To increase the heap size, use the -Xmx
command-line option when you run the Fortify Static Code Analyzer scan. For example, -Xmx1G makes
1 GB available. Before you use this parameter, determine the maximum allowable value for Java heap
space. The maximum value depends on the available physical memory.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 157 of 216
User Guide
Chapter 20: Troubleshooting
Heap sizes between 32 GB and 48 GB are not advised due to internal JVM implementations. Heap sizes
in this range perform worse than at 32 GB. Heap sizes smaller than 32 GB are optimized by the JVM. If
your scan requires more than 32 GB, then you probably need 64 GB or more. As a guideline, assuming
no other memory intensive processes are running, do not allocate more than 2/3 of the available
memory.
If the system is dedicated to running Fortify Static Code Analyzer, you do not need to change it.
However, if the system resources are shared with other memory-intensive processes, subtract an
allowance for those other processes.
Note: You do not need to account for other resident but not active processes (while Fortify Static
Code Analyzer is running) that the operating system might swap to disk. Allocating more physical
memory to Fortify Static Code Analyzer than is available in the environment might cause
“thrashing,” which typically slows down the scan along with everything else on the system.
Because this is a fatal Java virtual machine error, it is usually accompanied by an error log created in the
working directory with the file name hs_err_pidNNN.log.
Resolution
Because the problem is a result of overcrowding within the process, the resolution is to reduce the
amount of memory used for the Java memory regions (Java heap). Reducing this value should reduce
the crowding problem and allow the scan to complete successfully.
Stack Overflow
Each thread in a Java application has its own stack. The stack holds return addresses, function/method
call arguments, and so on. If a thread tends to process large structures with recursive algorithms, it
might need a large stack for all those return addresses. With the JVM, you can set that size with the -
Xss option.
Symptoms
This message typically appears in the Fortify Static Code Analyzer log file, but might also appear in the
command-line output:
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 158 of 216
User Guide
Chapter 20: Troubleshooting
java.lang.StackOverflowError
Resolution
The default stack size is 16 MB. To increase the stack size, pass the -Xss option to the
sourceanalyzer command. For example, -Xss32M increases the stack to 32 MB.
Function <name> is too complex for <analyzer> analysis and will be skipped
(<identifier>)
where:
l <name> is the name of the source code function
l <analyzer> is the name of the analyzer
l <identifier> is the type of complexity, which is one of the following:
l l: Too many distinct locations
l m: Out of memory
l s: Stack size too small
l t: Analysis taking too much time
l v: Function visits exceed the limit
The depth of analysis Fortify Static Code Analyzer performs sometimes depends on the available
resources. Fortify Static Code Analyzer uses a complexity metric to tradeoff these resources against the
number of vulnerabilities that it can find. Sometimes, this means giving up on a particular function when
Fortify Static Code Analyzer does not have enough resources available. This is normally when you see
the "Function too complex" messages.
When you see this message, it does not necessarily mean that Fortify Static Code Analyzer completely
ignored the function in the program. For example, the Dataflow Analyzer typically visits a function
many times before completing the analysis, and might not have run into this complexity limit in the
previous visits. In this case, the results include anything learned from the previous visits.
You can control the "give up" point using Fortify Static Code Analyzer properties called limiters.
Different analyzers have different limiters.
The following sections provide a discussion of a resolution for this issue.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 159 of 216
User Guide
Chapter 20: Troubleshooting
com.fortify.sca. 1000
limiters.MaxTaintDefForVar
com.fortify.sca. 4000
limiters.MaxTaintDefForVarAbort
com.fortify.sca. 4
limiters.MaxFieldDepth
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 160 of 216
User Guide
Chapter 20: Troubleshooting
Default
Property Name Description Value
com.fortify.sca. Sets the time limit (in milliseconds) for Control Flow 600000
CtrlflowMaxFunctionTime analysis on a single function. (10 minutes)
com.fortify.sca. Sets the time limit (in milliseconds) for Null Pointer 300000
NullPtrMaxFunctionTime analysis on a single function. (5 minutes)
To resolve the complexity identifier of m, increase the physical memory for Fortify Static Code Analyzer.
Note: If you increase these limiters or time settings, it makes the analysis of complex functions take
longer. It is difficult to characterize the exact performance implications of a particular value for the
limiters/time, because it depends on the specific function in question. If you never want to see the
"Function too complex" warning, you can set the limiters/time to an extremely high value, however it
can cause unacceptable scan time.
Issue Non-Determinism
Running in parallel analysis mode might introduce issue non-determinism. If you experience any
problems, contact Micro Focus Fortify Customer Support and disable parallel analysis mode. Disabling
parallel analysis mode results in sequential analysis, which can be substantially slower but provides
deterministic results across multiple scans.
To disable parallel analysis mode:
1. Open the fortify-sca.properties file located in the <sca_install_dir>/core/config
directory in a text editor.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 161 of 216
User Guide
Chapter 20: Troubleshooting
com.fortify.sca.MultithreadedAnalysis=false
where <version> is the version of Fortify Static Code Analyzer that you are using.
The following table describes the two log files.
If you encounter warnings or errors that you cannot resolve, provide the Fortify Support log file to
Micro Focus Fortify Customer Support.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 162 of 216
User Guide
Chapter 20: Troubleshooting
Log
Level Description
DEBUG Includes information that could be used by Micro Focus Fortify Customer Support or the
development team to troubleshoot an issue
WARN Information about issues where the translation or scan did not stop, but might require
your attention for accurate results
FATAL Information about an error that caused the translation or scan to abort
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 163 of 216
User Guide
Chapter 20: Troubleshooting
sourceanalyzer -version
l Platform: (for example, Red Hat Enterprise Linux <version>)
l Operating system: (such as Linux)
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 164 of 216
Appendix A: Filtering the Analysis
This section contains the following topics:
Filter Files 165
Filter File Example 165
Filter Files
You can create a file to filter out particular vulnerability instances, rules, and vulnerability categories
when you run the sourceanalyzer command. You specify the file with the -filter analysis option.
Note: Fortify recommends that you only use filter files if you are an advanced user. Do not use
filter files for standard audits, because auditors typically want to see and evaluate all issues that
Fortify Static Code Analyzer finds.
A filter file is a text file that you can create with any text editor. You specify only the filter items that you
do not want in this file. Each filter item is on a separate line in the filter file. You can specify the following
filter types:
l Category
l Instance ID
l Rule ID
The filters are applied at different times in the analysis process, based on the type of filter. Fortify Static
Code Analyzer applies category and rule ID filters in the initialization phase before any analysis has
taken place, whereas an instance ID filter is applied after the analysis phase.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 165 of 216
User Guide
Appendix A: Filtering the Analysis
The following is example filter file content that performs the following:
l Remove all results related to the J2EE Bad Practice category
l Remove the Path Manipulation based on its instance ID
l Remove any dataflow issues that were generated from a specific rule ID
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 166 of 216
User Guide
Appendix A: Filtering the Analysis
To test the filtered output, copy the above text and paste it into a file with the name test_
filter.txt.
To apply the filtering in the test_filter.txt file, execute the following command:
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 167 of 216
Appendix B: Fortify Scan Wizard
This section contains the following topics:
Preparing to use the Fortify Scan Wizard 168
Starting the Fortify Scan Wizard 169
Note: If you generate a script on a Windows system, you cannot run that script on a non-Windows
system. Likewise, if you generate a script on a non-Windows system, you cannot run it on a
Windows system.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 168 of 216
User Guide
Appendix B: Fortify Scan Wizard
l To scan Java code, the version of the Java JDK used to develop the code
l To use Fortify ScanCentral SAST to scan your code, the ScanCentral Controller URL
To upload your scan results to Fortify Software Security Center, you also need:
l The Fortify Software Security Center server URL
l Your Fortify Software Security Center login credentials
l An upload authentication token
Note: If you do not have an upload token, you can use the Fortify Scan Wizard to generate one.
To do this, you must have Fortify Software Security Center login credentials.
If you do not have Fortify Software Security Center login credentials, you must have the following:
l Application name
l Application version name
Note: Fortify Scan Wizard uses a default scan memory setting of 90% of the total available memory
if it is greater than 4 GB, otherwise the default memory setting is 2/3 the total available memory.
Adjust the scan memory as necessary in the Translation and Scan step.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 169 of 216
Appendix C: Sample Projects
The Fortify SCA and Applications installation might include several code samples that you can use to
when learning to use Fortify Static Code Analyzer. If you installed the sample files, they are in the
following directory:
<sca_install_dir>/Samples
The Samples directory contains two subdirectories: basic and advanced. Each code sample includes a
README.txt file that provides instructions on how to scan the code with Fortify Static Code Analyzer
and view the results in Micro Focus Fortify Audit Workbench.
The basic subdirectory includes an assortment of simple language-specific code samples. The
advanced subdirectory includes more advanced samples including source code to help you integrate
Fortify Static Code Analyzer with your bug tracker application. For information on integrating bug
tracker applications with Fortify Audit Workbench, see Micro Focus Fortify Audit Workbench User
Guide.
This section contains the following topics:
Basic Samples 170
Advanced Samples 172
Basic Samples
The following table describes the sample files in the <sca_install_dir>/Samples/basic directory
and provides a list of the vulnerabilities that the samples demonstrate. Many of the samples includes a
README.txt file that provides details and instructions on its use.
cpp A C++ sample file and instructions to analyze code Command Injection
that has a simple dataflow vulnerability. Fortify
Memory Leak
analysis requires a gcc or cl compiler.
database A database.pks sample file. This SQL sample Access Control: Database
includes issues in SQL code.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 170 of 216
User Guide
Appendix C: Sample Projects
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 171 of 216
User Guide
Appendix C: Sample Projects
Advanced Samples
The following table describes the samples in the <sca_install_dir>/Samples/advanced directory.
Many of the samples include a README.txt file that provides additional details and instructions on how
to analyze the sample.
BugTrackerPlugin Includes source code for the supported bug tracker plugin.
<bugtracker>
configuration A sample Java EE application that has vulnerabilities in its web module
deployment descriptor web.xml.
crosstier A sample that has vulnerabilities that span multiple application technologies
(Java, PL/SQL, JSP, and struts).
The output contains several issues of different types, including two Access
Control vulnerabilities. One of these is a cross-tier result. It has a dataflow trace
from user input in Java code that can affect a SELECT statement in PL/SQL.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 172 of 216
User Guide
Appendix C: Sample Projects
csharp A simple C# program that has SQL injection vulnerabilities. Versions are
included for each supported version of Visual Studio. Analysis of this sample
reveals SQL Injection ,Unreleased Resource, and Path Manipulation
vulnerabilities. Other categories might also be present, depending on the
Rulepack version used in the scan.
customrules Several simple source code samples and Rulepack files that illustrate how four
different analyzers: Semantic, Dataflow, Control Flow, and Configuration
interpret rules. This folder also includes several miscellaneous samples of real-
world rules that you can use to scan real applications.
filters A sample that uses the Fortify Static Code Analyzer -filter option.
findbugs A sample that demonstrates how to run the FindBugs static analysis tool
together with Fortify Static Code Analyzer and filter out results that overlap.
java1.5 A sample Java file: ResourceInjection.java. The result file includes a Path
Manipulation, a J2EE Bad Practices, and a Poor Style vulnerability.
javaAnnotations A sample application that illustrates problems that might arise from its use and
how to fix the problems with the Fortify Java Annotations.
This sample illustrates how the use of Fortify Annotations can result in
increased accuracy in the reported vulnerabilities. The README.txt file
describes the potential problems and solutions associated with the sample
application.
riches.java A Java EE 1.4 sample web application with various known security vulnerabilities
including Cross-Site Scripting, SQL Injection, and Command Injection.
riches.net A .NET 4.0 sample web application with various known security vulnerabilities
including Cross-Site Scripting, SQL Injection, and Command Injection.
swift The iGoat-Swift folder contains the iGoat-Swift source provided by the Open
Web Application Security Project (OWASP). To analyze this project, you must
have a supported xcodebuild version installed. The README.txt file describes
the vulnerabilities that are revealed in the analysis of this application.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 173 of 216
User Guide
Appendix C: Sample Projects
webgoat The WebGoat test Java EE web application provided by the Open Web
Application Security Project (OWASP). This directory contains the WebGoat 5.0
source code.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 174 of 216
Appendix D: Fortify Java Annotations
Fortify provides two versions of the Java Fortify annotations library.
l Annotations with the retention policy set to CLASS (FortifyAnnotations-CLASS.jar).
With this version of the library, Fortify annotations are propagated to the bytecode during
compilation.
l Annotations with the retention policy set to SOURCE (FortifyAnnotations-SOURCE.jar).
With this version of the library, Fortify annotations are not propagated to the bytecode after the
code that uses them is compiled.
If you use Fortify products to analyze bytecode of your applications (for example, with Fortify on
Demand assessments), then use the version with the annotation retention policy set to CLASS. If you
use Fortify products to analyze the source code of your applications, you can use either version of the
library, however Fortify strongly recommends that you use the library with retention policy set to
SOURCE.
Important! Leaving Fortify annotations in production code is a security risk because they can leak
information about potential security problems in the code. Fortify recommends that you use
annotations with the retention policy set to CLASS only for internal Fortify analysis, and never use
them in your application production builds.
This section outlines the annotations available. A sample application is included with the Fortify SCA
and Applications samples installation in the <sca_install_
dir>/Samples/advanced/javaAnnotations directory. A README.txt file included in the directory
describes the sample application, problems that might arise from it, and how to fix these problems using
the Fortify Java Annotations.
There are two limitations with Fortify Java annotations:
l Each annotation can specify only one input and/or one output.
l You can apply only one annotation of each type to the same target.
You also can write rules to support your own custom annotations. Contact Micro Focus Fortify
Customer Support for more information.
Dataflow Annotations
There are four types of Dataflow annotations, similar to Dataflow rules: Source, Sink, Passthrough, and
Validate. All are applied to methods and specify the inputs and/or outputs by parameter name or the
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 175 of 216
User Guide
Appendix D: Fortify Java Annotations
strings this and return. Additionally, you can apply the Dataflow Source and Sink annotations to the
function arguments.
Source Annotations
The acceptable values for the annotation parameter are this, return, or a function parameter name.
For example, you can assign taint to an output of the target method.
@FortifyDatabaseSource("return")
String [] loadUserProfile(String userID) {
...
}
For example, you can assign taint to an argument of the target method.
In addition to specific source annotations, Fortify provides a generic untrusted taint source called
FortifySource.
The following is a complete list of source annotations:
l FortifySource
l FortifyDatabaseSource
l FortifyFileSystemSource
l FortifyNetworkSource
l FortifyPCISource
l FortifyPrivateSource
l FortifyWebSource
Passthrough Annotations
Passthrough annotations transfer any taint from an input to an output of the target method. It can also
assign or remove taint from the output, in the case of FortifyNumberPassthrough and
FortifyNotNumberPassthrough. The acceptable values for the in annotation parameter are "this"
or a function parameter name. The acceptable values for the out annotation parameter are this,
return, or a function parameter name.
@FortifyPassthrough(in="a",out="return")
String toLowerCase(String a) {
...
}
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 176 of 216
User Guide
Appendix D: Fortify Java Annotations
Use FortifyNumberPassthrough to indicate that the data is purely numeric. Numeric data cannot
cause certain types of issues, such as cross-site scripting, regardless of the source. Using
FortifyNumberPassthrough can reduce false positives of this type. If a program decomposes
character data into a numeric type (int, int[], and so on), you can use FortifyNumberPassthrough. If
a program concatenates numeric data into character or string data, then use
FortifyNotNumberPassthrough.
The following is a complete list of passthrough annotations:
l FortifyPassthrough
l FortifyNumberPassthrough
l FortifyNotNumberPassthrough
Sink Annotations
Sink annotations report an issue when taint of the appropriate type reaches an input of the target
method. Acceptable values for the annotation parameter are this or a function parameter name.
@FortifyXSSSink("a")
void printToWebpage(int a) {
...
}
You can also apply the annotation to the function argument or the return parameter. In the following
example, an issue is reported when taint reaches the argument a.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 177 of 216
User Guide
Appendix D: Fortify Java Annotations
Validate Annotations
Validate annotations remove taint from an output of the target method. Acceptable values for the
annotation parameter are this, return, or a function parameter name.
@FortifyXSSValidate("return")
String xssCleanse(String a) {
...
}
@FortifyPassword String x;
@FortifyNotPassword String pass;
@FortifyPrivate String y;
@FortifyNotPrivate String cc;
In the previous example, string x will be identified as a password and checked for privacy violations and
hardcoded passwords. The string pass will not be identified as a password. Without the annotation, it
might cause false positives. The FortifyPrivate and FortifyNotPrivate annotations work
similarly, only they do not cause privacy violation issues.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 178 of 216
User Guide
Appendix D: Fortify Java Annotations
In the previous example, an issue is reported if a negative value is assigned to index or zero is assigned
to divisor.
Other Annotations
Check Return Value Annotation
Use the FortifyCheckReturnValue annotation to add a target method to the list of functions that
require a check of the return values.
@FortifyCheckReturnValue
int openFile(String filename){
...
}
Dangerous Annotations
With the FortifyDangerous annotation, any use of the target function, field, variable, or class is
reported. Acceptable values for the annotation parameter are CRITICAL, HIGH, MEDIUM, or LOW. These
values indicat how to categorize the issue based on the Fortify Priority Order values).
@FortifyDangerous{"CRITICAL"}
public class DangerousClass {
@FortifyDangerous{"HIGH"}
String dangerousField;
@FortifyDangerous{"LOW"}
int dangerousMethod() {
...
}
}
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 179 of 216
Appendix E: Configuration Options
The Fortify SCA and Applications installer places a set of properties files on your system. Properties files
contain configurable settings for Micro Focus Fortify Static Code Analyzer runtime analysis, output, and
performance.
This section contains the following topics:
Fortify Static Code Analyzer Properties Files 180
fortify-sca.properties 182
fortify-sca-quickscan.properties 211
com.fortify.sca.fileextensions.htm=HTML
As shown above, the property sets the translation to use for .htm files. The property name is
com.fortify.sca.fileextension.htm and the value is set to HTML.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 180 of 216
User Guide
Appendix E: Configuration Options
Note: When you specify a path for Windows systems as the property value, you must escape any
backslash character (\) with a backslash (for example:
com.fortify.sca.ASPVirtualRoots.Library=C:\\WebServer\\CustomerA\\inc).
Disabled properties are commented out of the properties file. To enable these properties, remove the
comment symbol (#) and save the properties file. In the following example, the
com.fortify.sca.LogFile property is disabled in the properties file and is not part of the
configuration:
1 Command line with the Properties specified on the command line have the highest
-D option priority and you can specify them in any scan.
2 Fortify Static Code Note: You can specify either quick scan or a scan precision
Analyzer quick scan level. Therefore, these property settings both have second
configuration file priority.
Fortify Static Code Properties specified in the scan precision property files have the
Analyzer scan precision second priority, but only if you include the -scan-precision
property files option to enable scan precision.
3 Fortify Static Code Properties specified in the Fortify Static Code Analyzer
Analyzer configuration configuration file (fortify-sca.properties) have the lowest
file priority. Edit this file to change the property values on a more
permanent basis for all scans.
Fortify Static Code Analyzer also relies on some properties that have internally defined default values.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 181 of 216
User Guide
Appendix E: Configuration Options
fortify-sca.properties
The following table summarizes the properties available for use in the fortify-sca.properties file.
See "fortify-sca-quickscan.properties" on page 211 for additional properties that you can use in this
properties file. The description for each property includes the value type, the default value, the
equivalent command-line option (if applicable), and an example.
Command-Line Option: -b
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 182 of 216
User Guide
Appendix E: Configuration Options
Default: false
Default: true
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 183 of 216
User Guide
Appendix E: Configuration Options
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 184 of 216
User Guide
Appendix E: Configuration Options
Default: false
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 185 of 216
User Guide
Appendix E: Configuration Options
Example:
com.fortify.sca.CmdLineOptionsFileEncoding=
UTF-8
com.fortify.sca. Specifies the source file encoding type. Fortify Static Code
InputFileEncoding Analyzer allows you to scan a project that contains
differently encoded source files. To work with a multi-
encoded project, you must specify the -encoding option
in the translation phase, when Fortify Static Code
Analyzer first reads the source code file. Fortify Static
Code Analyzer remembers this encoding in the build
session and propagates it into the FVDL file.
Typically, if you do not specify the encoding type, Fortify
Static Code Analyzer uses file.encoding from the
java.io.InputStreamReader constructor with no
encoding parameter. In a few cases (for example with the
ActionScript parser), Fortify Static Code Analyzer defaults
to UTF-8.
Value Type: String
Default: (none)
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 186 of 216
User Guide
Appendix E: Configuration Options
Default: false
Default: false
Command-Line Option: -apex
Default: true
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 187 of 216
User Guide
Appendix E: Configuration Options
com.fortify.sca. Extends the default exit code options. See "Exit Codes" on
ExitCodeLevel page 156 for a description of the exit codes. The valid
values are:
The valid values are:
Default: true
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 188 of 216
User Guide
Appendix E: Configuration Options
Default: 2700
Default: 4
Default: javascript,python,ruby,typescript
com.fortify.sca. The total amount of time (in seconds) that type inference
TypeInferencePhase0 can spend in phase 0 (the interprocedural analysis).
Timeout Unlimited if set to zero or is not specified.
Value Type: Long
Default: 300
com.fortify.sca. The amount of time (in seconds) that type inference can
TypeInferenceFunctionTimeout spend to analyze a single function. Unlimited if set to zero
or is not specified.
Value Type: Long
Default: 60
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 189 of 216
User Guide
Appendix E: Configuration Options
Default: false
com.fortify.sca. Specifies a list of file extensions for rules files. Any files in
RulesFileExtensions <sca_install_dir>/Core/config/rules (or a
directory specified with the -rules option) whose
extension is in this list is included. The .bin extension is
always included, regardless of the value of this property.
The delimiter for this property is the system path
separator.
Value Type: String
Default: .xml
com.fortify.sca. If set to true, rules from the default Rulepacks are not
NoDefaultRules loaded. Fortify Static Code Analyzer processes the
Rulepacks for description elements and language libraries,
but no rules are processed.
Value Type: Boolean
Default: (none)
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 190 of 216
User Guide
Appendix E: Configuration Options
com.fortify.sca. Sets the directory used to search for the Fortify provided
DefaultRulesDir encrypted rules files.
Value Type: String (path)
Default:
${com.fortify.Core}/config/rules
Default: true
Command-Line Option: -findbugs
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 191 of 216
User Guide
Appendix E: Configuration Options
Default: true
Default: 1.0
Default: true
Default: reg
Example:
com.fortify.sca.RegExecutable=
C:\\Windows\\System32\\reg.exe
com.fortify.sca. Specifies the path to a filter file for the scan. See "Filter
FilterFile Files" on page 165 for more information.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 192 of 216
User Guide
Appendix E: Configuration Options
com.fortify.sca. Specifies the issue template file to use for the scan. This
ProjectTemplate only affects scans on the local machine. If you upload the
FPR to Micro Focus Fortify Software Security Center
server, it uses the issue template assigned to the
application version.
Value Type: String
Default: (none)
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 193 of 216
User Guide
Appendix E: Configuration Options
test_issuetemplate.xml
Default: true
Default: .*yyparse.*
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 194 of 216
User Guide
Appendix E: Configuration Options
Default: true
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 195 of 216
User Guide
Appendix E: Configuration Options
Default: 1.8
Command-Line Option: -jdk
com.fortify.sca. Specifies the class path used to analyze Java source code.
JavaClasspath Specify the paths as a semicolon-separated list (Windows)
or a colon-separated list (non-Windows systems).
Value Type: String (paths)
Default: (none)
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 196 of 216
User Guide
Appendix E: Configuration Options
Default: true
com.fortify.sca If set to true, the JSP parser uses JSP security manager.
jsp.UseSecurityManager
Value Type: Boolean
Default: true
Default: ISO-8859-1
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 197 of 216
User Guide
Appendix E: Configuration Options
Default: false
Command-Line Option: -exclude-disabled-
projects
WinForms. WinForms.TransformDataBindings=true
TransformChange
NotificationPattern WinForms.TransformMessageLoops=true
WinForms. WinForms.TransformChangeNotificationPattern
CollectionMutation =
Monitor.Label true
WinForms. WinForms.CollectionMutationMonitor.Label=
ExtractEventHandlers WinFormsDataSource
WinForms.ExtractEventHandlers=true
Default: false
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 198 of 216
User Guide
Appendix E: Configuration Options
Example: com.fortify.sca.JavaScript.
src.domain.whitelist=
http://www.xyz.com|http://www.123.org
Default: false
l ES6: es6-shim.min.js,system-polyfills.js,
shims_for_IE.js
l jQuery: jquery.js,jquery.min.js,
jquery-migrate.js,jquery-migrate.min.js,
jquery-ui.js,jquery-ui.min.js,
jquery.mobile.js,jquery.mobile.min.js,
jquery.color.js,jquery.color.min.js,
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 199 of 216
User Guide
Appendix E: Configuration Options
jquery.color.svg-names.js,
jquery.color.svg-names.min.js,
jquery.color.plus-names.js,
jquery.color.plus-names.min.js,
jquery.tools.min.js
l javascript: bootstrap.js,
bootstrap.min.js,
typescript.js,
typescriptServices.js
l typescript: typescript.d.ts,
typescriptServices.d.ts
Default: true
Default: true
com.fortify.sca. Specifies the PHP version. For a list of valid versions, see
PHPVersion the Micro Focus Fortify Software System Requirements.
Value Type: String
Default: 7.0
Command-Line Option: -php-version
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 200 of 216
User Guide
Appendix E: Configuration Options
Default: 2
Command-Line Option: -python-version
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 201 of 216
User Guide
Appendix E: Configuration Options
com.fortify.sca. Specifies the root location of a valid Flex SDK. The folder
FlexSdkRoot must contain a frameworks folder that contains a flex-
config.xml file. It must also contain a bin folder that
contains an mxmlc executable.
Value Type: String (path)
Default: (none)
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 202 of 216
User Guide
Appendix E: Configuration Options
Default: (none)
Default: false
Command-Line Option: -fixed-format
com.fortify.sca. Sets the SQL language variant. The valid values are PLSQL
SqlLanguage (for Oracle PL/SQL) and TSQL (for Microsoft T-SQL).
Value Type: String (SQL language type)
Default: TSQL
Command-Line Option: -sql-language
Default: false
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 203 of 216
User Guide
Appendix E: Configuration Options
Default: false
Command-Line Option: -fvdl-no-descriptions
Default: false
Command-Line Option: -fvdl-no-progdata
com.fortify.sca. If set to true, excludes the engine data from the analysis
FVDLDisableEngineData results file (FVDL).
Value Type: Boolean
Default: false
Command-Line Option: -fvdl-no-enginedata
Default: false
Command-Line Option: -fvdl-no-snippets
com.fortify.sca. If set to true, excludes the label evidence from the analysis
FVDLDisableLabelEvidence results file (FVDL).
Value Type: Boolean
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 204 of 216
User Guide
Appendix E: Configuration Options
Default: false
com.fortify.sca. Specifies location of the style sheet for the analysis results.
FVDLStylesheet
Value Type: String (path)
Default:
${com.fortify.Core}/resources/sca/fvdl2html
.xsl
Command-Line Option: -f
Example:
com.fortify.sca.ResultsFile=myresults.fpr
Default: false
Command-Line Option: -append
com.fortify.sca. Controls the output format. The valid values are fpr,
Renderer fvdl, text, and auto. The default of auto selects the
output format based on the file extension of the file
provided with the -f option.
Value Type: String
Default: auto
Command-Line Option: -format
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 205 of 216
User Guide
Appendix E: Configuration Options
Default: false
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 206 of 216
User Guide
Appendix E: Configuration Options
Default: 2
Default: false
Default: false
Default: false
Command-Line Option: -clobber-log
com.fortify.sca. Specifies the minimum log level for both log files. The valid
LogLevel values are: DEBUG, INFO, WARN, ERROR, and FATAL. For
more information, see "Accessing Log Files" on page 162
and "Configuring Log Files" on page 162.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 207 of 216
User Guide
Appendix E: Configuration Options
Default: INFO
Default: false
Default: false
Command-Line Option: -debug
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 208 of 216
User Guide
Appendix E: Configuration Options
Default: false
Command-Line Option: -quiet
Default: true
Default: false
com.fortify.sca. Sets the location of the CPFE binary (version 4.4.1) to use
cpfe.441.command in the translation phase.
Value Type: String (path)
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 209 of 216
User Guide
Appendix E: Configuration Options
Default:
${com.fortify.Core}/private-
bin/sca/cpfe441.rfct
com.fortify.sca. Sets the name of CPFE option that specifies the output
cpfe.file.option (for example NST) file name.
Value Type: String
Default: --gen_c_file_name
Example:
com.fortify.sca.cpfe.file.option=
--gen_c_file_name
Default: false
Default: false
Default: false
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 210 of 216
User Guide
Appendix E: Configuration Options
Default: false
Default: false
fortify-sca-quickscan.properties
Fortify Static Code Analyzer offers a less in-depth scan known as a quick scan. This option scans the
project in quick scan mode, using the property values in the fortify-sca-quickscan.properties
file. By default, a quick scan reduces the depth of the analysis and applies the Quick View filter set. The
Quick View filter set provides only critical and high priority issues.
Note: Properties in this file are only used if you specify the -quick option on the command line for
your scan.
The table provides two sets of default values: the default value for quick scans and the default value for
normal scans. If only one default value is shown, the value is the same for both normal scans and quick
scans.
com.fortify.sca. Sets the time limit (in milliseconds) for Control Flow
CtrlflowMaxFunctionTime analysis on a single function.
Value Type: Integer
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 211 of 216
User Guide
Appendix E: Configuration Options
com.fortify.sca. Specifies the filter set to use. You can use this property
FilterSet with an issue template to filter at scan-time instead of
post-scan. See
com.fortify.sca.ProjectTemplate described in
"fortify-sca.properties" on page 182 to specify an issue
template that contains the filter set to use.
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 212 of 216
User Guide
Appendix E: Configuration Options
com.fortify.sca. Sets the time limit (in milliseconds) for Null Pointer
NullPtrMaxFunctionTime analysis for a single function. The standard default is
five minutes. If this value is set to a shorter limit, the
overall scan time decreases.
Value Type: Integer
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 213 of 216
User Guide
Appendix E: Configuration Options
Default: NoJSP
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 214 of 216
User Guide
Appendix E: Configuration Options
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 215 of 216
Send Documentation Feedback
If you have comments about this document, you can contact the documentation team by email.
Note: If you are experiencing a technical issue with our product, do not email the documentation
team. Instead, contact Micro Focus Fortify Customer Support at
https://www.microfocus.com/support so they can assist you.
If an email client is configured on this computer, click the link above to contact the documentation team
and an email window opens with the following information in the subject line:
Feedback on User Guide (Fortify Static Code Analyzer 20.2.0)
Just add your feedback to the email and click send.
If no email client is available, copy the information above to a new message in a web mail client, and send
your feedback to FortifyDocTeam@microfocus.com.
We appreciate your feedback!
Micro Focus Fortify Static Code Analyzer (20.2.0) Page 216 of 216