For the complete documentation index, see llms.txt. This page is also available as Markdown.

Plugin Functions and Operators

Custom plugins support the mutation and assertion functions and a wide range of operators within each of them. These functions allow you to define how Traceable should inspect the APIs for vulnerabilities. The attributes in these functions refer to the specific elements in the request or response, such as headers, body, and query parameters, while the operators specify the comparison type to perform.

This document highlights details about attributes and operators, along with descriptions and examples of how to use them in the mutation and assertion functions.

Attributes and their Convention

Attributes are the elements in the API requests and responses. While writing custom plugins, you must refer to these attributes as part of the mutation and assertion functions.

As mentioned in the Working of a Plugin, Traceable creates a clone of the original request to create a mutated one. The attributes in these requests are represented in the following manner:

  • The attributes prefixed with original. correspond to the traffic being received or generated in the original request.

  • The attributes prefixed with mutated. correspond to the modified request

For example, the authorization header is represented as original.header.request.header.authorization in the original request and mutated.header.request.header.authorization in the mutated request.

The following is the common list of attributes that you can use while writing a custom plugin:

Common List of Attributes

Request URL

  • (original/mutated).http.request.method: "POST"

  • (original/mutated).http.request.url: "http://example.com?arg=val1&arg2=val2"

  • (original/mutated).http.request.url: "HTTP://example.com/order/{orderId}?arg=val1&arg2=val2"

  • (original/mutated).http.request.path.param.2: "1234"

  • (original/mutated).http.request.query.param.limit: 100

  • (original/mutated).net.host.scheme: https

  • (original/mutated).net.host.name: "example.com"

  • (original/mutated).net.host.port: 443

  • (original/mutated).http.request.header.content-type: "application/json"

Request Header

  • (original/mutated).http.request.header.*: <All header keys are in lowercase>

  • (original/mutated).http.request.header.user-agent: "curl/1.1"

  • (original/mutated).http.request.header.accept: "application/json"

  • (original/mutated).http.request.header.content-type: "application/json"

Request Cookie

  • (original/mutated).http.request.cookie.PHPSESSID: "064d213baaef028e724b06042a69561dceb256f3119721b846234d72dcc35134"

Request Body

  • (original/mutated).http.request.body: '{"username": "user1", "password": "p4s1d135DDg4"}'

  • (original/mutated).http.request.body.username: "user1"

  • (original/mutated).http.request.body.password: "user1"

  • (original/mutated).http.response.body: '{"token": "jshdlahflafnfbdfbkfnalfja", "msg": "Success"}'

  • (original/mutated).http.response.body.token: "jshdlahflafnfbdfbkfnalfja"

  • (original/mutated).http.response.body.msg: "Success"

Response

  • (original/mutated).http.response.code'

  • (original/mutated).http.response.duration

  • (original/mutated).http.response.header.*: <All header keys are in lowercase>

  • (original/mutated).http.response.cookie.PHPSESSID: "064d213baaef028e724b06042a69561dceb256f3119721b846234d72dcc35134"


Attribute Operators (Python Plugins only)

In Python-based custom plugins, attribute operators provide a way to interact with your API request and response. Using these operators, you can fetch, modify, or add attributes according to your requirements.

Whether you are retrieving a value for comparison or injecting a mutated field, these operators act as the building block for creating an accurate and adaptive plugin logic.

The following are the supported operators that you can use while writing a Custom Python Plugin:

Add Attributes from Another List

Description

This operator adds attributes from another attribute list. It adds new values without modifying the existing ones.

Syntax

Set Attributes from Another List

Description

This operator sets attributes from another attribute list. It modifies any existing values or creates them if they don’t exist.

Syntax

Get One Value

Description

This operator fetches one value from the attribute.

Syntax

Get Values

Description

This operator fetches values from the attribute.

Syntax

Get One Attribute

Description

This operator fetches one attribute.

Syntax

Get Original Value

Description

This operator fetches the original value from the attribute.

Syntax

Get Attribute List

Description

This operator fetches the attribute list iterator.

