> For clean Markdown of this page, append .md to its URL. For the complete documentation index, see https://www.superagent.sh/llms.txt.


Track the scripts your website loads, save their versions, and check new code for suspicious behavior through your existing Cloudflare connection.

# Script Guard


Chat widgets, analytics, and experimentation tools can change the JavaScript
running on your website without a deployment from your team. Script Guard saves
the scripts your site loads, checks new versions for suspicious behavior, and
keeps earlier versions so you can investigate what changed.

Open **DNS** in the sidebar to manage monitored sites. Script Guard is in beta
and uses your existing Cloudflare connection. You do not need to change DNS
providers or install JavaScript on your site.

## Connect Cloudflare

An organization owner sets up the connection and enables monitoring. Other
members can view sites, script history, and reports.

1. Open [Integrations](https://www.superagent.sh/app/integrations) and select **Connect** on Cloudflare.
2. Select **Connect with Cloudflare**, sign in, and authorize access to the
   accounts and zones you want to monitor.
3. Alternatively, select **Use an API token instead** and paste a Cloudflare user
   API token. Grant **Zone:Read**, **DNS:Read**, and **Zone Transform Rules:Edit**,
   limited to the zones you want to monitor.

The website must already use Cloudflare's proxy. DNS-only records do not support
automatic setup. Read-only Cloudflare access can import application inventory;
Script Guard also needs permission to configure response headers.

## Add sites and enable monitoring

1. Open [DNS](https://www.superagent.sh/app/dns) and select **Add site**.
2. Choose a **Cloudflare zone**, then select one or more **Websites** to add.
3. Open a site and, in its **Script guard** tab, turn on
   **Monitor third-party scripts** under **Settings**.

Adding a site does not start monitoring. Turning on the switch schedules the
first capture and enables hourly captures and browser reporting. New sites are
visited from their home page. You can follow progress in the **Scripts** list.

Superagent adds a site-specific, report-only response-header rule through
Cloudflare and preserves your existing policies. The rule can surface script
URLs reported by visitors' browsers; separate capture visits save actual code.
Script Guard does not block scripts or change which scripts your site serves.

## Captures and version history

Superagent visits your public pages in an isolated browser and saves external
JavaScript responses, including scripts loaded dynamically during the visit.
This covers your own scripts and third-party tools such as chat widgets,
analytics, and experimentation scripts when they load on the visited page.

Each script is tracked by its full URL, including query parameters, and a hash
of its captured code. Unchanged code reuses its saved version. Changed code
creates a new version and keeps the previous copy. Each new version is assessed
in its own isolated sandbox, with the earlier version and a diff when available.

Captures are snapshots. They can miss inline scripts, authenticated pages,
scripts behind consent or interaction, loads after the visit window, and code
served only to particular visitors. Browser reports may reveal additional URLs
without a saved copy. Monitoring does not guarantee capture of every script or
every version delivered between visits.

## Read a security report

Search the **Scripts** list by URL and select a row to open its detail panel.
Use the version selector in the header to review earlier captures. The copy and
download icons export the selected version's security report as Markdown.

| Tag | Meaning |
| --- | --- |
| Clear | The assessment found no supported suspicious behavior in this captured version. |
| Suspicious | The assessment identified suspicious behavior with code evidence. Open the report to investigate. |
| Unknown | The assessment was inconclusive. Read the report for the missing context. |
| Queued / Scanning | The version is waiting for assessment or being assessed. |
| Limited | The daily scan limit was reached. Queued scans resume after midnight UTC. |
| Failed | The assessment could not finish. An owner can select **Retry scan** while monitoring is enabled. |
| Reported / Uncaptured | The URL is known, but there is no archived code to assess. This is not a threat verdict. |

The **Security report** explains what the script does, meaningful changes, and
any supported findings with code excerpts. Analysis focuses on behavior such as
payment-form skimming, credential theft, sensitive-data collection, hidden
loaders, and unexpected data transfers. Minification, analytics, or a new domain
alone do not establish malicious behavior.

The assessment inspects captured source and decoded data; it does not execute
the script to reproduce its behavior. **Clear** describes that assessment and
does not guarantee the script is safe for every visitor or situation.

## Receive suspicious-script alerts

### Email

In the site's **Settings**, add addresses under **Email notifications**. Press
Enter or comma to add an address, or paste a list separated by commas or newlines.
You can add up to 20 recipients, including addresses outside your organization.
Changes save automatically; remove an address with its remove button.

Recipients receive alerts for suspicious assessments. Clear, inconclusive, and
failed assessments do not send threat alerts.

### Webhooks

In [Webhooks](https://www.superagent.sh/app/webhooks), create or edit a target and select
`script_guard.suspicious_script` under **Script guard events**. Under **Sources**,
select **DNS**, then all sites or the specific sites to include. Existing
webhook targets must opt in to this event and its DNS sources explicitly.

The event includes the site, script URL and version, summary, finding summaries,
and links to the report. It fires once for a suspicious version while monitoring
is enabled. Repeated captures of unchanged code do not send another event, and
subscribing does not send historical results. Webhooks work independently of
email recipients. See [Script guard alerts](https://www.superagent.sh/docs/webhooks#script-guard-alerts)
for payload details and [signature verification](https://www.superagent.sh/docs/webhooks#signatures).

## Usage and archive limits

Each new script version costs **1 credit** when its scan starts. Unchanged
captures and retries of the same version do not charge again.

Archives are private to your organization and remain available until you delete
the site. Each site can reserve up to **1 GiB of code and 10,000 versions**;
the organization limit is **5 GiB and 50,000 versions**. At capacity, new versions
stop being archived and the site shows an archive-limit message. Existing
history remains available. A capacity error is not a suspicious-script result.

## Turn off monitoring or delete a site

Turn off **Monitor third-party scripts** to stop new capture visits, browser
reporting, and new assessments. Existing versions and reports remain available.
Superagent removes its own Cloudflare rule and preserves your other policies.

Use **Delete** in the site header to remove the site and its history. Archived
code cleanup starts after one hour; its reserved capacity is released after
cleanup completes. Keep the Cloudflare connection authorized while removing an
active site's rule.

Cloudflare application inventory import remains a separate feature. Use
[Applications](https://www.superagent.sh/docs/concepts/applications#import-from-cloudflare) to import
application targets; adding a DNS site configures Script Guard for that hostname.

---
Source: https://www.superagent.sh/docs/products/script-guard
Index: https://www.superagent.sh/llms.txt
