Package: mend-ignore-alerts
Ignore AlertsSet Ignore status for alert or reactivate it based on input YAML file or baseline project tokenSupported Operating SystemsPrerequisitesInstallationConfiguration ParametersConfig file ExampleInput/Output YAML ExampleUsageSupported Operating SystemsLinux (Bash):CentOS, Debian, UbuntuWindows (PowerShell):10, 2012, 2016PrerequisitesPython 3.9+Mend user with admin permissionsInstallation$ pip install mend-ignore-alertsNote:Depending on whether the package was installed as a root user or not, you need to make sure the package installation location was added to the$PATHenvironment variable.Configuration ParametersNote:Parameters can be specified as either command-line arguments, environment variables, or a combination of both.Command-line arguments take precedence over environment variables.CLI argumentEnv. VariableTypeRequiredDescription‑‑helpswitchNoShow help and exit‑‑user-key, ‑kWS_USERKEYstringYesMend User Key‑‑api-key, ‑oWS_APIKEYstringYesMend API Key‑‑url, ‑uWS_URLstringYesMend Server URL‑‑yamlWS_YAMLstringNoYaml file's name for parsing in casemodeis equalload. Ifmodeiscreatethen Yaml file will be created‑‑destProjectToken, ‑tstringNoToken of the Mend project where the alerts will be ignored.‑‑destProjectName, ‑nstringNoName of the Mend project where the alerts will be ignored.‑‑destProjectVersion, ‑vstringNoVersion of the Mend project where the alerts will be ignored.‑‑scope, ‑bWS_PROJECTTOKENstringNoComma-separated list of Mend Project Tokens that should be included. Empty String (Include all projects)Use as baseline project token when a mode parameter is omitted.‑‑product, ‑dWS_PRODUCTTOKENstringNoComma-separated list of Mend Product Tokens that should be included. Empty String (Include all products)Using a baseline project token, the provided product token will be used as the destination product.‑‑excludeWS_EXCLUDETOKENstringNoComma-separated list of Mend Project Tokens that should be excluded.Empty String (No exclusions)‑‑modeWS_MODEstringNocreate,loador omitted value. If the mode parameter is omitted, then the baseline token will be used as a template for ignoring alerts in the destination.‑‑comment, ‑cstringNoThe default comment for ignoring process. If the parameter is not set then standard note “Automatically Ignored by Mend Utility” will be used‑‑ghpatWS_GHPATstringNoGitHub PAT‑‑whiteliststringNoFile with list of CVEs or list of CVEs divided by comma.‑‑ghownerWS_GHOWNERstringNoGitHub Owner‑‑ghrepoWS_GHREPOstringNoGitHub Repo nameNote:The tool will create or load data using the input YAML file depending on the value of amodeparameter.In the case of an omittedmodeparameter, the baseline project token (set in the –scope argument) will be used as a template. (the YAML file would not used).In the case ofcreatemode, the WS_PROJECTTOKEN/--scope contains a list of project tokens for creating a YAML file.Pay attention:  The ignoring alerts process ignores all alerts depending on the “whitelist” CVEs or CVEs from the YAML file.The file should contain the list of CVEs like this:CVE-xxxx-yyyyCVE-zzzz-mmmmCVE-uuuu-nnnnConfig file example[DEFAULT]wsUrl=userKey=orgToken=baselineProjectToken=# This parameter associated with WS_PROJECTTOKEN (--scope)destProjectName=destProjectVersion=destProjectToken=# This parameter associated with --destProjectToken argumentdestProductToken=# This parameter associated with WS_PRODUCTTOKEN (--product)whitelist=mode=yaml=excludeTokens=comment=# The default comment for ignoring alerts processGHPat=GHRepo=GHOwner=The tool will create or load data using the input YAML file if a mode argument is equal create or load. If a mode argument is missed, it will use the baseline project token as a template for ignoring alerts in the destination project. (the YAML file would not used).Input/Output YAML example-productname:Some Product Name# Product Nameprojectname:Some Project Name# Project Namevulns:-end_date:'YYYY-MM-DD'# If the date has passed, the alert related to CVE below (id_vuln) will not be ignored.# Conversely, an ignored alert will be reactivated if the specified date has passed.id_vuln:CVE-XXXX-XXXXXXX# The identification of a vulnerabilitynote:'Somealertnote'# The note is using as a comment for the ignoring process-end_date:'YYYY-MM-DD'id_vuln:CVE-XXXX-XXXXXXXnote:'Alertcomment'UsageUsing command-line arguments only (create YAML file):ignore_alerts--user-keyWS_USERKEY--api-keyWS_APIKEY--url$WS_WSS_URL--yaml$WS_YAML--modecreate--productxxxxxNote:In the following example, $WS_USERKEY, $WS_APIKEY, $WS_URL and $WS_MODE are assumed to have been exported as environment variables.$ignore_alerts--yamlwhaiverexample.yml--scopexxxxxxx,yyyyyyy--productzzzzzzzzzUsing command-line arguments only (use baseline project):ignore_alerts--user-keyWS_USERKEY--api-keyWS_APIKEY--url$WS_WSS_URL-bxxxxxx-nProjectName-vProjectVersion
or
ignore_alerts--user-keyWS_USERKEY--api-keyWS_APIKEY--url$WS_WSS_URL-bxxxxxx-tyyyyyyyyUsing environment variables:exportWS_USERKEY=xxxxxxxxxxxexportWS_APIKEY=xxxxxxxxxxxexportWS_URL=https://saas.mend.ioexportWS_YAML=waiverexample.ymlexportWS_PROJECTTOKEN=xxxxxxxxxx,yyyyyyyyyyyy

ignore_alerts--modecreateNote:Either form is accepted. For the rest of the examples, the latter form would be usedGetting waiver file from GitHub Repo:exportWS_USERKEY=xxxxxxxxxxxexportWS_APIKEY=xxxxxxxxxxxexportWS_URL=https://saas.mend.ioexportWS_YAML=waiverexample.ymlexportWS_GHPAT=xxxxxxxxxxxexportWS_GHOWNER=xxxxxxxxxxxexportWS_GHREPO=TestRepoNameignore_alerts--modeloadRunning script as part of CI process:The example of the CI yaml filename:Ignore Alert Workflowon:workflow_dispatch:jobs:build:runs-on:ubuntu-lateststrategy:matrix:python-version:['3.9']steps:-name:Checkout repositoryuses:actions/checkout@v2-name:Install dependenciesrun:|pip install mend-ignore-alerts-name:Run ignore_alert scriptenv:WS_APIKEY:${{ secrets.apikey }}USER_KEY:${{ secrets.userkey }}WS_URL:"saas.mend.io"YAML:"examplewaiver.yml"run:ignore_alerts --url $WS_URL --yaml $YAML --apiKey $WS_APIKEY --user-key $USER_KEY --mode loadThe YAML file should be placed in the Repo folder on GitHub