Syntax

Add Attributes

Description

This operator adds attributes to the list. If original_and_mutated is True, both original and mutated keys are added; otherwise, only one copy without a prefix is added.

Syntax

Modify Attributes

Description

This operator updates all attributes with the specified key. If first_only is True, only the first attribute is updated. If the key is not found, the instruction is ignored.

Syntax

Set Attributes

Description

This operator sets attributes to the list. If original_and_mutated is True, both original and mutated keys are modified or are created if they don’t exist; otherwise, only one copy without a prefix is modified or created.

Syntax

Expand Attributes

Description

This operator expands attributes to fetch values of the sub-attributes.

Syntax

Expand Templated Variables

Description

This operator expands templated variables to fetch the attribute value. For example, if the input is mutated.${authorization_header} and the authorization_header is request.header.jwt, then the output is mutated.request.header.jwt.

Syntax

Delete Attributes

Description

This operator deletes attributes from the attribute list.

Syntax


Mutation Function

The mutation function adds, modifies, and deletes specific parameters within API requests. While Traceable specifies this function by default in test plugins, you can define it according to your requirements in custom plugins.

Mutation Parameters and Syntax

The parameters within a custom plugin mutation function vary depending on the plugin type you are configuring. To learn about these parameters, click the tabs below according to your requirements.

A mutation function in a YAML-based plugin contains the following parameters:

Parameter
Description

action (String)

The type of operation that Traceable should perform. For more information, see Mutation Operators.

description

A description of what the mutation does.

key (String)

The query parameter on which Traceable should perform the operation.

kind

The data type of the value being specified below.

value

The value you wish to mutate on the above key.

After combining the parameters within a plugin, the syntax is:

A mutation function in a Python-based plugin contains the following parameters:

Parameters
Description

operator (String)

The type of operation that Traceable should perform. For more information, see Mutation Operators.

key (String)

The key or attribute that Traceable should mutate. The attributes are updated in Traceable's mutated request in the Cloning step.

value (Any)

The new value to replace the existing value. This parameter can contain any value, for example, none or an empty string (““). This value is stored in the mutated request.

After combining the parameters within a plugin, the syntax is:

Mutation Operators

The following are the supported operators that you can use along with the mutation function while writing a custom plugin:

While the operators remain the same for both YAML and Python-based custom plugins, the syntax may vary as shown in the examples of the respective operators.

MUTATION_ADD

Operator Tag

MUTATION_ADD

Description

This operator adds a new key attribute with the specified value. If the key attribute already exists, it duplicates it.

Example

The below example suffixes the URL with two query params ?id=100& id=50 to check parameter pollution.

YAML

Python

MUTATION_DELETE

Operator Tag

MUTATION_DELETE

Description

This operator deletes an existing key attribute.

Example

The below example removes the query param id from the API request.

YAML

Python

MUTATION_MODIFY

Operator Tag

MUTATION_MODIFY

Description

This operator modifies a key attribute if it exists; otherwise, it does nothing.

Example

The below example updates the query param id with the value 100 if it exists; otherwise, it ignores the instruction.

YAML

Python

MUTATION_SET

Operator Tag

MUTATION_SET

Description

This operator sets the value of an existing key attribute or adds it if it does not exist.

Example

The below example sets the query param id to 100 if it exists; otherwise, it creates a query param id with the same value.

YAML

Python

MUTATION_REGEX_DELETE

Operator Tag

MUTATION_REGEX_DELETE

Description

This operator deletes all attributes that match the key/regular expression with the value.

Example

The below example deletes all query params ending with the string “amount”.

YAML

Python

MUTATION_REGEX_MODIFY

Operator Tag

MUTATION_REGEX_MODIFY

Description

This operator modifies all attributes that match the key/regular expression with the value.

Example

The below example modifies the query params ending with the string “amount” with the value 100 if it exists; otherwise, it ignores the instruction.

YAML

Python

MUTATION_REGEX_SET

Operator Tag

MUTATION_REGEX_SET

Description

This operator sets all attributes that match the key/regular expression with the value.

