Skip to content
Open dashboard (opens in a new tab)

Applications

Scope

Scope is the set of URLs a scan is allowed to request. By default a scan stays on the application’s own host and requests anything it finds there. You change that in two ways:

  • Exclusions take things out: URLs the scan must never request, and on a web application, elements it must never click.
  • User-defined domains put things in: other hosts that are part of the same web application.

In the dashboard: Applications

Open Applications (opens in a new tab)

Both are settings on the application, so every scan of it uses them, whether it starts from the dashboard, a schedule or the CLI.

To see what a scan actually requested, open the scan’s Coverage tab.

Scans send real requests and click real buttons. A request to a logout link ends the session, and a request to a delete or reset endpoint does what it says. Exclude those before you scan.

Every new application starts with a default list that keeps scans away from pages that end or change a session: log out, sign out, password and registration pages. The list is written as patterns such as .*logout.* and .*password.*. You can remove a default, and you can add your own.

  1. Open the application, then More settings and Exclusions.
  2. Under Excluded URL patterns, type a pattern and select Add, or press Enter. Remove a pattern with the cross on its chip.
  3. On a web application, do the same under Excluded clicks based on XPath.
  4. Select Save exclusions. The next scan uses them.
The Exclusions panel for customer-portal. A warning explains that requests to some paths can end sessions or delete data. Excluded URL patterns lists three patterns for logout, account deletion and admin reset. Excluded clicks based on XPath lists two expressions. A Save exclusions button is at the bottom.
URL patterns and XPath clicks that scans never request.

API applications have URL patterns only. There is nothing to click.

You can also set exclusions when you add an application, under Exclusions in the form.

The New scan setup has an Exclusions field, one pattern per line, and on a web application Exclude clicks based on XPath. Anything you change there is saved on the application when the scan starts, so it applies to later scans too.

A URL pattern is a regular expression. Three rules explain almost every surprise:

  • It is matched against the whole URL, scheme and host included, without the query string or fragment. A bare word matches nothing. Wrap it in .* to match it anywhere.
  • It is not case sensitive.
  • It follows Java regular expression syntax, which is what the scan engine reads.
To exclude Pattern
One exact page https://portal\.example\.com/account/close
Everything under a path https://portal\.example\.com/admin/.*
Any URL that contains a word .*logout.*
Any URL that ends a certain way .*\.pdf
A path on any host .*/account/delete.*

Escape a literal dot as \.. An unescaped dot matches any character, which usually still works but matches more than you meant.

Each list holds up to 500 entries of up to 5,000 characters each.

On a web application, the crawler clicks buttons and links to find pages. An XPath exclusion names an element it must leave alone. Use it when an action has no URL of its own to exclude, such as a button that signs the user out or deletes something through a script.

//button[@id="delete-account"]
//a[contains(@href, "signout")]

When an exclusion blocks the whole application

Section titled “When an exclusion blocks the whole application”

Because a pattern is matched against the whole URL, a pattern meant for a path can also match the application’s own address. .*portal.* is meant to skip a portal page, but it matches every URL of an application at https://portal.example.com. The scan then excludes the entire application and fails.

NightVision checks for this and warns you wherever you can fix it:

  • In the Applications list, the row is marked Exclusion conflict. Hover over it to see which pattern is the cause.
  • At the top of the application’s page, a warning names the pattern and offers Remove exclusion.
  • In the Exclusions panel, the New application form and the New scan setup, the same warning appears as you type.
A row in the Applications list for customer-portal at https://portal.example.com, marked Exclusion conflict. A tooltip reads: .portal. matches this application’s own address, so scans exclude the whole application and fail.
An exclusion that matches the application's own address.

To find every affected application, set the Exclusions filter on the Applications list to Conflict with the address.

Remove exclusion removes that one pattern from that one application and leaves the rest of the list as it is. Then write a narrower pattern, for example .*/portal/.*, if you still need one.

Many web applications are spread over more than one host: the pages on one, an API on another, sign-in on a third. A scan stays on the application’s own host unless you tell it the others belong. User-defined domains are that list.

