feat: add admin-enforced org and domain email signatures - #894
Open
halcycon wants to merge 1 commit into
Open
Conversation
Allow admins to enforce instance-wide or per-domain signature templates with replace/append/fallback merge modes, brand placeholders keyed by sender domain, and compose-time injection without storing large HTML in JMAP Identity fields. Co-authored-by: Cursor <cursoragent@cursor.com>
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
Adds admin-enforced email signatures that can be applied instance-wide or per sender email domain, without stuffing large HTML into JMAP
Identity.htmlSignature(which many servers, including Stalwart, limit to ~2047 bytes).Templates are stored in admin policy, resolved at compose time from the selected identity’s address, and injected through Bulwark’s existing signature embed / send path.
Policy model
New fields on
SettingsPolicy:orgSignatureenabledscope:instance|per_domainmergeMode:replace— org/domain signature only (ignore user signature)append— user signature, then org/domain signaturefallback— org/domain signature only when the user has noneinstance/perDomainHTML + plain-text templates--separator preference + optional lock for usersdomainBrandNames: sender email domain → brand display name (for{{brand.name}})Template placeholders
Supported in org/domain templates:
{{display.name}}/{{name}}/{{display_name}}{{email}}{{brand.name}}/{{brand_name}}(looked up fromdomainBrandNamesby sender email domain)Admin UI (
Admin → Signatures)User-facing behaviour
replaceImplementation notes
lib/org-signatures.ts(normalized on policy load viaconfig-manager)Test plan
domainBrandNamesand confirm{{brand.name}}resolves from the sender domainnpx vitest run lib/__tests__/org-signatures.test.tspassesMade with Cursor