Repository navigation
feat(notify): forge-notify, optional email and Web Push notifications - #387
Merged
Merged
Conversation
… for Forge identities services/forge-notify is a multi-tenant notification service. A subscriber proves control of a Forge identity with a signed request (docs/design/service-auth.md: a domain-separated secp256k1 signature by an AUTHENTICATION key read from Platform with proofs; no account, no password), confirms an address by mail (double opt-in, a button page so link scanners do not confirm), and picks topics (participating, review requested, assigned, mentioned, watched, own repos, releases, private activity), channels and instant or daily digest delivery. It follows each subscriber's watched, owned and member repositories with proved reads, polls the public ones through forge-relay's ingest and renderer, reads review requests and assignments from the addressee index in any repository, and scans @mentions in public content. For private repositories it reads public metadata only and says new activity, never a title. Addresses and push endpoints are sealed with AES-256-GCM under an HKDF-derived key with a keyed blind index; mails carry RFC 8058 one-click unsubscribe; Web Push is RFC 8291 with VAPID; export and delete endpoints; per-IP, per-identity, per-address and global quotas; /healthz, /readyz and an aggregate /metrics. forge-web gets Settings > Notifications with an optional Email and push section shown only when NEXT_PUBLIC_NOTIFY_URL is set, signing with the browser key (controller.serviceKey), a push service worker, and the shared test vector. Dockerfile, docker-compose and docs/hosting/forge-notify.md (env vars, DNS, TLS, SPF/DKIM/DMARC, backups, monitoring, log hygiene, rate limits, privacy notice draft). The survivability drill gains a notify-down case. The relay and runner Dockerfiles copy services/ since it now holds a workspace member. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…roxy modes, link and token hardening Review requests and assignments follow forge-web's inbox rules (an assignment is a member's event, a review request asks only on a pull request, and the thread must belong to the event's repository); two capped pages merge without skipping past a full one; a watch document never follows a private repository; FORGE_NOTIFY_TRUST_PROXY is none, cloudflare or forwarded (the last X-Forwarded-For entry); the key cache evicts expired entries and misses before clearing; the reindex queue is bounded and deduplicated; a confirmed new address and a re-created subscriber void old unsubscribe links; deleting keeps the day's quota counters; the privacy link must be https on both sides, and the web app signs only for the host it calls. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…pose, operator includes the port Addressed and private-activity notices name the author and owner by DPNS label like the relay's notices. The compose file takes settings from .env with env_file, so an unset setting keeps its default instead of arriving empty. The default operator is the public URL's host and port, as a browser's URL.host names it. The hosting guide says which private-repo activity is seen. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 18 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
⛔ Files ignored due to path filters (1)
📒 Files selected for processing (45)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…roup usable_signing_key never looked at a key's bounds, so a HIGH AUTHENTICATION key that a third-party dapp holds, bound to its own contract, could export a user's email, take over the address or delete their data. forge-core's IdentityKeyInfo gains bounds (KeyBounds: the contract and document type, or the contract group id; bound_to is unchanged for existing callers) and ForgeIds::allows_key_bounds. forge-notify now accepts only unbound keys or keys bound to a Forge contract or the Forge contract group. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…t one mailbox A confirmation mail did not count against the service's global daily send budget, and the per-address limit was keyed on the lowercased address as given, so +tags and Gmail's dotted spellings each got a fresh limit. email.set now charges the global budget, and the per-address limit counts a normalised mailbox (no +tag; no dots for gmail.com/googlemail.com). The stored index is unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…subscribers send_digests deleted an identity's items before the send could fail (budget spent, mail paused, a temporary SMTP failure), so those digests were lost silently. Items are now read, and deleted up to the newest one sent only after a successful send; the 7-day purge still bounds what never goes. A subscriber with no working address and daily delivery, or past the per-user daily cap, got nothing: the notices went to a digest that is never mailed. Such notices now go as pushes when they happen, within the global budget. test.send reports whether the test mail really went. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… skips the cap push.add upserted on endpoint_hash alone and set identity on conflict, so registering an endpoint took it from whichever identity had it. Rows are now unique per (identity, endpoint_hash) and a conflict refreshes only that identity's row; one browser may serve several identities. A store with the old table is rebuilt in place, keeping its rows. The 10-browser cap counted rows before the upsert, so re-adding a browser already registered failed at 10. It is skipped when the endpoint is already among the identity's rows. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The forms posted to root-relative /v1/verify and /u/{token}, which miss the service when
PUBLIC_URL has a path prefix. Their actions are now built from public_url.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…n windows poll_private saved its cursor before delivering, so a failed delivery lost the window, and it excluded a subscriber when the newest write was theirs, hiding other writers' earlier activity in the same window. Chain::latest_activity becomes activity_since: the writes after the cursor (a page per kind of document; a full page ends the window so nothing is skipped), with the window's newest time and its writers. The cursor is saved after delivery, and a subscriber is left out only when every write in the window is theirs. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Sending push-only subscribers their over-cap notices skipped the user: quota altogether, so one identity watching a busy repo could draw down the shared daily budget. The cap applies again: a push-only subscriber on daily delivery gets pushes as notices happen, up to the cap, and past it a notice is skipped since there is no digest to hold it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # forge-web/app/settings/page.tsx # forge-web/lib/short-url.ts
Split the 63-word privacy paragraph in two and say "written to Dash Platform" instead of the banned "on chain". Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
forge-notify: an optional, multi-tenant service that sends Dash Forge notifications by email and browser push (owner decision D1, "host more"). Forge works the same without it. The in-browser inbox still reads the chain, and every notice links back to forge-web, which reads the chain again with proofs.
Stacked on #370 (relay sinks): the service embeds forge-relay's ingest, notice renderer and SMTP transport.
The service (
services/forge-notify)docs/design/service-auth.md). The signature is a domain-separated secp256k1 signature by anAUTHENTICATIONHIGH/CRITICAL key, read from Platform with proofs. Each request carries a single-use nonce, a time within ±300 s, and the operator's name. This is an off-chain convention, not a protocol feature. A test vector is shared with the web app.List-UnsubscribeandAuto-Submitted. An address is paused after 3 hard bounces.addresseeindex, in any repo, using the same rules as forge-web's inbox;@mentions(DPNS label or identity id) in public content.data.exportanddata.deleteare supported. Logs contain no addresses, tokens or endpoints.FORGE_NOTIFY_TRUST_PROXY=none|cloudflare|forwarded, the last XFF entry), per-identity and per-address confirmation quotas, subscriber and repo caps, a per-user daily cap and a global daily send budget./healthz,/readyz, aggregate/metrics; aDockerfile(non-root, healthcheck),docker-compose.ymlwith Docker secrets, andforge-notify keys.Web
Settings → Notifications (
/settings/notifications/) links to the inbox. Its Email and push section shows only when the build setsNEXT_PUBLIC_NOTIFY_URL. It has privacy copy, email confirm and remove, push on and off in this browser (public/notify-sw.js), topics, digest, test, export and delete. Requests are signed with the browser's limited key (controller.serviceKey()), and only for the host the build calls. Settings links to it.Docs
docs/hosting/forge-notify.mdcovers what you need, run, every env var, DNS/TLS, SPF/DKIM/DMARC, Web Push, routes, rate limits, monitoring, logs, backups, the web build flag, local testing, billing (designed, later), a privacy notice draft, and a checklist for dashhq.Survivability
"notify down" is now part of the browse drill (
components/notify-panel.test.tsx): an unreachable service shows one line and nothing else changes. No read-path crate can link forge-notify, because it depends on forge-relay, which the drill already keeps off the read path.Review
An independent review (security focus) found 10 issues. All are fixed in
fix(notify): address review …:watchdoc no longer follows a private repo;Test evidence
cargo test -p forge-notify: 18 unit tests plus 2 integration tests. The integration tests run subscribe → confirm → route (watch, participant, mention, private) → one-click unsubscribe → export → delete, and check CORS/CSP and metrics, all with a stub chain, mailer and push service. Clippy is clean with-D warnings.svcn-alice-7/svcn-bob-7:svc-notify-priv, where bob's sealed issue produced "New activity in a private repository you belong to" with no title or text (checked with aSHOULD-NOT-LEAKmarker).NEXT_PUBLIC_NOTIFY_URLwas signed in by importing alice. The browser's contract-bound limited key signedaccount.get,prefs.setandtest.send, and the service accepted them.docker compose upran against sakura;/readyzand/v1/infoanswered; a signed sign-up was confirmed;test.sendmail carriedList-Unsubscribe+List-Unsubscribe-Post; one-click unsubscribe, export and delete worked.dash-forge-qa/evidence/svc-notify/forge-notify/(Mailpit messages with tokens redacted, decrypted pushes, service and container logs, web screenshots).Owner actions to host it
A hostname (e.g.
notify.forge.dashhq.org) on the Cloudflare tunnel, and a transactional SMTP provider with the SPF, DKIM, DMARC and bounce records for the sending domain. Runforge-notify keysonce and store the data key and VAPID key. Publish the privacy notice. Build forge.dashhq.org withNEXT_PUBLIC_NOTIFY_URL. The checklist is in the hosting guide.Not in this PR
🤖 Generated with Claude Code