security: harden Campaign delivery effects and reconciliation
This commit is contained in:
@@ -590,6 +590,25 @@ def _validate_required_recipients(
|
||||
return MessageValidationStatus.EXCLUDED
|
||||
|
||||
|
||||
def _validate_required_sender(
|
||||
senders: list[RecipientConfig],
|
||||
issues: list[MessageIssue],
|
||||
validation_status: MessageValidationStatus,
|
||||
) -> MessageValidationStatus:
|
||||
if senders:
|
||||
return validation_status
|
||||
issues.append(
|
||||
MessageIssue(
|
||||
severity="error",
|
||||
code="missing_sender",
|
||||
message="No effective From address is configured; Campaign must resolve the sender before building.",
|
||||
behavior="block",
|
||||
source="recipients",
|
||||
)
|
||||
)
|
||||
return MessageValidationStatus.BLOCKED
|
||||
|
||||
|
||||
def _render_message_template(
|
||||
config: CampaignConfig,
|
||||
campaign_file: str | Path,
|
||||
@@ -784,6 +803,11 @@ def build_entry_message(
|
||||
if not entry.active:
|
||||
return _inactive_entry_message(config=config, entry=entry, entry_index=entry_index, context=context)
|
||||
|
||||
context.validation_status = _validate_required_sender(
|
||||
context.senders,
|
||||
context.issues,
|
||||
context.validation_status,
|
||||
)
|
||||
context.validation_status = _validate_required_recipients(
|
||||
config,
|
||||
context.recipients,
|
||||
|
||||
Reference in New Issue
Block a user