# AI-Built App Security Check (headers, TLS, leaked keys) (`patchlabs/ai-app-security-check`) Actor

Grades any website's HTTPS, certificate, security headers and cookies, and finds secret keys (Supabase service_role, Stripe, OpenAI, AWS and more) shipped in its JavaScript. Made for apps built with Lovable, Bolt, Replit, Cursor and Supabase. Passive: one page load per site.

- **URL**: https://apify.com/patchlabs/ai-app-security-check.md
- **Developed by:** [PatchLabs](https://apify.com/patchlabs) (community)
- **Categories:** Developer tools, AI
- **Features:** Limited permissions, Single-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## AI-Built App Security Check

Check any website for the security mistakes AI app builders make most often: missing HTTPS and security headers,
weak cookies, and **secret keys shipped in the JavaScript every visitor downloads** (Supabase `service_role`, Stripe,
OpenAI, Anthropic, AWS, GitHub, SendGrid, Resend, Twilio, private keys).

Made by [PatchLabs](https://patchlabs.dev) for apps built with **Lovable, Bolt, Replit, Cursor, v0 and Supabase**. It
runs the same checks as the free PatchLabs [headers check](https://patchlabs.dev/tools/headers-check), across as many
sites as you like, with the output as a dataset you can export or call from an API or MCP client.

### What it checks

| Check | What fails | Severity |
|---|---|---|
| Leaked secret keys | A secret key appears in the home page or any same-site script (values are masked in the output) | critical / high |
| HTTPS | `http://` doesn't redirect to `https://` | medium |
| Certificate | Invalid, expired, or expiring within 21 days | high / medium |
| HSTS | No `Strict-Transport-Security`, or max-age under 180 days | low |
| Content-Security-Policy | None set | medium |
| Framing | No `frame-ancestors` or `X-Frame-Options` | low |
| `X-Content-Type-Options` | Missing or not `nosniff` | low |
| Cookies | Missing `Secure`, or a session cookie without `HttpOnly` | medium |
| Mixed content | Scripts or styles over plain HTTP | medium |
| Version leaks | `Server` or `X-Powered-By` reveal software versions | info |
| Referrer-Policy | None set | info |

Each site gets a grade from A to F. Any critical leaked key makes the grade F. The anon (public) Supabase key is
**not** reported as a leak, because it is meant to be public; the output notes when a site talks to Supabase from the
browser, since whether its data leaks then depends on RLS policies a page load can't see.

### Input

```json
{
  "startUrls": [{ "url": "https://myapp.lovable.app" }, { "url": "https://client-site.com" }],
  "maxConcurrency": 5
}
```

Only check sites you own or have permission to test.

### Output

One dataset item per site:

```json
{
  "url": "https://myapp.lovable.app",
  "grade": "F",
  "headers_grade": "C",
  "headers_score": 65,
  "secrets_found": 1,
  "secrets": [{
    "id": "PL-010",
    "severity": "critical",
    "title": "Supabase service_role key in code every visitor downloads",
    "object": "https://myapp.lovable.app/assets/index-4f2a.js",
    "evidence": { "starts_with": "eyJhbGci…", "length": 219 },
    "fix": "This key skips every RLS policy. Rotate it in Supabase (Settings > API) now and move the code that needs it to a server or edge function."
  }],
  "findings": [{ "id": "PL-030", "severity": "medium", "title": "No Content-Security-Policy", "fix": "..." }],
  "passed": [{ "id": "PL-027", "title": "HTTPS is forced" }],
  "supabase": { "projects": ["abcdefghijklmnopqrst"], "anon_key_in_page": true, "note": "..." },
  "scripts_read": 6,
  "checked_at": "2026-11-19T23:00:00+00:00"
}
```

Secret values are never stored: only the type, the file, the first characters and the length.

### Call it as an API (Server Actor)

Agents and scripts can check one site per HTTP request and get the result straight back, with no run to start or
dataset to read. Send your Apify API token as a Bearer token to this Actor's server URL (shown on its **Server** tab):

```bash
curl -H "Authorization: Bearer $APIFY_TOKEN" "<server URL>/check?url=https://myapp.lovable.app"
curl -H "Authorization: Bearer $APIFY_TOKEN" -X POST -d '{"url": "https://myapp.lovable.app"}' "<server URL>/check"
```

The response is the same JSON as one dataset item above. You pay one `site-checked` event only when the site loaded;
a refused or unreachable address returns HTTP 422 with an `error` and costs nothing.

### What it does not do

It is passive. Per site it makes one plain `http://` request, one `https://` load of the home page and fetches the
same-site scripts that page loads (up to 20). It does not submit forms, sign in, crawl other pages, or try any key it
finds. It refuses private and local addresses.

### Use cases

- **Agencies and freelancers**: check every client site you've shipped in one run, and show the client the report.
- **Before launch**: run it on your Lovable or Bolt app before you share the link.
- **Monitoring**: schedule it daily on your sites and get alerted when a deploy drops a header or ships a key.
- **From AI agents**: call it over Apify's API or MCP server from Claude, Cursor or any MCP client.

### Found something?

The [PatchLabs guides](https://patchlabs.dev/learn) explain each finding and how to fix it on Lovable, Supabase
and Bolt. To check what the page can't show, such as Row Level Security, storage buckets and
functions, run the free [RLS check](https://patchlabs.dev/check) on your app's repository.

Source: [github.com/manra399/patchlabs](https://github.com/manra399/patchlabs/tree/main/actor)

# Actor input Schema

## `startUrls` (type: `array`):

Home page addresses, one per line, for example https://myapp.lovable.app. Only check sites you own or have permission to test. Each site gets one plain http request, one https page load and its own scripts.

## `maxConcurrency` (type: `integer`):

How many sites to check in parallel.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://patchlabs.dev"
    }
  ],
  "maxConcurrency": 5
}
```

# Actor output Schema

## `results` (type: `string`):

Every checked site with its grade, leaked keys and findings.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "startUrls": [
        {
            "url": "https://patchlabs.dev"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("patchlabs/ai-app-security-check").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "startUrls": [{ "url": "https://patchlabs.dev" }] }

# Run the Actor and wait for it to finish
run = client.actor("patchlabs/ai-app-security-check").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "startUrls": [
    {
      "url": "https://patchlabs.dev"
    }
  ]
}' |
apify call patchlabs/ai-app-security-check --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,patchlabs/ai-app-security-check"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/5Gxe73CQU72Ud3Fac/builds/ENPT5cJJwN7WUr18i/openapi.json
