Repository navigation
Conversation
foxkdev
approved these changes
Nov 24, 2026
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.
Summary
Alerts can now email people without a GitOps account (vendors, on-call mailboxes), limited to domains the organization allows and only after each address confirms it wants to receive them.
/org/<org>/settings/notificationspage. The organization lists the domains it allows (needsorganization:settings:update). The list is empty by default, which means no external recipients. Matching is exact;*.example.comcovers subdomains. Domains are normalized to lower case and punycode, and the check runs on the domain of each address. Removing a domain marks its recipientsblockedwithout deleting them; allowing it again restores their previous status.recipients.externalEmails. The API validates them (domain_not_allowed,invalid_email). Adding addresses needsorganization:notifications:updateorproject:notifications:update; keeping or removing existing ones does not. Addresses live in a new GitDB entityexternal_recipients, one per organization and shared by all its alerts.external-recipient-verifyemail. The token is random, stored hashed, valid for 7 days and single use. Resends are rate limited to 3/h per address and 30/h per organization. The link opens a public/notifications/verifypage, allowed without a session inhooks.server.ts.verifiedaddresses of a currently allowed domain get alerts. They skip the cancan filter, since they have no account, and never get system notifications. Their email is a reduced version: no links into the app, no catalog fields markedsensitive(vault secret name and path), plus an unsubscribe link and aList-Unsubscribeheader./notifications/unsubscribepage stops every alert of the organization to that address. The token is stateless (HMAC withGITDB_ENCRYPTION_KEY, 90 days), made single use by a version counter on the recipient. Both public pages only act on POST, so mail scanners opening a link change nothing."send": trueonPOST /api/alerts/testandPOST /api/alerts/[id]/test. It really emails the recipients an alert would reach, using a complete example event and a[Test]subject. It needs SMTP, is limited to 5 per user every 10 minutes and never touches the throttle. On an unsaved alert, new external addresses get their confirmation email first and receive the next test once confirmed.Shared pieces, built to be reused by the channels work (#95):
organization|project:notifications:read|create|update|deletepermissions, granted to the default Organization Admin and Project Admin roles.$modules/notificationsmodule.#lib/server/infra/tokens.ts(one-time and signed tokens) andrate-limit.ts.MailNotification, and server-side email translations and parts moved toinfra/notifications.Fixes found while testing:
mailSummaryorlink.vite dev, email links use the dev server's real origin. Production still uses onlyORIGIN.Related issue
Closes #99
Part of #82
Change type
Verification
bun run check: only the existing error insrc/lib/server/gitdb/index.ts(branchoption), also present onmainbun run lintbun run test: 696 tests passbun run format:check: fails on 108 files already unformatted onmain; every file changed here passes PrettierReview notes
notification_settingsandexternal_recipients. No migration needed; both start empty.organization:notifications:*enabled in the role editor to manage external recipients, as withevents:all.ORIGINis required: without it, confirmation and unsubscribe links can't be built, so nothing is sent to external addresses. The settings page shows a warning.List-Unsubscribe-Post(RFC 8058 one-click): mail providers send that POST without anOriginheader, and SvelteKit's CSRF check rejects it. Supporting it would mean moving the CSRF check intohooks.server.tswith an exception for that route. Left as a follow-up decision.🤖 Generated with Claude Code