Example

The below example sets the query params ending with the string “amount” with the value 100 if it exists; otherwise, it ignores the instruction.

YAML

Python


Assertion Function

The Assertion Function in custom plugins is used to evaluate API responses for vulnerabilities by comparing specific values in the response to expected outcomes, with various operators available to define the conditions for a successful match. The following sections explain the various subfunctions and operators.

Assertion Types

Assertion functions can be of two types:

Assertion Type
Description

IMMEDIATE

These assertions execute immediately after Traceable encounters them in the plugin definition. If the condition fails, Traceable stops further execution based on the logic. For example, verify whether the response code of the mutated request is 200.

LOGICAL

These assertions evaluate conditions at the end of the scan or execution rather than immediately. This allows for the aggregation of multiple results before making a final decision. For example, verify if at least one of the multiple mutated requests can access sensitive data.

For more information on this function, see the sections below.

Assertion Parameters and Syntax

The parameters within a custom plugin assertion function vary depending on the plugin type you are configuring. To know about these parameters, click the below tabs according to your requirements.

An assertion function in a YAML-based plugin contains the following parameters:

Parameters
Description

lhs (String)

The mutated value for comparison.

rhs (String)

The original value for comparison.

operator (String)

The match operator used for comparison.

key (String)

Used for display purposes as part of visualization on the UI. It is not used for any processing.

description

A description of what the assertion does.

assertionType

The type of assertion Traceable should execute on the above parameters.

After combining the parameters within a plugin, the syntax is:

An Assertion Function in a Python-based plugin contains the following parameters:

Parameters
Description

key (String)

Used for display purposes as part of visualization on the UI. It is not used for any processing.

operator (String)

The match operator used for comparison.

mutated (String)

The mutated value for comparison.

original (String)

The original value for comparison.

**kwargs (optional)

Additional parameters used to provide metadata for the assertion. These parameters can vary depending on the match operator used.

After combining the parameters within a plugin, the Assertion Function syntax is:

A Logical Assertion function in a Python-based plugin contains the following parameters:

Parameters
Description

operator (String)

The operator for evaluation between assertion functions.

Assertion function

The assertion functions for evaluation based on the above operator.

After combining the parameters within a plugin, the Logical Assertion Function syntax is:

Assertion Operators

Assertion operators are divided based on the assertion types. While the assertion operators can be used individually, the logical assertion operators are used in combination with the assertion functions and operators to write a custom plugin. The following sections explain these operators along with an example.

Logical Assertion Operators

The following are the supported logical operators that you can use in combination with the assertion functions while writing a custom plugin:

While the operators remain the same for both YAML and Python-based custom plugins, the syntax may vary as shown in the examples of the respective operators.

LOGICAL_OPERATOR_AND

Operator Tag

LOGICAL_OPERATOR_AND

Description

This operator returns VULN(True) if all the assertion functions within the assertion list are VULN(True).

Example

The below example evaluates to True if both the:

  • Mutated response body matches the Original response body.

  • Mutated response code matches the Original response code.

YAML

Python

LOGICAL_OPERATOR_OR

Operator Tag

LOGICAL_OPERATOR_OR

Description

This operator returns VULN(True) if either of the assertion functions within the assertion list are VULN(True).

Example

The below example evaluates to True if either the:

  • Mutated response body matches the Original response body

  • Mutated response code matches the Original response code.

YAML

Python

Assertion Operators

The following are the supported operators that you can use along with the assertion function while writing a custom plugin:

While the operators remain the same for both YAML and Python-based custom plugins, the syntax may vary as shown in the examples of the respective operators.

MATCH_OPERATOR_EQUALS

Operator Tag

MATCH_OPERATOR_EQUALS

Description

This operator checks whether the LHS/mutated value matches the RHS/original value. If it does, the assertion evaluates to True/Vulnerable; otherwise, it evaluates to False/Not Vulnerable.

Example

The below example evaluates to True if the response code received from the mutated request matches the response code received from the original request.

YAML

Python

MATCH_OPERATOR_NOT_EQUALS

