Supported File Extensions
For a complete list of supported file extensions (binary files, source files, and archive files) that the Unified Agent supports, refer here.
Selecting a Plugin for Integration
|Java||Unified Agent, Maven, Jenkins, TeamCity|
|.Net||Unified Agent, TFS/VSTS, Jenkins, TeamCity|
|Scala||Unified Agent, Maven , Jenkins, TeamCity|
|Clojure||Unified Agent, Maven , Jenkins, TeamCity|
|C#||Unified Agent, TFS/VSTS, Jenkins, TeamCity|
|NPM||Unified Agent, NPM|
|NuGet||Unified Agent, NuGet|
|Bower||Unified Agent, NPM|
|RPM/YUM||Unified Agent, |
|Debian||Unified Agent, |
|Swift||Unified Agent, |
|Alpine Linux||Unified Agent, |
|Groovy||Unified Agent, |
|ActionScript||Unified Agent, |
|Arch Linux||Unified Agent, |
Analyzing Archives Files
If you have Java/Ruby/Python archive files and you are willing to open them and extract descriptive information, then you can use this feature by providing values for the following parameters:
The drill-down hierarchy is limited to a maximum of 10 and can be modified in the configuration file.
By default, the drill-down hierarchy level is zero - no drill down.
Supported archive types are as follows:
- In case of Ruby .gem files, only the data.tar.gz file is extracted, and all the other content files are ignored.
- In Ruby, one hierarchy level is defined to extract Ruby's .gem and data.tar.gz files.
Providing a Project Name Only in a Unified Agent Scan
Overview and Default Behavior
If a scanned project uses a configuration file that contains only a defined 'projectName' (where 'projectToken’, ‘productName’ and ‘productToken’ are left empty), then the Unified Agent adds the results to the first project it finds in the organization that contains the same project name.
If a multi-module project is scanned with the same configuration as described above, and a project with one of the module names already exists, then the Unified Agent adds the module data to this existing project.
Changing the Default Behavior
In order to avoid overriding an existing project with the same name, from the Advanced Settings section of the Integrate page, select the checkbox Add project to default product when only project name is provided.
When this checkbox is selected, the following rules apply to all future scans:
- When only 'projectName' is provided in the Unified Agent configuration (as demonstrated in the above example), the Unified Agent adds the project to a default product named 'My Product'. This rule is implemented only when the default product 'My Product' does not already contain a project with the same name.
- If the default product 'My Product' already contains a project with the name specified in the 'projectName' parameter, then the Unified Agent returns an error to the user with the message "Project <PROJECT_NAME>' already exists in 'My Product'. A 'productToken' or 'productName' value should also be specified".
- If a multi-module project is scanned, and a project with one of the module names already exists under your product, an error is returned and none of the projects are created as part of the scan.
Configuration Recommended Mode
The detection mode (Configuration Recommendation) identifies the environment that the user wants to scan and creates the configuration file automatically.
This mode quickly determines the required folder's environment, such as file extensions and package managers. The output of this mode is a configuration file, which will be automatically created in the folder where the command ran: wss-generated-file.config.
The generated configuration will contain the list of recommended parameters based on the environment, and also the mandatory parameters: APIKey, ProductName, ProjectName/ProjectToken and Wss.URL.
To use the Configuration Recommendation mode, do as follows:
- In the folder that you want to scan, in the command line, enter java -jar unified_agent.jar -detect.
- In the folder that was scanned, access the generated file, wss-generated-file.config.
- Add the mandatory parameters to the file.
- Run the Unified Agent scan: java -jar unified_agent.jar -c wss-generated-file.config.
The includes parameter is supported by this feature, enabling WhiteSource to automatically identify the environment that the user wants to scan and create the configuration file automatically.
The following table lists the exit codes that are returned when the Unified Agent completes the scan.
These exit codes are also available after the process ends, in the environment's last command's return value variable
(Linux: $?, PowerShell: $LASTEXITCODE, Batch: %ERRORLEVEL%)
|0||SUCCESS||Scan completed successfully.|
|-1||ERROR||General error has occurred.|
|-2||POLICY_VIOLATION||One or more of the scanned components violates an Organization or Product level policy.|
Policy summary reports are created and saved in the newly-created whitesource directory, located under the current working directory ($pwd or %cd%).
Only applicable when configured to checkPolicies=true and forceUpdate=false.
|-3||CLIENT_FAILURE||Client-side error has occurred.|
|-4||CONNECTION_FAILURE||The agent was unable to establish a connection to the WhiteSource application server (e.g., due to a blocked Internet connection).|
|-5||SERVER_FAILURE||Server-side error has occurred (e.g., a malformed request or a request that cannot be parsed was received).|
|-6||PRE_STEP_FAILURE||One of the package manager's prerequisite steps (e.g., npm install, bower install, etc.) failed.|
Only applicable if the appropriate property is set to true (npm.runPreStep, bower.runPreStep, etc.).
|-100||EUA NOTICE|| Analysis will commonly display the following EUA code at successful completion: [EUA000] Analysis completed successfully. The Unified Agent returns a [-100] exit code if the analysis reported an exit code other than [EUA000]. |
Exit Codes in Bash
The exit codes WhiteSource returns in the Bash command language should be treated as 'x' modulo 256:
- Exit code 0 is equivalent to code 0 (0 mod 256 = 0)
- Exit code -1 is equivalent to code 255 (-1 mod 256 = 255)
- Exit code -2 is equivalent to code 254 (-2 mod 256 = 254)
- Exit code -3 is equivalent to code 253 (-3 mod 256 = 253)
- Exit code -4 is equivalent to code 252 (-4 mod 256 = 252)
- Exit code -5 is equivalent to code 251 (-5 mod 256 = 251)
- Exit code -6 is equivalent to code 250 (-6 mod 256 = 250)
Using Proxy Settings
For customers using a proxy, the relevant proxy details are defined here.
Use the CLI parameter ‘-proxy’ to allow for an easy method to set proxy settings. The following command allows you to download a remote configuration file using proxy settings:
NOTE: The following protocols are supported: 'file://', 'ftp://', 'http://', 'https://'
Best Practices for Offline Mode (Optional)
It's possible to save the output of the scan into a file instead of sending it directly to WhiteSource by HTTPS. This approach is useful in case there is no connectivity (or limited connectivity) while scanning.
By changing the configuration file to offline mode, any execution of the Unified Agent will store the current configuration and metadata in a JSON txt file named update-request.txt, located in the newly-created 'whitesource' directory. It is located under the current working directory ($pwd or %cd%). This file can later be manually uploaded to WhiteSource from the Admin Console or via the command line.
Setting up Offline Mode
Update the wss-unified-agent.config file:
- Change the offline property to true.
- For very large projects, it's recommended that you add the property offline.zip=true to reduce the size of the created file. This setting enables zipping the content of the output file.
- To prettify the output file to JSON format, add the offline.prettyJson=true property.
Uploading an Offline Request File
Upload via command line with configuration file (supported from version 1.8.9):
Before you begin this procedure, ensure these parameters are properly configured:
Execute the Unified Agent with the -requestFiles flag specifying the path to the update-request.txt file you created in the previous step. In order to send more than one file, separate file names with a comma.
Upload via command line without configuration file (supported from version 1.8.9):
Verifying the Integrity of the Unified Agent
This procedure enables you to verify the integrity of the downloaded Unified Agent's .jar file, and ensure that it originated from WhiteSource.
It is recommended to perform this procedure per release. Do as follows:
- Download JarSigner (there are multiple sources from where the utility can be downloaded).
- From the command line, enter the following command to run JarSigner and view the list of security certificates in the .jar file:
jarsigner -verify -verbose <UA jar>
After running, ensure that the WhiteSource information appears in the list of security certificates.
Scanning Remote Repositories
For customers using SCM (Git, SVN, Mercurial), refer here for the relevant settings.
If the source code is not located on your machine, it is possible to provide connection information to your remote repository using Git, SVN or Mercurial. Note the following:
- Only descriptive information is sent to our servers. All of the processing is done locally on your machine.
- Dimensions CM is also supported by using either Git via Git Connector or Subversion via CM Bridge.
- You cannot scan both a local repository and a remote repository simultaneously. If you are intending to scan a local repository and not a remote repository, then use the '-d' parameter instead of the SCM parameters that are described below.
The scm client must be installed on your machine in order to successfully connect to your repository:
WhiteSource also supports on-premises installations of repositories.
Usage in Different Repository Types
- For Git repositories, provide the repository URL and the branch or tag name. If no branch or tag is defined, it will default to the 'master' branch.
- For SVN repositories, provide the URL for the specific trunk, branch or tag. If no branch or tag is defined, it will default to the 'trunk' branch.
- For Mercurial repositories, provide the repository URL and the branch or tag name. If no is branch or tag is defined, it will default to the 'master' branch.
NOTE: If local files are to be scanned, then remove or comment out the scm parameters.
Multiple Remote Repositories
Multiple remote repositories can be scanned by creating a JSON file, similar to the following example:
Remote Repository (SSH)
SSH is currently supported only for Git repositories.
Set the scm.ppk property to your private key file path and set the scm.pass property to the passphrase of the private key. If there are none, then leave empty.
Proxy for Remote Repository
If you have a proxy for your remote repositories, add these java parameters:
The 'failErrorLevel' Parameter
When the 'failErrorLevel' parameter is set to 'DEFAULT', the behavior of the exit codes stay the same.
Modifying the Default Behavior
When the 'failErrorLevel' parameter is set to 'ALL', the Unified Agent returns an error code for all errors in the scan, rather than 'SUCCESS'. This can be useful for customers migrating from the plugins (NPM, MAVEN etc.) to the Unified Agent.
The parameter sets additional scenarios to 'error' instead of 'success'.The following cases are considered as 'Failure':
- resolver.runPrepStep failed (at least one)
- Error in collecting/running dependencies (at least one)
- When ‘productName’ and ‘productToken’ are missing, and no ‘projectToken’ is defined in the configuration file.
- npm.resolveDependencies=true, but resolve dependencies failed
- nuget.runPreStep=true, but the pre-step failed
- mvn dependency:tree failed or partial data was retrieved
Unified Agent JSON Report Example
A summary report in JSON format can be automatically generated locally at the end of each scan, using the 'generateScanReport' configuration parameter when running the Unified Agent.
This report includes information on vulnerabilities, policy violations, top fixes and inventory details.
The default filename format of the JSON report is '<project_name>-<yyyy-mm-dd>T<HHmmss>+<UTC offset>-scan_report.json'.
For example: 'Demo App-2019-06-04T181226+0300-scan_report.json'
The following configuration parameters are available to control timeouts and file name format for the report:
scanReportTimeoutMinutes: Time-out (in minutes) for the process of generating the scan report. If the timeout interval has passed then the report will not be generated, but the scan will continue.
scanReportFilenameFormat: Controls filename format of a generated scan report.
- Only Organization and Product Administrators can generate this report. The 'userKey' configuration parameter is mandatory for this option.
- In order to generate this report, the configuration parameter 'updateInventory' must be set to true.
- If 'checkPolicies' is set to true then 'forceUpdate' should also be set to true.
- If 'checkPolicies' is set to false then no policy related data will be generated in the report.
The following is an example of a scan report with custom attributes available on the project:
- If there is an issue with the Java heap size, depending on the machine resources, try to install a 64-bit Java Runtime and use the '–d64' along with the '–Xmx' and '–Xms' switches to increase the Java heap size.”
- The minimum file size for scanning is 512 bytes. The maximum file size for scanning is 2 GB. All other files will be skipped and not scanned by the Unified Agent.
- The Unified Agent supports UTF-8 locales. If other locales are in use, the Unified Agent generates an error when confronting special characters.
- Requests with more than one million dependencies will fail.