Skip to content
Open

DKIM2 #848

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
b488189
DKIM2
juliebin Jun 1, 2026
3b7f03b
review comments from cursor
juliebin Jun 1, 2026
fced77f
for more review comments
juliebin Jun 1, 2026
ef30b8a
dkim2: minor update
juliebin Jun 1, 2026
a8bfb95
dkim2: update limitation section
juliebin Jun 1, 2026
3473558
some refinement
juliebin Jun 1, 2026
f610093
rename dkim2.md
juliebin Jun 2, 2026
997c5a1
update to support multi-algorithm signing via sig_sets (§7.8 algorith…
juliebin Jun 2, 2026
7bbc81a
update
juliebin Jun 5, 2026
86efa82
update with new sign/verify options
juliebin Jun 9, 2026
c33d530
more update
juliebin Jun 10, 2026
9e48da2
update verify error code
juliebin Jun 10, 2026
9f7bf8a
rt returns a list of recipients
juliebin Jun 10, 2026
42e8bcf
add warning on §12 Bare CR/LF normalization
juliebin Jun 10, 2026
68f9761
update according to review comments
juliebin Jun 10, 2026
6069890
update signing hook guidance and rt= options for multi-recipient default
juliebin Jun 10, 2026
b425b88
clarify that verify() can be called from both validate_data_spool_* h…
juliebin Jun 10, 2026
3d98a7f
update
juliebin Jun 10, 2026
495c64c
remove interoperability part
juliebin Jun 10, 2026
3dd7a84
add keybuf support for sign() as alternative to keyfile
juliebin Jun 10, 2026
ded3dc8
clarify forwarder auto-detection limitation
juliebin Jun 10, 2026
7d95eb2
update BCC privacy
juliebin Jun 11, 2026
caee2dc
more update
juliebin Jun 11, 2026
2e8d7e4
key_service_mismatch
juliebin Jun 11, 2026
7e51464
consolidate signing hook comparison into table
juliebin Jun 11, 2026
7d5f534
operator-facing doc revisions, known limitations, AR output and conte…
juliebin Jun 11, 2026
7fd3bd4
clarify limitations, add recipe workaround, operator-facing rewrites
juliebin Jun 11, 2026
b7236d6
fix links
juliebin Jun 11, 2026
74e45d5
fix broken links
juliebin Jun 11, 2026
a892f7f
fix broken links
juliebin Jun 11, 2026
7053703
fix broken links
juliebin Jun 11, 2026
726b144
fix broken links
juliebin Jun 11, 2026
325d854
some fixes
juliebin Jun 11, 2026
3d0f95f
update verify() called from validate_data_spool hook
juliebin Jun 11, 2026
315081d
note auto-exploded heuristic limitation for single-subscriber lists
juliebin Jun 11, 2026
aea66b8
nit
juliebin Jun 11, 2026
c5eee05
update overall_reason
juliebin Jun 12, 2026
9c9fa52
rcptto option, result fields, AR examples and reason code mapping
juliebin Jun 12, 2026
64f0728
update header.s part in AR
juliebin Jun 12, 2026
beef680
add ar_clauses() API, fix doc gaps, remove skip_ar_header_update dead…
juliebin Jun 12, 2026
bb1772b
update multi-recipient message handling
juliebin Jun 12, 2026
d85fcbb
update
juliebin Jun 12, 2026
89b841d
minor update
juliebin Jun 12, 2026
f5f8d57
AR session restrucure
juliebin Jun 12, 2026
8405d6d
AR update
juliebin Jun 12, 2026
4c81614
update
juliebin Jun 13, 2026
57965e3
update AR status code
juliebin Jun 13, 2026
bc8a823
update with §8.2 auto-bridge options and examples
juliebin Jun 16, 2026
8eb2dc6
dkim2: fix §10.5/§10.6 chain_verified doc accuracy
juliebin Jun 17, 2026
8923165
dkim2: soften future-release wording in known limitation
juliebin Jun 17, 2026
411c25b
update along with the code change
juliebin Jun 17, 2026
7faadc5
split into parent overview + per-API child pages
juliebin Jun 17, 2026
0be177c
allow_missing_recipe sign option
juliebin Jun 18, 2026
018a626
update code examples, API accuracy, operator guidance
juliebin Jun 18, 2026
86724ba
update on sig-set failures, and behavior on key testing mode
juliebin Jun 20, 2026
129960a
minor spec clarification on signature_expired
juliebin Jun 20, 2026
6dd6dc9
Merge branch 'main' into 1259-dkim2-prototyping
dkoerichbird Jun 25, 2026
a883b27
Addressing some review feedbacks (SparkPost/Momentum#1259)
dkoerichbird Jun 25, 2026
9b7e36e
Missed a small change (SparkPost/Momentum#1259)
dkoerichbird Jun 25, 2026
4b474b0
Doc: adding `nd=` (from -O3) documentation (SparkPost/Momentum#1259)
dkoerichbird Jun 26, 2026
34fe2ba
doc: Updating spec references (SparkPost/Momentum#1259)
dkoerichbird Jun 26, 2026
1ca0c08
doc: Changing to permerror in d<->mf mismatch (SparkPost/Momentum#1259)
dkoerichbird Jun 26, 2026
09b6a5d
docs: Changing verify documentation from latest -O3 updates (SparkPos…
dkoerichbird Jun 29, 2026
dc4fe63
fix: Doug`s review (SparkPost/Momentum#1259)
dkoerichbird Jun 29, 2026
7a54f6d
doc: Sweeping -O2 to -O3 references (SparkPost/Momentum#1259)
dkoerichbird Jun 29, 2026
a1599a1
doc: Sweeping -O2 to -O3 missed references (SparkPost/Momentum#1259)
dkoerichbird Jun 29, 2026
f256c3d
fix: Another Doug`s review (SparkPost/Momentum#1259)
dkoerichbird Jun 29, 2026
14ae475
fix: Late fixes from AI review (SparkPost/Momentum#1259)
dkoerichbird Jun 29, 2026
aaa37ed
fix: Removing source code mention (SparkPost/Momentum#1259)
dkoerichbird Jun 30, 2026
eaefd85
doc: Late fix from Cursor feedback (SparkPost/Momentum#1259)
dkoerichbird Jul 1, 2026
9188566
Merge branch 'main' into 1259-dkim2-prototyping
dkoerichbird Jul 7, 2026
1f15061
fix: Moving signer to `core_final_validation2` hook (SparkPost/Moment…
dkoerichbird Jul 7, 2026
bcd45c5
fix: Minor fixes in text (SparkPost/Momentum#1259)
dkoerichbird Jul 7, 2026
7523f7f
fix: Addressing Cursor feedback (SparkPost/Momentum#1259)
dkoerichbird Jul 7, 2026
3f5fda6
doc: Adding note about limitation on unsigned headers (SparkPost/Mome…
dkoerichbird Jul 7, 2026
80152ff
enh: Review implementation with -O4 spec (SparkPost/Momentum#1259)
dkoerichbird Jul 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 36 additions & 10 deletions content/momentum/3/3-api/hooks-core-final-validation.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
lastUpdated: "03/26/2020"
title: "final_validation"
description: "final validation This hook is invoked after the normal validation steps void core final validation closure msg ac ctx void closure ec message msg accept construct ac validate context ctx This hook is invoked after the normal validation steps have completed and is the recommended hook point to implement message..."
lastUpdated: "07/07/2026"
title: "final_validation / final_validation2"
description: "final validation This hook is invoked after the normal validation steps and is the recommended hook point to implement message signing prior to spooling. Two variants exist: core_final_validation (void) and core_final_validation2 (returns a status so a signer can fail or tempfail the message)."
---

<a name="hooks.core.final_validation"></a>
## Name

final_validation — This hook is invoked after the normal validation steps
final_validation, final_validation2 — This hook is invoked after the normal validation steps

## Synopsis

Expand All @@ -18,13 +18,15 @@ final_validation — This hook is invoked after the normal validation steps
|   | <var class="pdparam">ac</var>, |   |
|   | <var class="pdparam">ctx</var>`)`; |   |

| `int **core_final_validation2** (` | <var class="pdparam">closure</var>, | |
| | <var class="pdparam">msg</var>, | |
| | <var class="pdparam">ac</var>, | |
| | <var class="pdparam">ctx</var>`)`; | |

`void * <var class="pdparam">closure</var>`;
`ec_message * <var class="pdparam">msg</var>`;
`accept_construct * <var class="pdparam">ac</var>`;
`validate_context * <var class="pdparam">ctx</var>`;<a name="idp45851968"></a>
## Description

This hook is invoked after the normal validation steps have completed and is the recommended hook point to implement message signing prior to spooling the message to disk and attempting delivery.
`validate_context * <var class="pdparam">ctx</var>`;<a name="idp45851968"></a>

**<a name="idp45853360"></a> Parameters**

Expand Down Expand Up @@ -66,11 +68,35 @@ The `validate_context` struct. For documentation of this data structure see [“

**<a name="idp45864272"></a> Return Values**

This hook returns `void`.
`core_final_validation` returns `void`.

`core_final_validation2` returns an `int` status:

| Value | Constant | Meaning |
|---|---|---|
| `0` | `EC_HOOK_CONT` | Success — continue. Use this even after a *non-fatal* failure if you want the message delivered unsigned rather than rejected. |
| `1` | `EC_HOOK_DONE` | Error — reject the message (permanent failure). |
| `2` | `EC_HOOK_RETRY` | Temporary error — defer the message; delivery may be retried. |

## Description

This hook is invoked after the normal validation steps have completed and is the recommended hook point to implement message signing prior to spooling the message to disk and attempting delivery.

It fires on **every injection path** — the same point terminates both the SMTP/relay reception sequence and the HTTP/`msg_gen` (transmissions) generation sequence (see [Policy Phases](/momentum/4/4-policy)). This makes it the natural place for signing that must apply regardless of how a message entered Momentum, in contrast to the `validate_data_spool` / `validate_data_spool_each_rcpt` hooks, which are driven only by the SMTP swap-out engine and therefore never fire on the `msg_gen` path.

### final_validation vs. final_validation2

Two variants of this hook exist at the same point:

- **`core_final_validation`** — the original hook. Returns `void`; it cannot signal a result back to the caller, so a failure inside it cannot reject or defer the message.
- **`core_final_validation2`** — an extended variant that returns an `int` status (see *Return Values* below), letting a caller **fail (reject) or tempfail (retry)** the message when the validation fails.

*Both variants are invoked* at the same point; `core_final_validation2` is called **first**, and if it returns `EC_HOOK_DONE`/`EC_HOOK_RETRY` the message is rejected/deferred before `core_final_validation` runs. Existing `void` signers registered on `core_final_validation` continue to work unchanged. The [`post_final_validation`](/momentum/4/hooks/core-post-final-validation) hook runs after both.

**<a name="idp45865632"></a> Threading**

This hook will be called in any thread.

<a name="idp45866720"></a>
## See Also

## See Also
Loading
Loading