RBA - Rule definition
In the context of RBA, a rule is a configuration item used within “risk policies”. Reminder: there are environment risk policies, user risk policies, and authentication risk policies.
A risk policy holds a set of rules. A rule consists of:
A matching criterion (condition), written as a Groovy script, returning either
true
orfalse
. The syntax of Groovy scripts is detailed belowAn action that the system applies if the rule criterion matches.
The possible actions applied when a rule matches are listed in the table below.
Types of Rule Actions
When a policy rule evaluates to true
, the RBA engine executes an action. The type of action depends on the policy that contains the rule:
Environment and User Risk Policies adjust the risk score (increase or decrease) of the incoming connection request.
Authentication Risk Policies increase the minimum authentication level required to access the target application.
This table shows how each rule action works and how it affects the risk evaluation process.
Rule Action Type | Description | Computation Principle |
---|---|---|
Risk rule action | This rule defines a numeric correction value that modifies the current risk score. |
|
Authentication rule action (used in Authentication Risk Policies) | This rule defines a new authentication level in a numeric value. When the Groovy script returns |
|
The RBA evaluates each rule dynamically using contextual data available in Groovy as “variables”, for example, the number of days since the last successful authentication. The rule uses the current risk evaluation context (user info, device info, authentication state, etc.) as input.
When the Groovy rule returns true
, the rule immediately contributes to the risk evaluation:
A risk rule modifies the current risk score by adding or subtracting its configured correction value.
An authentication rule increases the required minimum authentication level if its configured value is higher than the current one.
The structure of a criteria
Context variables accepted in condition rules
RBA rules are based on “matching conditions”, meaning all condition rules written in Groovy scripts return either true
or false
.
These Groovy scripts have access to context variables, which are described in this section.
Request Groovy Context
The request groovy context (REQ
) gives information about the user's HTTP request, such as HTTP headers.
You can use it everywhere. However, it’s especially useful for environment rules defined in the EnvironmentRiskPolicy
.
Variable Name | Java Type | Description | Example Usage | |
---|---|---|---|---|
|
| The user agent header. Default value: |
| |
|
| How to evaluate the risk. Possible values:
|
| |
|
| Check whether the remote IP address of the client at the origin of the RBA request matches a specific IP address or a range specified using the IP/Netmask. For example, |
| |
|
| The request's HTTP headers (including Always write header names in lowercase. |
| |
|
| The request date. Default value: |
| |
|
| The type of access requested when evaluating the risk. Possible values are:
|
|
Device Groovy Context
The Device groovy context (DEVICE
) gives information about a user device. It describes whether or not the user device has been recognized successfully, and provides various meta-information on the device.
This context is especially useful for rules defined in EnvironmentRiskPolicy
and AuthenticationRiskPolicy
.
Variable Name | Java Type | Description | Example Usage | |
---|---|---|---|---|
|
| The device status. Accepted values:
Default value: |
| |
|
| The device type. Accepted values:
Default value: |
| |
|
| The last time the user used the device. Null if the user is not identified yet (transparent authentication request). Default value: Jan 1, 1970 |
| |
|
| The name of the device set by the user. Null if the user is not identified yet (transparent authentication request). Default value: |
CODE
| |
|
| The device's operating system. This information comes from the client, it may have been forged by a malicious user. Default value: |
| |
|
| The device's operating system version. This information comes from the client, it may have been forged by a malicious user. Default value: |
CODE
| |
|
| The device's browser. This information comes from the client, it may have been forged by a malicious user. Default value: |
| |
| The device's browser version. This information comes from the client, it may have been forged by a malicious user. Default value: |
CODE
|
User Groovy context
The User groovy context (USER
) gives information about the identified user.
This context should only be referenced in UserRiskPolicy
rules. Indeed, those rules are not evaluated when the user is not identified, which happens for transparent authentication requests (Kerberos, X509 client certificate).
Variable Name | Java Type | Description |
---|---|---|
|
| The user's tenant Identity id. Default value: |
Application Groovy context
The Application Groovy context (APP
) gives information about the application for which the authentication is performed, with all attributes that may be used in order to compute a score.
This context is useful when you configure Authentication Risk Policies scopes.
Variable Name | Java Type | Description | Example Usage | |
---|---|---|---|---|
|
| The risk tolerance associated with the application. This is a positive integer value where the lowest value (0) corresponds to a low tolerance (which should result in a low Maximum Acceptable Risk) and the highest value corresponds to a high tolerance (which should result in a high Maximum Acceptable Risk). Usually, the values are 0, 1 or 2. However, there isn’t a formal upper limit. Default value: 0 |
| |
|
| The application's name, which is the Resource id. Default value: |
CODE
| |
|
| The authentication level required to access the application. It may help categorize applications in authentication policy rules. Default value: 0 |
|
Risk Evaluation Groovy context
The Risk Evaluation groovy context (RISK
) gives information about the ongoing risk evaluation.
This context is useful when you write authentication rules. Indeed, the RBA engine can define an authentication level to apply if some rules match.
Variable name | Java type | Description | Example | |
---|---|---|---|---|
|
| The environment rules that matches to compute the environment risk. |
| |
|
| The user rules that matches to compute the user risk. |
| |
|
|
The system sets the value to true if there is no user information in the RBA request. For example, when the request corresponds to transparent authentication methods such as X509 or Kerberos.
Default value: |
CODE
|
Location Dynamic Groovy context
The Location Dynamic (DYN.location
) groovy context retrieves information about the input parameters of the geolocation from the remote IP address.
Variable name | Java type | Description | Example | |
---|---|---|---|---|
|
| The name of the continent where the authentication takes place. In English and lowercase. Default value: |
CODE
| |
|
| Two-letter continent code:
Default value: |
| |
|
| The country where the authentication takes place. In English and lowercase. Default value: |
| |
|
| The country code based on the ISO 3166-1 alpha-2 standards. Example: enter Default value: |
| |
|
| The region where the authentication takes place. In English and lowercase. Default value: |
| |
|
| The city where the authentication takes place. In English and lowercase. Default value: |
| |
|
| The timezone where the authentication takes place. Default value: |
| |
|
| Time when the authentication takes place in the location's timezone. Default value: |
|
Device Dynamic Groovy context
The Device Dynamic (DYN.device
) groovy context retrieves information about the input parameters of the user’s device authentication history.
Variable name | Java type | Description | Example | |
---|---|---|---|---|
|
|
Default value: |
| |
|
| The speed in km/h from the last successful authentication and the current authentication. Default value: Infinite |
| |
|
| The region where the last successful authentication occurred. In English and lowercase. Default value: |
| |
|
| The distance in km from the last successful authentication and the current authentication. Default value: Infinite |
| |
|
| The country code of the last successful authentication. Use a code from the ISO 3166-1 alpha-2 standard. Default value: |
| |
|
| The country of the last successful authentication. In English and lowercase. Default value: |
| |
|
| The city of the last successful authentication. In English and lowercase. Default value: |
| |
|
| The date of the last authentication failure (passive or interactive). Default value: Now |
| |
|
|
Default value: |
| |
|
| Number of days since the last successful authentication. Default value: Infinite |
| |
|
| The last successful authentication date (passive or active). Default value: Jan 1, 1970 |
|
User Dynamic Groovy Context
The User Dynamic (DYN.user
) groovy context retrieves information about the input parameters of the user authentication history.
Only reference this context in UserRiskPolicy
rules. Indeed, the system doesn’t evaluate UserRiskPolicy
rules when the user is not identified, which happens for transparent authentication requests.
Variable name | Java type | Description | Example | |
---|---|---|---|---|
|
| The date of the last successful authentication (passive or interactive). Default value: Jan 1, 1970 |
| |
|
| The date of the last successful interactive authentication. Default value: Jan 1, 1970 |
| |
|
|
Default value: |
| |
|
| Number of days since the last successful authentication. Default value: Infinite |
| |
|
| Number of days since the last successful interactive authentication. Default value: Infinite |
| |
|
| The date of the last authentication failure (passive or interactive). Default value: Now |
| |
|
| A number between 0 and 10 that indicates the last consecutive failed accesses. Default value: |
| |
|
| A number between 0 and 10 that indicates the last consecutive successful accessesd. Default value: |
| |
|
| The number of failures in the last 10 access attempts. Enter a number between 0 and 10. Default value: |
| |
|
| The number of successes in the last 10 access attempts. Enter a number between 0 and 10. Default value: |
| |
|
| The country of the last successful authentication. In English and lowercase. Default value: |
| |
|
| The country code of the last successful authentication. Use a code from the ISO 3166-1 alpha-2 standard. Default value: |
| |
|
| The region of the last successful authentication. In English and lowercase. Default value: |
| |
|
| The city of the last successful authentication. In English and lowercase. Default value: |
| |
|
| The distance in km from the last successful authentication and the current authentication. Default value: Infinite |
| |
|
| The speed in km/h from the last successful authentication and the current authentication. Default value: Infinite |
| |
|
|
Default value: |
|
Handle Groovy errors
Handle Groovy errors
Groovy errors can happen when the RBA evaluates rules. There are two types of errors:
Compilation errors:
Compilation errors occur if the Groovy script syntax is incorrect.
They are detected early, when the administrator writes or updates the rule.
Compilation errors don't affect end users. The administrator fixes the syntax and resubmits the rule.Runtime errors:
Runtime errors happen during rule execution, when end users access applications.
For example, an error occurs if the script tries to access a list element that does not exist.
The RBA handles runtime errors carefully to avoid blocking all users. Instead, it tries to allow authentication, sometimes requiring stronger authentication than usual.
You can also use the standard Groovy logger inside your scripts to help with troubleshooting. For example:
LOG.debug("Something")
This lets you capture errors or debug messages in the usual log stream.