Operator Tag

MATCH_OPERATOR_NOT_EQUALS

Description

This operator checks whether the LHS/mutated value does not match the RHS/original value. If it does not, the assertion evaluates to True/Vulnerable; otherwise, it evaluates to False/Not Vulnerable.

Example

The below example evaluates to True if param1 received in the body of the response received for the mutated request does not match param1 in the body of the response received from the original request.

YAML

Python

MATCH_OPERATOR_MATCHES_REGEX

Operator Tag

MATCH_OPERATOR_MATCHES_REGEX

Description

This operator checks whether the LHS/mutated value matches the regex. If it does, the assertion evaluates to True/Vulnerable; otherwise, it evaluates to False/Not Vulnerable.

Example

The below example evaluates to True if the response code received for the mutated request matches the specified regular expression.

YAML

Python

MATCH_OPERATOR_NOT_MATCHES_REGEX

Operator Tag

MATCH_OPERATOR_NOT_MATCHES_REGEX

Description

This operator checks whether the LHS/mutated value does not match the regex. If it does not, the assertion evaluates to True/Vulnerable; otherwise, it evaluates to False/Not Vulnerable.

Example

The below example evaluates to True if the response code received for the mutated request does not match the specified regular expression.

YAML

Python

MATCH_OPERATOR_GREATER_THAN

Operator Tag

MATCH_OPERATOR_GREATER_THAN

Description

This operator checks whether the LHS/mutated value is greater than the RHS/original value. If it is, the assertion evaluates to True/Vulnerable; otherwise, it evaluates to False/Not Vulnerable.

Example

The below example evaluates to True if the time taken to receive a response to the mutated request takes longer than 100 ms.

YAML

Python

MATCH_OPERATOR_GREATER_THAN_EQUALS

Operator Tag

MATCH_OPERATOR_GREATER_THAN_EQUALS

Description

This operator checks whether the LHS/mutated value is greater than or equal to the RHS/original value. If it is, the assertion evaluates to True/Vulnerable; otherwise, it evaluates to False/Not Vulnerable.

Example

The below example evaluates to True if param1 in the body of the response received for the mutated request has a value greater than or equal to 100.

YAML

Python

MATCH_OPERATOR_LESS_THAN

Operator Tag

MATCH_OPERATOR_LESS_THAN

Description

This operator checks whether the LHS/mutated value is less than the RHS/original value. If it is, the assertion evaluates to True/Vulnerable; otherwise, it evaluates to False/Not Vulnerable.

Example

The below example evaluates to True if param1 in the body of the response received for the mutated request has a value less than 100.

YAML

Python

MATCH_OPERATOR_LESS_THAN_EQUALS

Operator Tag

MATCH_OPERATOR_LESS_THAN_EQUALS

Description

This operator checks whether the LHS/mutated value is less than or equal to the RHS/original value. If it is, the assertion evaluates to True/Vulnerable; otherwise, it evaluates to False/Not Vulnerable.

Example

The below example evaluates to True if param1 in the body of the response received for the mutated request has a value less than or equal to 100.

YAML

Python

MATCH_OPERATOR_CONTAINS

Operator Tag

MATCH_OPERATOR_CONTAINS

Description

This operator checks whether the LHS/mutated value contains the LHS/original value. If it does, the assertion evaluates to True/Vulnerable; otherwise, it evaluates to False/Not Vulnerable. It also supports various Python data structures, such as lists, sets, and strings.

Example

The below example evaluates to True if param1 in the body of the response received for the mutated request contains the key word “Unauthorized”.

YAML

Python

MATCH_OPERATOR_IN

Operator Tag

MATCH_OPERATOR_IN

Description

This operator checks whether the LHS/mutated value is present in the RHS/original value. If it is, the assertion evaluates to True/Vulnerable; otherwise, it evaluates to False/Not Vulnerable.

Example

The below example evaluates to True if the message in the body of the response received for the mutated request includes either “Failed” or “Errored”.

YAML

Python

MATCH_OPERATOR_NOT_IN

