# Checks

Every check has an ID: use it with `--only` and `--skip`, in the `ignore:` list of `preflight.yml`, and with `preflight ignore`. `preflight checks` prints them all. Checks marked opt-in stay off until [`preflight.yml`](https://preflight.sh/docs/configuration/#checks) has their block under `checks:`. `preflight init` writes the blocks for `secrets` and `env_parity` turned on, and the one for `security_headers` turned on when you give it a production URL. Asking for an opt-in check that has no block, as in `--only secrets`, is a usage error (exit 64): no enabled check matches.

## SEO and social

| ID | What it checks |
|---|---|
| `seo_meta` | A title and description, and Open Graph tags |
| `og_twitter` | `og:image`, `twitter:card`, and the rest of the social sharing metadata |
| `canonical` | A canonical link tag |
| `structured_data` | JSON-LD Schema.org markup |
| `viewport` | A viewport meta tag for mobile |
| `lang` | The `lang` attribute on `<html>`, for accessibility |
| `index_now` | An IndexNow key file, for faster search indexing. When the site answers, the deployed `/{key}.txt` decides; the source is read only when it can't be reached. Opt-in |

## Security and infrastructure

| ID | What it checks |
|---|---|
| `security_headers` | HSTS (over HTTPS), Content-Security-Policy, X-Content-Type-Options, and Referrer-Policy, on production and staging. A weak CSP, such as one that allows `'unsafe-inline'` scripts, is a suggestion, not a failure. Opt-in (`checks.security`) |
| `ssl` | That the SSL certificate is valid, with a warning before it expires. The warning and the error scale with the certificate's lifetime (an error with under a tenth of it left, a warning under a third), capped at 7 and 30 days, so a short-lived certificate is not flagged the day it is issued. An `http://` production URL that redirects to valid HTTPS is a warning. Skipped for a local URL |
| `www_redirect` | That www and the bare domain redirect to the canonical one |
| `secrets` | API keys and credentials committed to the code, including credentials in URLs. Every file git tracks is scanned, whatever directory it is in. Files over 2 MB are skipped. Placeholders are not reported, and a key-shaped value in an example file is a warning. When git cannot say which files are tracked, the result is inconclusive. Opt-in (`checks.secrets`) |
| `email_auth` | SPF and DMARC DNS records for your sending domain, or the production URL's domain when none is set (see [configuration](https://preflight.sh/docs/configuration/#checks)). Opt-in |

## Environment and health

| ID | What it checks |
|---|---|
| `env_parity` | Variables in `.env.example` that are missing from `.env`. Opt-in (`checks.envParity`) |
| `health_endpoint` | That the site answers. It tries `/health`, `/healthz`, `/api/health`, `/_health`, and `/status`, then the root. With `healthEndpoint.path` set it tries that path first, and with `enabled: true` as well, only that path |

## Code quality and performance

| ID | What it checks |
|---|---|
| `vulnerability` | Dependency vulnerabilities, through your package manager's audit tool, for every project it finds (workspace members covered by a parent lockfile are audited once, and `ignore:` globs are left out). pnpm and Bun lockfiles are not audited yet: a project with only `pnpm-lock.yaml` or `bun.lock` is reported as inconclusive, so run `pnpm audit` or `bun audit` yourself |
| `debug_statements` | `console.log`, `var_dump`, `debugger`, and the like left in the code. A statement behind a development guard is not reported: in code, in Twig, ERB, Blade, Django, and Go templates, and on the same line with `&&` or a ternary |
| `error_pages` | Custom 404 and 500 pages |
| `image_optimization` | Images over 500KB |

## Legal and compliance

| ID | What it checks |
|---|---|
| `legal_pages` | A privacy policy and terms of service on the deployed site, or in the source when the host is blocked or down |

Cookie consent tools are checked as [services](https://preflight.sh/docs/services/#cookie-consent).

## Web standard files

| ID | What it checks |
|---|---|
| `favicon` | A favicon, an apple-touch-icon (`.png`, `.webp`, or `.svg`), and a web manifest, including icons declared by `<link>` tags in your layout or Next.js `icons` metadata. A missing favicon is a warning |
| `robots_txt` | A `robots.txt` with real rules in it. On production it warns when the file disallows everything for all crawlers or the homepage is marked noindex |
| `sitemap` | A `sitemap.xml`, or a generator or route that makes one, including Next.js Pages Router, Astro, and SvelteKit endpoints |
| `llms_txt` | An `llms.txt` for AI crawlers |
| `ads_txt` | An `ads.txt`, for ad-supported sites. Opt-in |
| `humans_txt` | A `humans.txt` crediting the team. Opt-in |
| `license` | A license file, for open source projects. Opt-in |

For `robots_txt`, `sitemap`, `llms_txt`, `ads_txt`, and `humans_txt`, a copy in the repository is not enough when the live site answers and does not serve it: the check warns and says where it looked. When the host blocks the scanner, answers with a server error, or is down, the result is inconclusive, not "not found".

## Check IDs renamed in 0.22

Every check ID is now snake_case. 0.22 accepted the old camelCase names with a note on stderr; 0.25 rejects them. An old name in an `ignore:` list, `--only`, or `--skip` is a usage error (exit 64). One error lists every old ID it found, each with its new name and the command that fixes it:

```text
Error: pre-1.0 check IDs are not accepted:
  unknown check ID "seoMeta" in ignore: renamed to "seo_meta" in v0.22.0; run 'preflight ignore seo_meta' to update the ignore list
  unknown check ID "ogTwitter" in --only: renamed to "og_twitter" in v0.22.0; use --only og_twitter
```

`preflight ignore <new-id>` rewrites the old entry in place and removes any duplicate spellings of it. `preflight unignore` takes either name. The keys under `checks:` in `preflight.yml` (`healthEndpoint`, `seoMeta`, and so on) are a separate schema and did not change.

| Old | New |
|---|---|
| `seoMeta` | `seo_meta` |
| `ogTwitter` | `og_twitter` |
| `securityHeaders` | `security_headers` |
| `envParity` | `env_parity` |
| `healthEndpoint` | `health_endpoint` |
| `robotsTxt` | `robots_txt` |
| `llmsTxt` | `llms_txt` |
| `adsTxt` | `ads_txt` |
| `humansTxt` | `humans_txt` |
| `indexNow` | `index_now` |

## Scanning code you don't trust

Every check reads files; one runs a program. The `vulnerability` check runs your package manager's audit tool (`npm audit`, `yarn audit`, `composer audit`, `bundle-audit`, `pip-audit`, `govulncheck`, or `cargo-audit`) inside the project directory, with a scrubbed environment and a temporary home so it cannot read your tokens. npm's and Yarn's user config, cache, and logs are pinned to that temporary home, so a project `.npmrc` cannot point them back at yours.

It also closes the known ways a repository can hand that run to its own code: Composer runs with `--no-plugins --no-scripts`, `cargo-audit` and `bundle-audit` run directly rather than through `cargo` and `bundle`, Composer audits the lockfile with `--locked`, Yarn classic ignores a `yarn-path` and every `.yarnrc`, and Yarn is not run at all at or below a `.yarnrc.yml` (that target is reported as inconclusive). Git runs with fetching and config-named commands turned off, so a repository's own git config cannot start a program. Audit tools still read project configuration, so this narrows the risk without removing it. Scanning your own projects is what Preflight is for. When you scan a repository you don't trust, such as a fork's pull request in CI, add `--skip vulnerability`.

To report a security problem in Preflight itself, see its [security policy](https://github.com/preflightsh/preflight/blob/main/SECURITY.md).
