Custom risk provider

A custom risk provider uses JavaScript to retrieve or calculate risk information from a custom source.

Define the data the provider receives as inputs, the risk information it returns as outputs, and the code used to evaluate the risk. When the provider is added to a risk policy, its outputs become available to rules and risk scoring.

Create a custom risk provider

  1. Go to Policy resources → Risk providers.
  2. Select Create.
  3. Under Custom, select Custom Code.
  4. On the General tab, configure:
    • Name: name used to identify the provider.
    • Description: optional description of the provider.
    • Policy tag: optional policy tag used to organize and control access to the provider.
  5. Continue to the Configuration tab.

Configure inputs

Inputs define the data the custom risk provider needs.

When the provider is added to a risk policy, you select the source for each configured input.

To add an input:

  1. Under Inputs, select Add input.
  2. Enter:
    • Name: variable name used by the custom code.
    • Description: optional description of the input.
    • Type: data type of the input. Custom risk provider inputs currently use the string type.
  3. Select Add.

Repeat these steps for each value required by the provider.

Configure outputs

Outputs define the data returned by the provider. When the provider is added to a risk policy, its outputs are automatically available as read-only local variables under the configured namespace.

Enter a Namespace for the provider's outputs.

The level output is provided automatically. It is a normalized enum with the following values:

  • low
  • medium
  • high

To define additional outputs:

  1. Under Outputs, select Add output.
  2. Enter:
    • Name: name of the returned value.
    • Description: optional description of the output.
    • Type: data type of the returned value.
  3. Select Add.

Custom outputs can use string, number, boolean, and object values. Arrays are not supported.

📘

Inputs and outputs can only be edited while creating the custom risk provider because they are used by the custom code.

Configure the custom code

Use the custom code to retrieve or calculate the risk information returned by the provider.

The code must return a JSON object. Values defined as outputs are included in the provider result. Other values returned by the code are ignored.

The default result uses a risk level of low.

⚠️

Custom risk provider code does not currently support Variables and secrets.

Use the provider in a risk policy

After creating the provider, add it as a source to a risk policy.

When you add the source:

  • map the configured inputs to values available to the risk policy
  • use the provider's outputs in rules and risk scoring
  • use <namespace>.level as the provider's normalized Low, Medium, or High risk result

Did this page help you?