Operator Tag

MATCH_OPERATOR_NOT_IN

Description

This operator checks whether the LHS/mutated value is not present in the RHS/original value. If it is not, the assertion evaluates to True/Vulnerable; otherwise, it evaluates to False/Not Vulnerable.

Example

The below example evaluates to True if the message in the body of the response received for the mutated request does not include either “Failed” or “Errored”.

YAML

Python

MATCH_OPERATOR_KEYS_EQUALS

Operator Tag

MATCH_OPERATOR_KEYS_EQUALS

Description

This operator checks whether the LHS/mutated value is not present in the RHS/original value. If it is not, the assertion evaluates to True/Vulnerable; otherwise, it evaluates to False/Not Vulnerable.

Example

The below example evaluates to True if the keys in the body of the response received for the mutated request has the same set of keys in the body of the response received for the original request - up to a depth of 5 for the JSON encoded tree.

YAML

Python

MATCH_OPERATOR_KEYS_NOT_EQUALS

Operator Tag

MATCH_OPERATOR_KEYS_NOT_EQUALS

Description

This operator checks whether the LHS/mutated value is not present in the RHS/original value. If it is not, the assertion evaluates to True/Vulnerable; otherwise, it evaluates to False/Not Vulnerable.

Example

The below example evaluates to True if the keys in the body of the response received for the mutated request does not have the same set of keys in the body of the response received for the original request - up to a depth of 5 for the JSON encoded tree.

YAML

Python

MATCH_OPERATOR_FUZZY_EQUALS

Operator Tag

MATCH_OPERATOR_FUZZY_EQUALS

Description

This operator checks whether the LHS/mutated and RHS/original values match up to the specified threshold. If they do, the assertion evaluates to True/Vulnerable; otherwise, it evaluates to False/Not Vulnerable.

Example

The below example evaluates to True if the body of the response received for the mutated request matches (at least up to the threshold value of 80%) with the response received for the original request, up to a depth of 5 for the JSON encoded tree.

YAML

Python

MATCH_OPERATOR_FUZZY_NOT_EQUALS

Operator Tag

MATCH_OPERATOR_FUZZY_NOT_EQUALS

Description

This operator checks whether the LHS/mutated and RHS/original values do not match up to the specified threshold. If they do not, the assertion evaluates to True/Vulnerable; otherwise, it evaluates to False/Not Vulnerable.

Example

The below example evaluates to True if the body of the response received for the mutated request does not match (at least up to the threshold value of 80%) with the response received for the original request, up to a depth of 5 for the JSON encoded tree.

YAML

Python

MATCH_OPERATOR_FUZZY_KEYS_EQUALS

Operator Tag

MATCH_OPERATOR_FUZZY_KEYS_EQUALS

Description

This operator checks whether the LHS/mutated and RHS/original values are JSON/URL-encoded parseable and the keys match up to the specified threshold. If they do, the assertion evaluates to True/Vulnerable; otherwise, it evaluates to False/Not Vulnerable.

Example

The below example evaluates to True if the keys in the body of the response received for the mutated request matches (at least up to the threshold value of 80%) with the keys in the body of the response received for the original request - up to a depth of 5 for the JSON encoded tree.

YAML

Python

MATCH_OPERATOR_FUZZY_KEYS_NOT_EQUALS

Operator Tag

MATCH_OPERATOR_FUZZY_KEYS_NOT_EQUALS

Description

This operator checks whether the LHS/mutated and RHS/original values are JSON/URL-encoded parseable and the keys match up to the specified threshold. If they do, the assertion evaluates to False/Not Vulnerable; otherwise, it evaluates to True/Vulnerable.

Example

The below example evaluates to True if the keys in the body of the response received for the mutated request does not match (at least up to the threshold value of 80%) with the keys in the body of the response received for the original request - up to a depth of 5 for the JSON encoded tree.

YAML

Python

MATCH_OPERATOR_VALUES_DIFFERENCE

Operator Tag

MATCH_OPERATOR_VALUES_DIFFERENCE

Description