User-defined domains apply to web applications.

  1. Open the application, then More settings and User-defined domains.
  2. Select Add domain.
  3. Enter the Domain URL, for example https://static.portal.example.com/, and select Add.
The User-defined domains panel for customer-portal with Export CSV, Auto-discover Domains, Import CSV and Add domain buttons. Four domains are listed, each with an In scope switch and Edit and Remove actions. Three are switched on and one is switched off.
Four user-defined domains, one switched out of scope.

For each domain you can:

  • Turn In scope off to keep the entry but stop scans from visiting it, and on again later.
  • Edit its address, or Remove it.
  • Tick several rows and select Delete selected.

An API schema attached to a web application is used only when its base URL is on the application’s own host or on one of these domains.

  • Import CSV adds many domains at once. The file needs a header row with a path column and one domain URL per row.
  • Export CSV saves the current list in the same format.
path
https://static.portal.example.com/
https://orders.example.com/api/

You do not have to know every host your application talks to. The CLI can watch it and tell you.

  1. In the panel, select Auto-discover Domains. The dialog shows the command for this application, for macOS and Linux or for Windows.
  2. Run the command on a machine that can reach the application. A Chrome window opens.
  3. If the application needs a login, log in. Then browse it. Loading the home page after you log in may be enough.
  4. Close the Chrome window. The CLI lists the domains it saw and asks which ones to include.
  5. The domains you keep are uploaded to the application. Ones it already has are skipped.
The Auto-discover Domains dialog. It shows the command nightvision target paths discover for customer-portal, four numbered steps, a warning that you must own or be authorized to scan each domain, a Review the domains before uploading section, and a link to install the CLI.
The dialog gives you the command to run.

The command looks like this:

Terminal window
nightvision target paths discover https://portal.example.com \
--target customer-portal -p "Customer"

To review the domains before anything is uploaded, save them to a file first, then upload the file:

Terminal window
nightvision target paths discover https://portal.example.com \
--target customer-portal -p "Customer" --no-upload -o paths.csv
nightvision target paths upload paths.csv --target customer-portal -p "Customer"

You need the CLI for this. See Install the CLI.

The CLI calls an application a target.

Set exclusions when you create an application or on an existing one. Repeat a flag to give several values:

Terminal window
nightvision target create customer-portal https://portal.example.com --type WEB \
--exclude-url ".*logout.*" \
--exclude-url ".*/account/delete.*" \
--exclude-xpath '//button[@id="delete-account"]'
nightvision target update customer-portal \
--exclude-url ".*logout.*" \
--exclude-url ".*/admin/reset.*"

On target update, the values you give become the application’s list. To clear a list, pass an empty value:

Terminal window
nightvision target update customer-portal --exclude-url ""
nightvision target update customer-portal --exclude-xpath ""

Leave a flag out to keep that list as it is. On target create, leaving --exclude-url out gives the application the default list. If you do pass it, your values replace the defaults, so include a logout pattern of your own.

User-defined domains use nightvision target paths discover and nightvision target paths upload, shown above.

Base URL: https://api.nightviz.ai/api/v1/. See the API overview for authentication.

Exclusions are part of an application’s configuration:

{
"configuration": {
"excluded_url_patterns": [".*logout.*", ".*/account/delete.*"],
"excluded_x_paths": ["//button[@id=\"delete-account\"]"]
}
}

Send it with PUT /targets/url/{id}/ for a web application or PUT /targets/openapi/{id}/ for an API application. GET /common/exclusions/ returns the default list new applications start with.

User-defined domains are additional-paths on a web application:

Method and path What it does
GET /targets/url/{id}/additional-paths/ List the domains
POST /targets/url/{id}/additional-paths/ Add domains. The body is a list of objects with a path
PUT /targets/url/{id}/additional-paths/{path_id}/ Change one domain’s path, or set disabled to take it out of scope
POST /targets/url/{id}/additional-paths/delete Remove domains

The API reference lists every field.