# Automation examples

Here, we show a bunch of examples of how to use the automation engine for different tasks.

# Create your first rule

You now find yourself inside the automations system where you will be creating the rules.

New rule

To get started, add an if-statement. Here, you get multiple options to chose from, based on what you want to be a trigger. In this case, we want to create a rule that triggers if the CVSS score of a vulnerability is ranked as high:

Add if statement Add equality Add comparison

You can modify the condition by using and/or operators like this.

Add and operator

If this example, we have created a rule that triggers if dependency is new AND CVSS is high. Next, we want to add the action to execute when the condition is true. There are multiple options including

  • Failing pipeline -- Fails your pipeline if the rule conditions are met.
  • Pipeline warning
    • GitHub -- Pipeline check is set to neutral if the rule conditions are met and a warning is printed. The pipeline passes.
    • GitLab, Bitbucket and Azure Devops -- Pipeline passes but a warning is printed.
  • Notification by email
  • Mark as unaffected -- Vulnerabilities that meet the conditions are marked as unaffected in the Debricked tool.
  • Flag as vulnerable -- Vulnerabilities that meet the conditions are flagged as vulnerable in the Debricked tool.

In this example, we want to fail the pipeline if the condition is true.

Add trigger

If you don’t want the rule to apply for vulnerabilities that have been marked as unaffected by you or someone on your team, leave the checkbox in the bottom right checked:

Ignore unaffected vulnerabilities

Once you have configured your rule it’s time to generate it. Clicking the button (see above) will create a written statement below the rule maker:

Generated rule

Make sure that the statement corresponds to what you were looking to achieve with your rule. There might be changes that need to be made to fulfill the purpose. For example, when creating a rule such as above, where any vulnerabilities with CVSS high will fail your pipeline, but vulnerabilities that lack a cvss score. Once you are happy with the statement it’s time to hit the save button. Please note that saving your rule will make it apply immediately. Once you have saved your rule, it will appear in the "Data Management" view for the selected repository.

Congratulations, you have created your first rule 😃

# Prevent new dependencies with vulnerabilities

Imagine you have a developer branch called dev where you add new exciting features. Being security-aware, you want to fail the pipeline if a new commit introduces a new vulnerability with a severity of high or more. You also want to be notified of this incident.

This is how you would go about setting up that rule in our automation engine.

Automation use case 1

# CVSS score is missing

The rule we just created will not trigger for vulnerabilities that lack a CVSS score. This does not mean that the vulnerability is not severe, but that the data source lacked the CVSS score information. To account for this, you can add the statement:

OR CVSS is missing.

Keep in mind that adding the OR statement does not take previous if or AND statements into consideration. In this example we therefore also want to add the statement:

AND dependency is new

to keep the rule from applying to existing dependencies when CVSS is missing. See condition precedents for more on this.

# Prevent unknown license families and GPL

In this scenario, we want to fail the pipelines if we include dependencies with either an unknown license family, or if the dependencies has any of the GPL-2.0 and AGPL-3.0 licenses. We also wish to notify all the administrators for the company account.

Prevent unknown license family or GPL

# Edit a rule

If you wish to edit a rule, click the three dots on the right-hand side of the rule and select "edit rule".

Edit rule

You’ll now be able to add or remove one or multiple conditions and actions. To enable the changes, press "Generate rule" and "Save".

# Disable a rule

To disable a rule, simply drag the button to the left.

Disabling rule

# Delete a rule

To permanently delete a rule, click the three dots on the right hand side of the rule and select "delete rule".

Delete rule