Skip to main content
Skip table of contents

Authenticate your login for the Mend CLI

Overview

You must log in to the Mend CLI once for each environment where it runs, which authenticates you to work in a single organization.

Mend CLI login example

image-20240418-212042.png

Getting it done

Prerequisites before you log into the Mend CLI

  • The following operating systems are supported by the Mend CLI:

    • Linux (Intel and ARM processors): Ubuntu, Debian, and other flavors which have glibc (GNU C library)

    • Windows: Windows 10/11 or Windows Server 2016 and higher

    • MacOS - Docker for Mac installed.

  • Have an active Mend license.

  • Obtain your service user key (recommended) or your personal user key:

    • For SCA/Container Image:

      • Service user key: Mend Application → AdminUsers → locate service user → copy token

      • Your user key: Mend Application → My ProfileUser Keys

    • For SAST:

      • Service user key: Mend SAST Application → UsersService Users → locate service user → Show token

      • Your user key: Mend SAST Application → SettingsAPI Token

  • Download the Mend CLI

Log in to the Mend CLI via the interactive terminal

You can log in to the Mend CLI interactively by entering mend auth login in your terminal:

Log in to the Mend CLI via environment variables

Log in to the Mend CLI by defining credentials via environment variables.

Tip: As a common best practice, we strongly recommend creating and using a service user when configuring the Mend CLI authentication through environment variables in your CI/CD pipelines. Read more on service users in our articles below:

To define the variables in your environment, you can:

  • Set environment variables before the Mend CLI run to persist between sessions:

    • In MacOS and Linux, use a shell startup script

    • In Windows, use the setx command.

      • setx VARIABLE "MYVALUE"

  • Set environment variables before the Mend CLI run, for the current session only:

    • In MacOS and Linux, use the export command.

      • export VARIABLE=value

    • In Windows, use the set command.

      • set VARIABLE=value

Note: If you receive this error: Executing <mend dependencies> and the corresponding help command requires to authenticate first, either through environment variables or by executing mend auth login.
Remove any MEND_SAST_*variables from your environment and rerun the SCA scan.
For more information on MEND_SAST_*variables, refer to our CLI Parameters documentation.

Set up a proxy and automatic updates for the Mend CLI

You can set up a proxy as well as toggle automatic updates for the Mend CLI for all scan types using the mend config command. Read through our mend config parameters section within this documentation to learn more.

Note:

  • When automatic updates are disabled, the Mend CLI will still check for updates and notify you that a new version is available to download.

  • When running a Mend CLI scan with proxy enabled, the terminal output and logs will notify you that a proxy is being used after executing a command: Running with proxy - https:/myproxy.prx.

Verify the connection from the Mend CLI to the Mend Server

You can verify the connection from the Mend CLI on your environment to the Mend Server using the mend connectivity command. The command checks if all external URL resources needed during the scan are accessible with the current network/proxy settings and reports an error for each URL where the access attempt fails.

To check the connectivity, you should:

  • Use the mend connectivity --mend-url="MEND_URL" command and insert the “Mend_URL” value for the connection test.

  • MEND_URL represents the Mend environment URL. The supported values are available in Mend CLI - mend auth login parameters.

image-20240906-150508.png

Reference

Mend SAST Login
Mend SCA/Container Image Login

Mend CLI - mend auth login parameters

Note: For inline help, use mend auth login -h or mend auth login --help.

Parameter

Description

Command Line: Select Mend environment
Environment Variable (SCA/Container Image): MEND_URL

Select the Mend environment URL of your shared instance. The supported values are:

  • https://saas.mend.io

  • https://saas-eu.mend.io

  • https://app.mend.io

  • https://saas.whitesourcesoftware.com

  • https://saas-eu.whitesourcesoftware.com

  • https://app-eu.whitesourcesoftware.com

  • https://app.whitesourcesoftware.com

  • Other

Note: The Other value is to be used by organizations on dedicated instances.

Command Line: Select Mend products
Environment Variable (SCA/Container Image): N/A
Environment Variable (SAST): N/A

Select the Mend product(s) that you are authenticating for. The supported values are:

  • SCA (Dependencies) / CN (Image) - Authenticate for Mend CLI SCA and Mend CLI Container Image scans.

  • SAST (Code) - Authenticate for Mend CLI SAST scans.

Command Line: User Email
Environment Variable (SCA/Container Image): MEND_EMAIL

Input your user email that has access to the Mend organization.

  • SCA/Container Image: You can find your email in your Profile page of the Mend Application.

  • SAST: You can find your email in the top-right corner of the Mend SAST Application.

Command Line (SCA/Container Image): User Key
Command Line (SAST: User Key / API Token
Environment Variable (SCA/Container Image): MEND_USER_KEY

Input your service user key (recommended) or your personal user key that has access to the Mend organization.

  • SCA/Container Image:

    • Service user key: Mend Application → AdminUsers → locate service user → copy token

    • Your user key: Mend Application → My ProfileUser Keys

  • SAST: (API Token) :

    • Service user key: Mend SAST Application → UsersService Users → locate service user → Show token

    • Your user key: Mend SAST Application → SettingsAPI Token

Command Line: Select SAST (Code) organization
Environment Variable (SCA/Container Image): N/A
Environment Variable (SAST): MEND_ORGANIZATION

Command Line: (SAST Only) Select the Mend organization that you want to authenticate to from the provided organization list.

Environment Variable: (SAST Only) Provide your SAST organization UUID.

Mend CLI - mend config parameters

Parameter

Description

Command Line:[Updates] Enable automatic updates? (Y/n, current: )

Default Value: Y (Yes): Automatic Updates enabled. Toggle automatic updates for the Mend CLI:

  • Y: Yes. Enable automatic updates for the Mend CLI.

  • n: No. Disable automatic updates for the Mend CLI.

  • current: Your current, active configuration.

Command Line:[Proxy] Change proxy settings? (y/N/reset, current: )

Whether to start the set up process for configuring a proxy:

  • y: Yes. Start the proxy setup process.

  • N: No. Do not start the proxy setup process. The mend config command will exit with a Configuration completed message.

  • reset: Remove your current proxy setup. This will set the proxy settings back to the default value, None.

  • current: Default Value: None (No proxy configured). Your current, active configuration.

Command Line:[Proxy] URL (current: )
Environment Variable (All scan types): HTTP_PROXY

Enter the URL of your proxy.

  • current: Default Value: None (No proxy URL configured). Your current, active configuration.

Command Line:[Proxy] Configure proxy authentication? (y/N)

Whether to start the set up process of configuration proxy credentials:

  • y: Yes. Start the proxy credential setup process.

  • N: No. Do not start the proxy credential setup process.

Command Line:[Proxy authentication] Username (current: )
Environment Variable (All scan types): HTTP_PROXY_USERNAME

Enter the username of your proxy authentication.

  • current: Default Value: None (No proxy username configured). Your current, active configuration.

Command Line:[Proxy authentication] Password (current: )
Environment Variable (All scan types): HTTP_PROXY_PASSWORD

Enter the password of your proxy authentication.

  • current: Default Value: None (No proxy password configured). Your current, active configuration.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.