Overview

Mend Advise is a plug-in for the PyCharm Integrated Development Environment (IDE) that is designed to empower developers with important, valuable information on security vulnerabilities concerning open-source components employed in their development projects.

Mend Advise does the following:

Support for Package Managers

Mend Advise supports projects using the following package managers:

Prerequisites

Ensure the following:

Supported Versions

The plugin supports PyCharm 2019.1 and above (both Community and Ultimate versions). The last tested version is 2022.1.

Installing Mend Advise

To install Mend Advise, do as follows:

  1. Start PyCharm.

  2. From the menu bar, select File > Settings. The Settings screen is displayed.

  3. From the left sidebar, click Plugins.

  4. In the Search box, enter Mend and then press Enter from your keyboard. The Mend Advise plugin information is displayed.

  5. Click Install and then click Restart IDE.

  6. In the pop-up dialog box, click Restart.

Activating Mend Advise

To activate Mend Advise, do as follows:

  1. Start PyCharm, specifying the preferred project.

  2. From the sidebar on the right, click Mend (if you do not see the sidebar, select View >Tool Windows > Mend). The Welcome screen is displayed.

  3. In Email, enter your organizational email (the email domain must be licensed to use Advise).

  4. In License Key, enter your license key (See here for more information on how to obtain a license key). 

  5. Click Connect.

NOTE: If you check Remember Token, the login credentials will be stored for later use. Once stored, the Mend Advise login credentials will be used for all projects.

Configuring Mend Advise

Changes made to the Mend settings will only apply after running the next scan.

You can configure the Mend settings on a global or a project level. See the following sections.

Global-Level Configuration

To configure Mend Advise on a global level, do as follows:

  1. From the menu bar, select File > Settings. The Settings screen is displayed.

  2. Select Tools > Mend.

  3. In Scan Results Settings, review the options and modify if necessary. See here for a list of all options.

  4. Click OK.

Project-Level Configuration

To configure Mend Advise on a project-level, do as follows:

  1. From the menu bar, select File > Settings. The Settings screen is displayed.

  2. Select Tools > Mend > Project Settings. The Project Settings screen is displayed.

  3. In Scan Results Settings, review the options and modify if necessary. See here for a list of all options.

  4. By default, all settings are inherited from the global-level configuration. To override the specific configuration on project level, clear the Inherit from global settings checkbox.

  5. Click OK.

Options Table

Option

Description

Default Setting

Only show issues for direct dependencies

When enabled, Mend Advise will only return vulnerabilities for direct dependencies defined in your dependency file.

Unselected (not checked)

Minimum vulnerability severity level

Alert only on detected vulnerabilities satisfying a Low/Medium/High minimum severity level.

  • Low - Vulnerability alerts for all severities (Low, Medium, High) are displayed.

  • Medium- Vulnerability alerts only for Medium or High severities are displayed.

  • High - Vulnerability alerts only for High severities are displayed.

Low

Include dev dependencies

Whether to alert on vulnerabilities detected in dev dependencies.

Unselected (not checked)

Diff operation to be performed on a base branch

Enables developer focus mode functionality. 

  • The dropdown will include all locally available git branches for this project. 

  • It will allow to choose the base branch which will be the base for comparing security alerts from feature branches. 

Unselected (not checked)

Scanning a Project for Security Vulnerabilities

To scan a project, do one of the following:

Developer Focus Mode

The developer Focus Mode allows developers to see only vulnerability alerts that are new in their feature branches compared to a predefined base branch. This promotes the security shift left approach and empowers developers to fix newly introduced vulnerabilities immediately, as part of their feature development efforts and prior to merging vulnerable code into production branches.

To enable Focus Mode, do as follows:

In case there was no scan on the predefined base branch after its initial configuration, all branches will show all the scan results, not just the newly created security alerts. 

Every time the base branch configuration changes, a Mend Advise scan must be triggered on that branch prior to seeing new security results.   

Vulnerable Commit Alert

An alert can be enabled to notify about newly added vulnerabilities when committing the code inside the PyCharm. This alert will appear only if the committed feature branches have new vulnerabilities compared to a preconfigured base branch.

To enable a Vulnerable Commit Alert, do as follows:

In case the feature branch contains new vulnerabilities (that were not presented in the base branch), a pop up will suggest reviewing the found vulnerabilities or commit anyway.

Reviewing Scan Results

To review scan results, open one of the following windows:

Inspection Results Window

  1. Click the Inspection Results tab at the bottom (alternatively, select View > Tool Windows > Inspection Results). The Inspection Results window is displayed.

  2. Ensure that you are in the Mend Security Check tab (it is part of the Inspection Results area). This tab features information on vulnerability issues found inside the current project. For every component, the relevant vulnerabilities are displayed via either a requirements.txt, Pipfile, or pyproject.toml item. Note the following functionality:

Problems Window

NOTE: The Problems window is available only from version 2020.2. of the IDE.

  1. Click the Problems tab at the bottom (alternatively, select View > Tool Windows > Problems). The Problems window is displayed.

  2. Note that this tab features information on vulnerability issues found inside the current project. For every component, the relevant vulnerabilities are displayed via either a requirements.txt, Pipfile, or pyproject.toml item. The following functionality is included:

Displaying Vulnerability Information for a Scanned Component

This section describes how Mend Advise can be used to display security vulnerability details for a project, via PyCharm's main code view.

Open the Mend security check tab and do as follows:

Viewing General Plugin Information 

To view version information about Mend Advise, do as follows:

The About screen displays information about the Advise plugin's version, general information on your IDE, along with links for Privacy policy and Terms and Conditions.

Generating Debug Logs for Mend Support

To generate debug logs, do as follows:

  1. From the menubar, click Help. A menu is displayed.

  2. Select Diagnostic Tools > Debug Log Settings. The Custom Debug Log Configuration dialog box is displayed.

  3. Enter this text: #org.whitesource.intellij.plugin

  4. Click OK.

Debug logs will now be generated for the integration.

Upgrading Mend Advise 

To upgrade the Mend Advise plugin, do as follows:

  1. From the menu bar, select File > Settings > Plugins. Ensure that you are in the Installed tab. A list of installed plugins is displayed.

  2. In the Downloaded section, search for Mend Advise, and on the right-hand side, click Update.
    NOTE: If there is no new version, the Update button will not appear, and there is no need to continue this procedure. 

  3. Select Mend Advise.

  4. If you are prompted to restart, do so.

Uninstalling Mend Advise

To uninstall the plugin, do as follows: 

  1. From the menu bar, select File > Settings > Plugins. Ensure that you are in the Installed tab. A list of installed plugins is displayed. 

  2. In the Downloaded section, search for Mend Advise and click it. The Mend Advise plugin page is displayed.

  3. On the right-hand side, click the drop-down box, and then click Uninstall. The Plugin Uninstall dialog box is displayed. 

  4. Click Yes to confirm.

  5. If you are prompted to restart, do so.