Validation

This section describes the conditions that serve as validation criteria for determining whether a particular endpoint is vulnerable to a given test.

Syntax

The syntax is the similar to API Selection Filters. The operators used for filtering or selecting APIs to run for testing are also used to validate whether the test attempt is vulnerable.

Let’s look at few examples and understand how to write validations -

Example 1

# Validation Scenario - 
# condition 1: Response Code Should be either 200 or 201.
# condition 2: Response Payload Should contain a key whose value contains substring “admin”
# condition 3: Response Headers Should contain a key “origin”
# All conditions are mandatory.
# Sample Yaml - 

validate:
  response_code:
    or:
      eq: 200
      eq: 201
  response_payload:
    for_one:
      value:
        contains_either: admin
  response_headers:
    for_one:
      key:
        eq: origin

Example 2

There 2 extra instructions in the validation block -

percentage_match

Percentage Match operator is used for applying conditions on how similar sample response and test response are. Let’s explore this more through the below example

percentage_match_schema

This operator is used for applying conditions on how structurally similar sample response and test response are. Here we look at keys of the json payloads. Values are ignored.

Last updated

Was this helpful?