---
title: "Security: bot protection for forms and sign-ups | Hazeloft"
description: "Hazeloft Security is a bot protection SDK for forms and sign-ups: a proof-of-work challenge with no image puzzles, tuned from a console without a redeploy."
url: https://hazeloft.com/en/products/security
lang: en
updated: 2026-12-03T11:32:30Z
---

# Bot protection for forms and sign-ups, mounted in your own app.

Hazeloft Security is a bot protection SDK you put on your routes. Its proof-of-work challenge asks the browser for a computation instead of asking a person to click images. You tune the rules from a console, without a redeploy.

[Open Security in the platform](https://platform.hazeloft.com/security)[See pricing](https://hazeloft.com/en/pricing)

Illustration: a slowly rotating shield. Requests travel towards it from the edges; verified ones carry on through, rejected ones stop at its surface.

## The SDK inside your app and the firewall in front of your domain.

In the platform, Security holds two different things. You switch them on separately and they solve different problems. The rest of this page is about the first.

SDK + console

### Hazeloft Security

Where it runs

Inside your application, on the routes you mount it on.

What it needs

An API key and a JavaScript or TypeScript application with handlers built on the Web Request.

What it does

Proof-of-work challenge, sign-up protection, attack signatures, automated-client detection, rate limiting.

How you tune it

From the console, per API key, in Live or Dry run.

Domain firewall

### Domain security

Where it runs

In front of the domain, before a request reaches your server.

What it needs

A domain connected to Hazeloft, with CDN acceleration switched on for it.

What it does

Blocks IP addresses and countries, controls referrers, can require signed URLs and can block POST requests or TLS 1.0 and 1.1. The Traffic page shows requests over 6 hours, 24 hours or 3 days.

How you tune it

From the domain page: activate the firewall, then save the rules.

## Proof-of-work challenge: three pieces of code, two requests.

The order is real: the protected route cannot verify a token your server never issued.

1. ### Your server issues a signed token

   One of your routes calls issueChallenge with a secret that stays on the server. The token carries a nonce, the difficulty and the expiry time, all signed, so the client cannot change them.

   server/challenge.ts`import { issueChallenge } from "@hazeloft/security"; export async function GET() { const { token, nonce, exp } = await issueChallenge({ secret: challengeSecret, action: "sign-up", }); await recordNonce(nonce, exp); return Response.json({ token }); }`
2. ### The browser does the work

   The browser client fetches the token, searches for the counter in a Worker so the form does not freeze, and returns the value for the x-hz-challenge header. Start it when the person begins filling in the form, not when they press the button.

   form.ts`import { CHALLENGE_HEADER, fetchAndSolveChallenge, } from "@hazeloft/security-client"; const header = await fetchAndSolveChallenge({ endpoint: "/api/challenge", }); await fetch("/api/sign-up", { method: "POST", headers: { "content-type": "application/json", [CHALLENGE_HEADER]: header, }, body: JSON.stringify(form), });`
3. ### The protected route verifies

   Verification is local: one HMAC and one SHA-256, with no network round trip. The token can be redeemed once: your isFresh function marks the nonce as used.

   server/sign-up.ts`import { HazeloftSecurity, challenge } from "@hazeloft/security"; const security = new HazeloftSecurity({ apiKey: process.env.HAZELOFT_SECURITY_API_KEY, rules: [ challenge({ secret: challengeSecret, action: "sign-up", isFresh: consumeNonce, }), ], }); const decision = await security.protect(request); if (decision.isDenied()) { return new Response("Forbidden", { status: 403 }); }`

challengeSecret, recordNonce and consumeNonce are yours: the secret and the place where you remember which nonces were used.

## Try it: a proof-of-work challenge, run right here.

Click the box and watch the search. It is the same computation the browser client does, at the difficulty you pick.

x-hz-challengeDemoThe demo needs JavaScript: the computation runs in the browser.Difficulty813default1618First 24 bits of the hash························Conditionthe first 13 bits of SHA-256(nonce:counter) are zeroAttempts—Counter found—SHA-256—Headerx-hz-challengeIn-page demo. The computation is real and runs locally, with no network request. The token is generated here and is not signed by any server, and the search is slowed down so you can follow it.

## Cost, not identity.

A passed challenge says exactly four things. Better to know them before you rely on it.

- Proves

  ### The token is yours and it is fresh

  The signature shows your server issued it, for this route's action, inside its validity window, and the nonce has not been used before.
- Proves

  ### Someone ran the computation

  The solution meets the difficulty carried in the token. A script that posts the form directly, without running anything, has nothing to put in the header.
- Does not prove

  ### That a human is on the other side

  There is no interaction, no gesture and no device check. An automated browser runs the client and passes.
- Does not prove

  ### That an attacker pays what a visitor pays

  The format is public, and native code computes far faster than a browser. That is why the token has to be requested: the request can be counted and limited.

## What else you can put on a route.

Each rule is switched on separately. Apart from rate limiting and the DNS checks, all of them decide inside your process, with no network round trip per request.

- Sign-up

  ### Sign-up protection

  The protectSignup() function runs the account-form checks in one call: an invisible trap field, automated-client detection, email validation (syntax, disposable domains, optionally free providers), names that are not random strings, an attempt limit per canonical address and a DNS check of the email domain.
- Shield

  ### Attack signatures

  Looks for SQL injection, XSS, path traversal, command injection and template injection patterns in the path, the query string, the user agent and the request body.
- Bot Detection

  ### Automated clients

  Classifies the request by its User-Agent. Allowed bots can be verified against the IP ranges Google and Microsoft officially publish, so a fake Googlebot does not pass.
- Rate Limiting

  ### Rate limiting

  Counters shared by all your instances, per client. The name, the maximum and the window can also be defined from the console, with no code change.
- IP Rules

  ### Blocked and trusted addresses

  Single addresses or CIDR ranges, IPv4 and IPv6. Trusted addresses skip the other checks.
- Sensitive Data

  ### Data you do not want to receive

  Rejects requests that contain card numbers, email addresses or phone numbers. Off by default; only the kind of data is recorded, never the value.
- React

  ### Email addresses hidden from scrapers

  The \<EmailEncrypt /> component keeps the address out of the served HTML. The visitor sees it once the page has loaded.

## See what a rule would block before it blocks.

Every capability has its own page in the platform. You start it in Dry run, on real traffic, and read the log. You switch to Live when it shows what you expect.

- Mode

  ### Live or Dry run

  Live refuses the requests it rejects. Dry run only records what would have been rejected. The mode is set globally, per key, and can be overridden for each capability. A key with nothing saved runs in Dry run.
- Configuration

  ### No redeploy

  Thresholds, lists and modes are changed from the console. The SDK re-reads its configuration within 60 seconds.
- Deny events

  ### A log for each capability

  See which requests were rejected and why, for each key. Events are kept for 30 days.
- Decision usage

  ### How much of the quota went where

  Hourly and daily charts, and how much of the monthly quota each capability has used.
- Alerts

  ### Find out before the quota runs out

  An email at 80% of the monthly quota and again when it runs out, an alert on a spike of denials within an hour, and an HTTPS webhook.
- API keys

  ### One key per application

  Each key has its own configuration, its own log and its own quota. The secret is shown once, when the key is created.

## The decision service runs at security.hazeloft.com.

Rate limiting and the email-domain check need state shared by all your instances. An HTTP service holds it, with the same two routes the SDK calls. You can call it directly too.

POST/security/v1/decide

A rate-limit decision. You send fingerprint, windowMs and max, optionally rule; you get allowed and, on a denial, reset: the seconds until the window resets.

POST/security/v1/domain-check

Tells you whether the domain of an email address exists and whether it has MX records. It does not use up the monthly decision quota.

GET/health

Answers whether the process is up and which version it serves. No key needed.

The two POST routes need your API key in the Authorization: Bearer hzx-sec_… header. Without a valid key the answer is 401; with the monthly quota used up, 402.

In the SDK, the service address can be set with the HAZELOFT_SECURITY_BASE_URL variable or the baseURL option.

- [security.hazeloft.com](https://security.hazeloft.com/)
- [See service status](https://status.hazeloft.com/)

POST /security/v1/decide`curl https://security.hazeloft.com/security/v1/decide \ -H "Authorization: Bearer $HAZELOFT_SECURITY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "fingerprint": "203.0.113.7", "rule": "sign-up", "windowMs": 60000, "max": 5 }'`Response`// under the limit { "allowed": true } // over the limit { "allowed": false, "reset": 42 }`

## The exact figures.

Challenge difficulty

13 bits by default; adjustable from the console between 8 and 24

Token validity

120 seconds by default; adjustable between 30 and 300

Header

x-hz-challenge

Rate limits

up to 10 per key; window between 1 second and 24 hours

IP Rules

up to 200 entries per list

Active API keys

up to 5, with the hzx-sec_ prefix

Decision service

500 ms timeout, no retriesAfter 5 failures in a row, the SDK stops trying for 30 seconds.

Scanned body

64 KB default ceiling

Retention

deny events 30 days; daily counters 400 days

Where the SDK runs

Node 18 or newer, edge runtimes, the browser

Packages

@hazeloft/security and @hazeloft/security-client, MIT licenceThe browser client has no dependencies.

Minimum plan

ProThe Free and Go plans do not include Security.

## What it does not do.

Four things you are better off learning now.

- ### The challenge is not a CAPTCHA

  It proves that JavaScript ran and that a computing cost was paid. It does not prove a human is on the other side. It raises the price of automation; it does not detect it.
- ### When the quota runs out, protection stops

  Once the monthly decision quota is used up, requests pass unchecked until it resets or you move to a higher plan. Likewise, if the decision service does not answer, the request is let through. On routes that must never run unprotected you can set failOpen: false.
- ### The domain firewall needs the CDN

  It only works on a domain connected to Hazeloft and accelerated through the CDN. The WAF state and the DDoS sensitivity are displayed but cannot be tuned from the platform: the firewall is switched on or off.
- ### The SDK is JavaScript and TypeScript only

  It mounts in handlers built on the Web Request. There is no SDK for PHP, Python or other languages.

## Included in the platform subscription.

Security is not billed separately. The plan sets how many decisions you can make each month.

Pro

500 RON / month

100,000 decisions per month, for each API key

Ultra

1000 RON / month

1,000,000 decisions per month, for each API key

The quota is counted per UTC calendar month, across all capabilities. The amount shown is the amount charged, per month.

[Compare plans](https://hazeloft.com/en/pricing)

## Frequently asked questions.

### Is Hazeloft Security a CAPTCHA alternative?

Only in the sense that the visitor solves nothing: no images to click and no letters to type. The proof-of-work challenge proves that the browser ran JavaScript and that a computing cost was paid. It does not prove a human is present, and an automated browser can pass it. Use it together with rate limiting.

### Can I protect a contact form?

Yes, if the form is sent from the browser to one of your own routes. You mount the challenge on the route that receives the form, and the browser client sets the x-hz-challenge header. Do not mount it on a route called by other servers: any request without a valid header is rejected.

### Does it work with PHP or Python?

No. The SDK is for JavaScript and TypeScript, in handlers built on the Web Request, such as those in Next, Hono, Bun or Deno. For a site written in another language there is the domain firewall: it sits in front of the site and does not depend on its code, but the domain has to be connected to Hazeloft and accelerated through the CDN.

### What happens when the monthly quota runs out?

Protection stops and requests pass unchecked until the start of the next month or until you move to a higher plan. Your site is not blocked. You can get an email at 80% of the quota and another when it runs out.

### Do I have to use the Hazeloft CDN?

For the SDK, no: it runs inside your application and only needs an API key. For the domain firewall, yes: it can only be activated on a domain connected to Hazeloft with CDN acceleration switched on.

### Does the browser client collect data about the visitor?

It does no device fingerprinting: no canvas, WebGL, audio or font list. It can send three informational values: the core count the browser reports, how long the computation took and whether a Worker was used. The server makes no decision from them, and you can turn them off with signals: false.

### Does it replace a WAF or a site antivirus?

No. Shield looks for known attack signatures, and scanning the request body catches automated scanners, but it is not a security boundary. Security does not scan your site for vulnerabilities and does not look for malware.

## The domain firewall starts from a domain and the CDN.

You connect the domain, switch on CDN acceleration, then the firewall. The SDK does not depend on them.

- [DomainsYour domains and DNS records, managed in one place.](https://hazeloft.com/en/products/domains)
- [CDNPuts a connected domain behind an edge cache, with rules and logs.](https://hazeloft.com/en/products/cdn)
- [HostingDeploy a project from GitHub and follow its deployments, logs and speed.](https://hazeloft.com/en/products/hosting)

## Start in Dry run, on real traffic.

You need an account on the Pro plan and an API key. If you would rather we mount it in your application, write to us.

[Open Security in the platform](https://platform.hazeloft.com/security)[Ask us to mount it](https://hazeloft.com/en/contact)
