<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/build-scanner-safe-double-opt-in-qgdlkj42f" -->

---
title: Build scanner-safe double opt-in | daily.dev
description: Email security scanners can inadvertently confirm subscriptions by following GET links before the recipient does. The solution is a two-step double opt-in: a...
canonical: https://daily.dev/posts/build-scanner-safe-double-opt-in-qgdlkj42f
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Build scanner-safe double opt-in | daily.dev
og:description: Email security scanners can inadvertently confirm subscriptions by following GET links before the recipient does. The solution is a two-step double opt-in: a...
og:url: https://daily.dev/posts/build-scanner-safe-double-opt-in-qgdlkj42f
og:image: https://api.daily.dev/og/posts/qgdLkJ42F.png
og:image:alt: Build scanner-safe double opt-in
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Build scanner-safe double opt-in

**[Flavio Copes](https://daily.dev/sources/flaviocopes)** · 4 min read · 0 upvotes · 0 comments

## Summary

Email security scanners can inadvertently confirm subscriptions by following GET links before the recipient does. The solution is a two-step double opt-in: a GET request renders a confirmation page with a hidden form, while a POST request performs the actual confirmation. Key implementation details include generating a 32-byte random token sent via email, storing only an HMAC hash in the database, using an atomic SQL UPDATE that nullifies the token on success (making it single-use), setting response headers to prevent token leakage (no-store, no-referrer, noindex), keeping the token in the POST body rather than the URL, and expiring pending confirmations after 24 hours via a scheduled cleanup query. CSRF protection is unnecessary since the 256-bit token itself serves as the authorization boundary.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://flaviocopes.com/scanner-safe-double-opt-in>

## Similar posts on daily.dev

- [Your sign-up form is a weapon](https://daily.dev/posts/your-sign-up-form-is-a-weapon-cwnsa8fnc) · Hacker News · 0 upvotes · 0 comments
- [Build idempotent double opt-in signup](https://daily.dev/posts/build-idempotent-double-opt-in-signup-pqalhwsrt) · Flavio Copes · 1 upvotes · 0 comments
- [How I Found and Bypassed a Newsletter Confirmation System \(IDOR\).](https://daily.dev/posts/how-i-found-and-bypassed-a-newsletter-confirmation-system-idor--0mtxfpcsl) · InfoSec Write-ups · 0 upvotes · 0 comments
- [GHSA-57hq-95w6-v4fc \(devise\): Confirmable "change email" race condition permits user to confirm email they have no access to](https://daily.dev/posts/ghsa-57hq-95w6-v4fc-devise-confirmable-change-email-race-condition-permits-user-to-confirm-emai-xuuvn4m4d) · RUBYLAND · 0 upvotes · 0 comments
- [Status pages can now email your subscribers](https://daily.dev/posts/status-pages-can-now-email-your-subscribers-vpbu62m0l) · Oh Dear · 0 upvotes · 0 comments

---

Tags: [#security](https://daily.dev/tags/security), [#authentication](https://daily.dev/tags/authentication), [#cloudflare](https://daily.dev/tags/cloudflare)

[View this post on daily.dev](https://daily.dev/posts/build-scanner-safe-double-opt-in-qgdlkj42f)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Build scanner-safe double opt-in","url":"https://daily.dev/posts/build-scanner-safe-double-opt-in-qgdlkj42f","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/build-scanner-safe-double-opt-in-qgdlkj42f"},"datePublished":"2026-08-05T14:25:18.930Z","dateModified":"2026-08-05T14:25:43.632Z","description":"Email security scanners can inadvertently confirm subscriptions by following GET links before the recipient does. The solution is a two-step double opt-in: a...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7219243bb6b6113ecc90bd933965a4ef?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7219243bb6b6113ecc90bd933965a4ef?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Flavio Copes","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Flavio Copes","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/1f2dbd275797411bbd37bfdaaf0951a9","url":"https://daily.dev/sources/flaviocopes"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/build-scanner-safe-double-opt-in-qgdlkj42f","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"security,authentication,cloudflare","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Flavio Copes","item":"https://daily.dev/sources/flaviocopes"},{"@type":"ListItem","position":3,"name":"Build scanner-safe double opt-in"}]}
```

