Block disposable emails and fake sign-ups
Stop disposable email addresses, typos and sign-up bursts with coss.com Risk, from a single email check to a full sign-up assessment.
Fake accounts start with an address nobody reads: a disposable inbox, a domain that can't receive
mail, or the same mailbox with a new +tag. coss.com Risk checks the address, the IP and the browser
at sign-up and answers allow, review or block, with the reasons behind it.
Check an email address
coss.risk.checkEmail() returns the facts about one address. It's stateless: nothing is stored or
counted, so it suits checking a field as someone fills in the form.
const { : } = await ..("ada@gnail.com");
if (?.) .("Use a permanent email address.");
if (?. === "undeliverable") .("This domain can't receive email.");
if (?.) .(`Did you mean ${.}?`); // "gmail.com"deliverability comes from DNS (MX, A and AAAA records): undeliverable when the domain doesn't
exist, has a null MX or has nothing to deliver to. canonical folds dots and +tags at Gmail and
similar providers, so two spellings of one inbox compare equal. It also reports valid,
role_account (info@), free_provider and more.
Assess the sign-up
A check gives facts; an assessment gives a decision. coss.risk.assess() combines the email
signals with the IP address (Tor, cloud and hosting networks, VPNs), the browser, what the
environment has seen before (the same IP, subnet, domain or mailbox signing up again) and your own
lists and rules. This Next.js server action refuses block, asks review sign-ups to verify their
email first, and fails open if coss.com can't be reached:
"use server";
import { } from "next/headers";
import { } from "coss";
const = new ();
export async function (: { ?: string } | null, : ) {
const = (.("email") ?? "");
const = .("device");
const = await ();
const { : , } = await ..({
: "signup",
: { },
: .("x-forwarded-for")?.(",")[0]?.(),
: .("user-agent") ?? ,
: typeof === "string" ? { : } : ,
});
if () .();
if (?. === "block") return { : "We couldn't create your account." };
await (, { : ?. === "allow" });
return {};
}
Pass the client's address, not your proxy's (an ip.private reason means you sent the proxy's).
The first x-forwarded-for entry is right only when your hosting platform sets the header itself;
behind your own proxies, take the entry they appended. Don't show reasons to the person signing up,
apart from a typo suggestion (email.typo): they tell an attacker what to change.
The device token comes from coss/device in the browser, made when the form is submitted:
export function () {
const [, ] = (, null);
return (
< ={() => { .("device", ()); (); }}>
< ="email" ="email" />
< ="submit">Sign up</>
{?. && <>{.}</>}
</>
);
}Decisions and reasons
Each reason adds to a score, and the score decides with your thresholds. On its own, a disposable
address (email.disposable, weight 0.7) is review with the default thresholds; a disposable
address over Tor is block. The reasons that matter most for sign-ups:
| Reason | When |
|---|---|
email.disposable, email.undeliverable | A disposable-mail domain, or one that can't receive mail. |
email.typo, email.role_account, email.domain_new | A likely typo, a role account, a recently registered domain. |
duplicate.canonical_mailbox | The mailbox already has an account (dots and +tags folded). |
velocity.signups_per_ip_1h, velocity.signups_per_mailbox_24h | Many sign-ups from one IP address, or for one mailbox. |
ip.tor, ip.hosting_provider, device.automation | Tor, a data center, an automated browser. |
review is for sign-ups you let through with limits: no free credits, email verification first,
or a look in the dashboard's review queue. Duplicate detection compares sign-ups that carry a user
id, so pass user: { id } once you have one. Reasons and scores lists them all.
Always block disposable addresses
To refuse every disposable address regardless of score, add a rule. Rules run before the thresholds, and the first match decides:
await ...({
: "Disposable email",
: ["signup"],
: [{ : "email.disposable", : "is", : true }],
: "block",
});
// A domain the disposable list doesn't know yet:
await ...("block", { : "burner.example", : "Seen in abuse" });Rate limit sign-ups per IP address
Assessments already count sign-ups per IP address, subnet, email domain, mailbox and browser. For a hard cap of your own, define a bucket and check it before assessing:
// Once, or in the dashboard (Risk → Rate limits):
await ...({ : "signup.ip", : 10, : 3600 });
// On every sign-up:
const { : } = await ..({ : "signup.ip", : });
if ( && !.) throw new ("Too many sign-ups. Try again later.");Test it
Sandbox keys (coss_test_…) know test inputs: ada@disposable.test is
disposable, ada@undeliverable.test can't receive mail, and IP 192.0.2.1 is a Tor exit node.
Next steps
- Risk assessments: every signal, retries and failures.
- Email, IP and phone checks: the lookups on their own.
- Devices: recognize one browser behind many accounts.
- Lists, feedback and reviews: teach Risk about your users.
- Better Auth: assess before calling its sign-up, and send its verification emails through coss.com.
Last updated