Conditional flows
You can execute and compare responses from multiple API calls in YAML tests
This instruction is required when you want to fire multiple API calls and compare their responses. A simple use case is testing for Username enumeration vulnerability using password-reset endpoint.
To configure Akto test YAML for multiple requests, set type: true
execute:
type: multiple # this means multiple requests are configured
requests:
- req:
...
- req:
... Instructions available -
For each request, you can now use
validateblock to test for a certain responsesuccessto specify which request to execute next ifvalidateblock returns truefailureto specify which request to execute next ifvalidateblock returns falseAnywhere, you can set
successorfailureasvulnerable(to mark a vulnerability) orexitRequests are named as
x1x2etc. automatically. You can use this to jump to a node onsuccessorfailure. You can also use them in data operators (eg response payload ofx1should have length > 80 characters)
If success or failure isn't specified, we jump to the next request. If it's the last request, then we jump to the validate block of the test.
Example - Try a wrong password. If API returns 4xx, then try with wrong usernames
Next step -
try with invalid usernames, and check if the response string is different. If they are different, then the application is vulnerable to username enumeration.
Complete YAML -
Last updated
Was this helpful?