Skip to content

Free plan: watch one domain, with email alerts - #137

Merged
Darknode-Official merged 3 commits into
mainfrom
feat/watch-default
Nov 26, 2026
Merged

Darknode-Official merged 3 commits into
mainfrom
feat/watch-default

Conversation

@Darknode-Official

Copy link
Copy Markdown
Owner

Free accounts can now watch one domain. After a domain check, Watch this domain sets up a certificate-expiry monitor and an email/DNS monitor on that domain. Both run once a day on the server, and alerts go by email to the account's own verified address. Base: feat/domain-check.

Server limits (enforced in the MonitorDO, worker/free-watch.js)

Below Pro, handleMonitor marks the request x-mon-plan: free, and the DO checks it in the same step as the write:

  • Personal workspace only. In a team workspace, upsert, run, test and resume get 402 plan:true ("Continuous monitoring is part of the Pro plan...").
  • Types: cert-expiry and email-posture only. kev-epss gets 402.
  • One distinct domain in total across every monitor in the workspace, paused ones included. Each monitor holds exactly one domain. A second domain gets 402, and the message names the domain already watched.
  • Channels: email only. Slack, Teams, Discord and webhook get 402. With no channel given, email is the default.
  • Interval: at least 24 h. Run now: at most once per 10 minutes (429), and it runs only the watch.
  • Resume: only a monitor inside the watch can be resumed. Others get 402.
  • Lapsed plan: if a Pro user drops to Free with many monitors, the alarm runs only the watch (the earliest-created fitting domain) and holds the rest (planHeld).
  • Pro and above: unchanged, plus email as a new channel type.

Email alerts (worker/alert-email.js)

  • Recipient: the address comes only from the verified ID token (email_verified === true), via the x-mon-email header. Any address in the request is ignored, and there is one email channel per monitor. Firebase Auth is checked again at send time, and an unverified, disabled or missing account sends nothing (logged as failed).
  • Delivery: Resend, from Darknode <digest@darknode.ai>, with an Idempotency-Key, List-Unsubscribe and List-Unsubscribe-Post: One-Click.
  • Cap: 5 alert emails per account per UTC day (RateLimiterDO daily counter). The 5th email says it is the last one today. Further alerts are logged as failed (429) and are not sent. A send that fails all 3 attempts is logged as failed and refunds its slot.
  • Format: text plus a simple table-layout HTML part. No images, no tracking, no emojis.
  • Stop link: /api/watch/stop takes an HMAC token of (workspace, account). GET shows a confirm page; POST, or a mail client's one-click unsubscribe, pauses the monitors that email that account.

Sample from the unit test (DMARC weakened between two runs):

Subject: DMARC policy for example.com weakened from reject to none

A change on example.com needs attention
Found by your monitor "Watch example.com" on 2026-11-25 09:30 UTC.

DMARC policy for example.com weakened from reject to none [Medium]
Why it matters: Without an enforced DMARC policy, receivers deliver mail that spoofs example.com instead of rejecting it, so phishing in your name reaches inboxes.
Fix: Set the policy in the TXT record at _dmarc.example.com back to p=reject.

Open Monitors in the Deck: https://darknode.ai/monitors

--
You get this because you set up the monitor "Watch example.com" in Darknode. It checks example.com once a day and emails your account address when something changes.
Stop these alerts: https://darknode-proxy.darknode-ai.workers.dev/api/watch/stop?w=u1&u=u1&t=abc
To turn the watch off in the Deck: Monitors, then Pause or Delete on the watch for example.com.

