# Security

Everything below is how the service is built today. Where we are weak, this page says so rather than leaving the sentence out.

## Keys

- A key is generated once (`ck_` and 43 random characters) and shown once. We store an HMAC-SHA256 hash with a server-side secret and the first 10 characters for display. There is no way to read a key back.
- A request is authenticated by hashing what you sent and looking that up, so no secret is ever compared byte for byte.
- Revoking a key takes effect within 10 seconds, because a valid lookup is cached in the process for that long.
- Guessing keys is rate-limited separately from your own traffic, so a flood of random keys cannot cost us a database query each.

## Accounts

- Passwords are stored as hashes. Signing in with Google needs no password at all.
- Sign-up and sign-in pages run a bot check and are rate-limited per address.
- Every sign-in, failed sign-in, password reset, email change and key change is written to a security record that cannot be edited.
- Suspending an account ends its sessions and switches its keys off in the same transaction.

## Credits and money

- Every change to a balance is made by one SQL function per movement, inside a transaction, with the row locked before it is checked. The services cannot write a money table directly.
- The ledger is append-only: a trigger refuses updates and deletes. The balance plus open holds must equal the ledger, and a check runs after every billing test and on a nightly reconciliation.
- Card details never touch our servers: checkout is a redirect to Stripe, and no Stripe script runs on our pages.

## Fetching pages that are not ours

- Every URL is checked before it is fetched and again on every redirect: scheme, credentials in the URL, and a DNS lookup whose answer must not be a private or reserved address. The resolved address is pinned for the request.
- The browser cannot reach our database network, and ports browsers should never dial are refused.
- Every target is bounded in bytes, time and memory. A page that exceeds a limit fails with an error code; it cannot take the service down. A failure caused by a page stays inside that request.
- Extraction runs in separate processes that are killed past their memory limit or the request deadline, so a hostile page loses its own process and nothing else.
- The browser, the extraction processes and the API each have their own memory limits.

## The websites

- crawlapi.dev and docs.crawlapi.dev load one third-party script, Piqo's analytics, from piqo.app, the only outside origin their Content-Security-Policy lets a script load from or send to. There is no advertising tag, and a build test fails if a page ever ships an inline script, an inline style or an inline event handler. The dashboard loads no analytics.
- The dashboard, app.crawlapi.dev, is served with a strict Content-Security-Policy: styles, fonts and connections only from our own origin, scripts from our own origin and from Cloudflare, and no page may frame it. Cloudflare is there for one reason: the sign-in pages load Turnstile, a bot check, from Cloudflare's own domain and from nowhere else.

## Logs and data

- One record per request with the request id, the URL's host, the attempts made, the outcome code, credits, sizes and timings. Page text, URL paths and queries, API keys and our providers' credentials are never logged, and every free-text field is masked in one place before it is written.
- Retention for every kind of record is on the [privacy page](/privacy).
- Database backups are dumped nightly, read back before they are kept, and kept as 7 daily and 5 weekly copies on the same server. An off-site copy is a known gap: until it is in place, a lost disk could lose recent data.

## Reporting a weakness

If you find a security problem, write to support@crawlapi.dev with what you found and the steps to reproduce it. We also publish this address at [/.well-known/security.txt](/.well-known/security.txt).

- We confirm we received your report within one business day and keep you informed until it is fixed.
- We do not take legal action against research done in good faith under these rules: test only against your own account and your own keys, do not access or change other customers' data, do not degrade the service for others, do not use social engineering or physical attacks, and give us reasonable time to fix a problem before you disclose it.
- Out of scope: reports from automated scanners without a demonstrated impact, missing best-practice headers without an exploit, rate limits you can only reach by attacking us, and the sites crawlapi fetches, which are not ours.
- There is no paid bug bounty. With your permission, we credit you on the [changelog](https://docs.crawlapi.dev/changelog).

## If something goes wrong

If an incident affects your data, we tell you without undue delay what happened, what it touched and what we did about it, and we notify the authorities the law requires us to notify.

## What we do not have

- No SOC 2, no ISO 27001, no penetration-test certificate and no completed security questionnaire on file.
- No service level agreement, and one server, so a hardware failure is downtime until it is fixed.