This operator checks if the absolute difference between the LHS/mutated and RHS/original value is a certain amount.

Example

The below example evaluates to True if the query param id of the mutated request differs from the response parameter id by a value of 100.

YAML

Python

MATCH_OPERATOR_REGEXLOOKUP_EQUALS

Operator Tag

MATCH_OPERATOR_REGEXLOOKUP_EQUALS

Description

This operator works in two steps:

  1. Lookup for all attributes matching the LHS/mutated regex and use them in step 2.

  2. If all attributes matched in step 1, match the RHS/original value, return True/Vulnerable; otherwise, return False/Not Vulnerable.

Example

The below example evaluates to True if all parameters that match the specified regex in response to the mutated request contain the value 15.

YAML

Python

MATCH_OPERATOR_REGEXLOOKUP_NOT_EQUALS

Operator Tag

MATCH_OPERATOR_REGEXLOOKUP_NOT_EQUALS

Description

This operator works in two steps:

  1. Lookup for all attributes matching the LHS/mutated regex and use them in step 2.

  2. If all attributes matched in step 1, do not match the RHS/original value, return True/Vulnerable; otherwise, return False/Not Vulnerable.

Example

The below example evaluates to True if all parameters that match the specified regex in response to the mutated request do not contain the value 15.

YAML

Python

MATCH_OPERATOR_REGEXLOOKUP_MATCHES_REGEX

Operator Tag

MATCH_OPERATOR_REGEXLOOKUP_MATCHES_REGEX

Description

This operator works in two steps:

  1. Lookup for all attributes matching the LHS/mutated regex and use them in step 2.

  2. If all attributes matched in step 1, match the RHS/original regex, return True/Vulnerable; otherwise, return False/Not Vulnerable.

Example

The below example evaluates to True if all parameters that match the specified regex in the response to the mutated request contain a value that matches the regex 141[a-z0-9]{1,10}411.

YAML

Python

MATCH_OPERATOR_REGEXLOOKUP_NOT_MATCHES_REGEX

Operator Tag

MATCH_OPERATOR_REGEXLOOKUP_NOT_MATCHES_REGEX

Description

This operator works in two steps:

  1. Lookup for all attributes matching the LHS/mutated regex and use them in step 2.

  2. If all attributes matched in step 1, do not match the RHS/original regex, return True/Vulnerable; otherwise, return False/Not Vulnerable.

Example

The below example evaluates to True if all parameters that match the specified regex in the response to the mutated request do not contain a value that matches the regex 141[a-z0-9]{1,10}411.

YAML

Python

MATCH_OPERATOR_ALWAYS_TRUE

Operator Tag

MATCH_OPERATOR_ALWAYS_TRUE

Description

This operator always returns True/Vulnerable. It is mostly useful when you are writing plugins and want to test dummy assertions.

Example

The below example evaluates to True every time.

YAML

Python

MATCH_OPERATOR_ALWAYS_FALSE

Operator Tag

MATCH_OPERATOR_ALWAYS_FALSE

Description

This operator always returns False/Not Vulnerable. It is mostly useful when you are writing plugins and want to test dummy assertions.

Example

The below example evaluates to False every time.

YAML

Python

MATCH_OPERATOR_COLLABORATOR_LOOKUP_CONTAINS

Operator Tag

MATCH_OPERATOR_COLLABORATOR_LOOKUP_CONTAINS

Description

This operator is used for SSRF-based scans, where if the application reaches out to Traceable collaborator, it looks out for the presence of test id in the payload received by the collaborator.

Example

The below example evaluates to True if the payload (from the application) received by the collaborator contains the test id.

YAML

Python

MATCH_OPERATOR_RAW

Operator Tag

MATCH_OPERATOR_RAW

Description

This operator executes raw lambda code supplying it with LHS/mutated and RHS/original values. If lambda returns True, it is marked as Vulnerable, else Not Vulnerable.

Example

The below example evaluates to TRUE if the value RSA is present in the mutual TLS protocol ciphers.

YAML

Python

Last updated

Was this helpful?