Deck

  • Overview first run: after a check, Watch this domain confirms what is watched (certificate expiry within 21 days; SPF, DMARC, MX, CAA), how often (once a day) and where alerts go (the account address, at most 5 a day). If Free already watches another domain, it names that domain and offers Monitors and Plans.
  • Monitors: now shown on Free. It shows the watch with Turn off and Turn on, offers email as a channel, and hides KEV/EPSS and webhooks below Pro.
  • Copy:
    • Deck Plans: a Free line, plus one Pro line.
    • Landing Free price card: one added <li> at public/js/landing.js line 732. Nothing else on the landing changed.
    • Docs: FAQ, changelog and Privacy.
    • Terms section 14 gets a monitors bullet. TOS_VERSION is now 2026-11-25 with a new "What changed" item, so every account re-accepts.

Verification

  • npm test: 5122 passed. npm run release:check: READY.
  • Unit tests only: the Worker side (gating, email payload, cap, stop link, recipient check, DMARC drift naming) is covered by test/worker/free-watch.test.mjs and has not run against a live Worker. The local site talks to the production Worker, which does not have this code yet.
  • Browser (local build, guest Deck, 1440x900 and 390x844):
    • Real path: the guest gets "Sign in with your own account to watch a domain".
    • With a stubbed transport (Playwright route on monitor-client.js), I checked the offer, watching, conflict, Monitors watch and empty states, and Turn off pausing both monitors. No console errors, no horizontal overflow at 390px.

Deploy notes

  1. Worker first: cd worker && npx wrangler deploy --env staging, then production. No new secrets: it reuses RESEND_KEY, FIREBASE_SA and DIGEST_SECRET/SA for stop tokens.
  2. Then hosting: npx firebase deploy --only hosting. If hosting goes first, Free users would see Watch this domain and get the old 402 until the Worker deploys.

Owner decisions

  • TOS re-acceptance (version bump) for this change. To skip it, revert the section 14 bullet and the version.
  • Sender reuses digest@darknode.ai.
  • Free is email only, with no chat or webhook alerts.
  • Free Run now is limited to once per 10 minutes.
  • The watch lives only in the personal workspace.
  • The first run can email an existing serious issue straight away (a certificate inside 21 days, or a high-severity email/DNS finding).
  • If neither DIGEST_SECRET nor the service account is set, emails carry only the Deck path, with no stop link.

Server (Worker):
- free-watch.js: below Pro, the personal workspace may run cert-expiry and
  email-posture monitors on ONE distinct domain in total (paused ones count),
  email alerts only, at most once a day, Run now at most once per 10 minutes.
  A 2nd domain, kev-epss, chat/webhook channels or a team workspace get 402
  plan:true with a plain message. Pro and above are unchanged.
- alert-email.js: alert emails through Resend to the account's own address
  only (from the verified ID token, re-checked in Firebase Auth at send time),
  plain text + simple HTML, no images or trackers: what changed, why it
  matters, the exact fix, the Deck link, a signed stop link with
  List-Unsubscribe one-click. Capped at 5 per account per UTC day; a capped or
  failed send is logged as failed in the delivery log.
- /api/watch/stop: GET shows a confirm page, POST pauses the monitors that
  email that account (HMAC token of workspace + account).
- email-posture keeps the SPF/DMARC policy per domain so an alert can say
  "weakened from reject to none".

Deck:
- Overview first run: Watch this domain after a check sets up both monitors
  and says what is watched, how often and where alerts go; names the
  watched domain and points to Plans when Free already watches another.
- Monitors is shown on Free: the watch with Turn off / Turn on, email as an
  alert channel, KEV/EPSS and webhooks hidden below Pro.
- Copy: Deck Plans, landing Free card (one line), docs FAQ, changelog,
  Privacy, Terms section 14; TOS_VERSION 2026-11-25.

Tests: test/worker/free-watch.test.mjs (rules, DO gating, email payload,
cap, stop link); plan-features updated for the Free watch.
@Darknode-Official
Darknode-Official changed the base branch from feat/domain-check to main November 26, 2026 03:00
@Darknode-Official
Darknode-Official merged commit cd2efa9 into main Nov 26, 2026
10 checks passed
@Darknode-Official
Darknode-Official deleted the feat/watch-default branch November 26, 2026 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant