# Bulk TLS & Security Header Policy Checker (`min.h/bulk-tls-security-header-policy-checker`) Actor

Check TLS certificates and compare public HTTPS response headers with a policy set per URL. Export observed results, exceptions, and a run summary.

- **URL**: https://apify.com/min.h/bulk-tls-security-header-policy-checker.md
- **Developed by:** [Min. H](https://apify.com/min.h) (community)
- **Categories:** Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 75.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.50 / 1,000 tls policy check completeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## 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

## Bulk TLS & Security Header Policy Checker

Check TLS certificate validity, hostname matching and expiry for public HTTPS URLs. Compare response headers against the policy you set for each URL. The same site can use different expectations for its homepage, login, and API. Results include the observed HTTP status, certificate expiry, inspection timestamp, per-rule evidence, and CSV and JSON exports.

### Input

- **Synthetic example** is the default Console prefill. It evaluates two bundled header observations offline, one matching and one violating its policy. Every row is labeled `SYNTHETIC_FIXTURE`, with no billable row or custom event. Apify runs marked `TEST` use the bundled example without reading Run INPUT.
- **Live** requires `accessAuthorized: true` and a nonempty `targets` array. Confirm permission to make automated GET requests to the exact URLs and their declared destinations. URLs must be public HTTPS hostnames without credentials, query strings, fragments, or nonstandard ports. Keep secret values out of paths; the report includes hostnames and paths.
- Each target requires `url` and `expect`. `expect.headers` takes lowercase names and either `true` for a nonempty header or a string for exact comparison after trimming surrounding whitespace. Supported names are `content-security-policy`, `strict-transport-security`, `x-frame-options`, `x-content-type-options`, `referrer-policy` and `permissions-policy`. `expect.hstsMinAge` compares the HSTS `max-age` in seconds. An optional `expectedFinalUrl` permits one redirect to the exact HTTPS URL on the same origin.
- The defaults are 50 unique URLs, 5.5 seconds per target, 45 seconds of target processing and a 30-day TLS expiry warning. The absolute input maximum is 100 URLs. Storage and SDK shutdown can extend elapsed run time beyond the target processing deadline.

For a live inspection, replace the URL and policy below with an HTTPS endpoint you are authorized to inspect. Set accessAuthorized to true only after you have that permission.

```json
{
  "mode": "live",
  "accessAuthorized": true,
  "maxTargets": 1,
  "targets": [
    {
      "url": "https://example.com/",
      "expect": { "headers": { "x-content-type-options": "nosniff" } }
    }
  ]
}
```

### Results

The default Dataset has one row per saved observation. The default key-value store contains `OUTPUT.json`, `OUTPUT.csv` and `SUMMARY`. `SUMMARY` includes outcome counts, unprocessed targets, any stop reason, billing status and a reusable live baseline. `PPE_AUDIT` is written when a custom charge is attempted and records only hashed target keys, timestamps and states.

- `PASS` means the observed response met the supplied expectations. `VIOLATION` means a complete header observation differed from them. `UNKNOWN` preserves evidence that could be measured, such as a certificate failure when HTTP could not be reached. A live run with only unknown results keeps its diagnostics and exits unsuccessfully unless it reached an explicit processing limit.
- `billable` is eligibility, independent of payment confirmation. A TLS expiry warning for a still-valid certificate is distinct from both the TLS validity and header verdicts.
- `UNCHANGED` compares the observed policy verdicts and recorded evidence for the same expectations. It does not assert byte-for-byte equality of responses. Incomplete or unconfirmed writes retain the previously supplied baseline.
- Browser enforcement, JavaScript resources, full CSP semantics, certificate revocation assurance, and comprehensive vulnerability or compliance certification are outside the scope. Duplicate header values and unsupported HSTS syntax may yield `UNKNOWN`.

#### Example live result

This recorded example from example.com shows a valid TLS certificate and a response that did not meet the requested header policy. A complete inspection can return VIOLATION.

```json
[
  {
    "url": "https://example.com/",
    "finalUrl": "https://example.com/",
    "result": "VIOLATION",
    "statusCode": 200,
    "source": "LIVE_HTTPS",
    "checkedAt": "2026-11-17T09:20:57.783Z",
    "tlsStatus": "PASS",
    "certificateExpiresAt": "2026-12-25T22:56:35.000Z",
    "expiryWarning": false,
    "tls": {
      "result": "PASS",
      "expiresAt": "2026-12-25T22:56:35.000Z"
    },
    "checks": [
      {
        "rule": "x-content-type-options",
        "result": "VIOLATION",
        "reason": "MISSING"
      }
    ],
    "billable": true,
    "change": "NO_BASELINE"
  }
]
```

### Pricing and access

Each completed live URL inspection costs **$0.0015** (**$1.50 per 1,000 completed inspections**). An inspection is eligible when the Actor completes the check and saves its result to the Dataset. A completed inspection that finds a policy violation is eligible for the same event. The synthetic fixture, duplicate URLs, invalid inputs, unprocessed URLs and UNKNOWN results are free of event charges. The Actor attempts each eligible charge once after storage. If the charge outcome is unclear, processing stops and the Actor leaves a billing audit record.

Run with **Limited Permissions**, effective **Restricted** resource access and automatic restart disabled. The Actor checks anonymous access to the current Run and its default storage before reading input. Keep secrets out of target paths and use URLs you are authorized to inspect. The report identifies observations at the recorded inspection time.

# Actor input Schema

## `mode` (type: `string`):

The synthetic sample evaluates bundled observations offline and never creates a paid event. Live applies your own policies to explicitly authorized endpoints.

## `accessAuthorized` (type: `boolean`):

Enable only when you are allowed to make automated HTTPS GET requests to every selected URL and its declared destination. This flag is not needed by the sample.

## `targets` (type: `array`):

Live mode only. Specify one rule or more per URL. Header names are lowercase and values are true for presence or a string for exact comparison. hstsMinAge is in seconds.

## `tlsWarningDays` (type: `integer`):

Flag a still-valid certificate that expires within this number of days. A warning is separate from the header verdict.

## `maxTargets` (type: `integer`):

Maximum number of unique targets to attempt in the run.

## `targetTimeoutMs` (type: `integer`):

Deadline for DNS, TLS, HTTP, and an optional approved redirect together.

## `runTimeoutSeconds` (type: `integer`):

Upper limit for target processing. Final result storage and SDK shutdown can take additional time.

## `baseline` (type: `object`):

Optional baseline from a previous live run's SUMMARY. Incomplete observations do not replace it.

## Actor input object example

```json
{
  "mode": "sample",
  "accessAuthorized": false,
  "tlsWarningDays": 30,
  "maxTargets": 50,
  "targetTimeoutMs": 5500,
  "runTimeoutSeconds": 45
}
```

# Actor output Schema

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

No description

## `csv` (type: `string`):

No description

## `dataset` (type: `string`):

No description

## `summary` (type: `string`):

No description

# 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 = {
    "mode": "sample",
    "accessAuthorized": false
};

// Run the Actor and wait for it to finish
const run = await client.actor("min.h/bulk-tls-security-header-policy-checker").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 = {
    "mode": "sample",
    "accessAuthorized": False,
}

# Run the Actor and wait for it to finish
run = client.actor("min.h/bulk-tls-security-header-policy-checker").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 '{
  "mode": "sample",
  "accessAuthorized": false
}' |
apify call min.h/bulk-tls-security-header-policy-checker --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,min.h/bulk-tls-security-header-policy-checker"
        }
    }
}
```

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/pgmHjEsl7S8qCEwrn/builds/EmFmWUt89vCpKvNES/openapi.json
