Skip to content

Browser Actions Authentication with Escape

Description

The Browser Actions authentication preset is ideal for scenarios where traditional authentication methods fall short, as it leverages browser actions to perform login tasks. This preset is especially effective for form-based authentication where inputs are provided directly. Contrary to the Browser Agent preset, this preset does not use an AI Agent to perform the actions, but rather a browser automation actions based on Playwright actions and locators. By default, the preset automatically extracts cookies, localStorage andsessionStorage from the browser. If your scan is a Frontend scan, everything will be injected into the scanner's engine, to clone the browser behavior. If your scan is an API scan, only the cookies will be injected. If your authentication process stores credentials in local/session storage and you need to authenticate an API, be sure to configure the extractions and injections parameters accordingly.

Examples

presets:
-   type: browser_actions
    users:
    -   username: frontend-user@example.com
        actions:
        -   url: https://example.com/login
            action: goto
        -   action: wait_page_loaded
        -   action: fill
            auto_submit: false
            locator: input[name="username"]
            value: user@escape.tech
        -   action: fill
            auto_submit: false
            locator: input[name="password"]
            value: password123
        -   action: check
            locator: input[type="checkbox"]
        -   action: select
            locator: select#country
            value: France
        -   action: click
            locator: button[type="submit"]
presets:
-   type: browser_actions
    injections:
    -   key: Authorization
        location: header
        prefix: 'Bearer '
        variable: access_token
    extractions:
    -   name: token
        jq: .token
        key: token
        location: browser_local_storage
        origin: https://auth.example.com
    users:
    -   username: api-user
        actions:
        -   url: https://example.com/login
            action: goto
        -   action: wait_page_loaded
        -   action: fill
            auto_submit: false
            locator: input[name="username"]
            value: user@escape.tech
        -   action: fill
            auto_submit: false
            locator: input[name="password"]
            value: password123
        -   action: check
            locator: input[type="checkbox"]

Extensive Configuration

Property Type Default Description
extractions List[BrowserExtraction] null The extractions used to extract from the browser like page, browser_local_storage, browser_session_storage, or browser_cookies.
injections Union[BrowserInjection,HTTPInjection] null The injection configuration used to inject the tokens into either the HTTP requests, or another browser for Frontend scans.
type * Const[browser_actions] browser_actions
users * List[BrowserActionsUserPreset] The list of users to generate tokens for.

Objects

BrowserActionsUserPreset

Property Type Default Description
actions * List[CheckAction,ClickAction,FillAction,FocusPageAction,GotoAction,SelectAction,SleepAction,WaitElementAction,WaitPageLoad] The actions to perform on the browser
cookies Dict[string, string] null Optional cookies injected during the authentication process and in authentified requests.
headers Dict[string, string] null Optional headers injected during the authentication process and in authentified requests.
username * string The username of the user.

BrowserExtraction

Property Type Default Description
jq string null The jq expression to extract the value from the session storage item
key * string The key to use for the extracted value, depending on the location. In the case of Page location, this represents a Playwright selector
location * BrowserLocation The location of the browser where the value should be extracted.
name * string The name of the variable to store the extracted value into that will be used for injection
origin * string The URL of the page, origin of the local/session storage, or cookies where the value should be extracted.
regex string null The regex to use to extract the token from the key value. By default the entire value is taken.

BrowserInjection

Property Type Default Description
key * string The key to use for the injected token. Its usage depends on the location.
location * BrowserLocation The location of the browser where the token should be injected
origin * string The origin of the local storage or session storage where the token should be injected
variable * string The name of a variable to retrieve to create the token's value. If not provided, the token will be infered as the first successful extraction of the procedure

CheckAction

Property Type Default Description
action * Const[check] check
locator * string The selector of the checkbox to check

ClickAction

Property Type Default Description
action * Const[click] click
locator * string The selector to click on

FillAction

Property Type Default Description
action * Const[fill] fill
auto_submit boolean false Whether the form should be automatically submitted after the fill action
locator * string The selector to fill
value * string The value to fill in the field

FocusPageAction

Property Type Default Description
action * Const[focus_page] focus_page
url_pattern * string The URL pattern (regex) to match for focusing on a page

GotoAction

Property Type Default Description
action * Const[goto] goto
url * string The URL to navigate to

HTTPInjection

Property Type Default Description
key * string The key to use for the injected token. Its usage depends on the location. For headers, cookies,and query parameters, this key describes the name of the header, cookie or query parameter. For a body location, the key is the field where the token should be injected within the request bodies
location * HTTPLocation The location of the HTTP request where the token should be injected
prefix string null A prefix to prepend to the token before it is injected
variable * string The name of a variable to retrieve to create the token's value. If not provided, the token will be infered as the first successful extraction of the procedure

SelectAction

Property Type Default Description
action * Const[select] select
locator * string The selector of the dropdown to select from
value * string The value to select

SleepAction

Property Type Default Description
action * Const[sleep] sleep
seconds * number The time to sleep in seconds

WaitElementAction

Property Type Default Description
action * Const[wait_element] wait_element
locator * string The selector to wait for
timeout number 10 The timeout to wait for the element to be visible

WaitPageLoad

Property Type Default Description
action * Const[wait_page_loaded] wait_page_loaded

Enums

BrowserLocation

Value
page
browser_local_storage
browser_session_storage
browser_cookies

HTTPLocation

Value
header
cookie
body
query