security: bound Campaign editor metadata
This commit is contained in:
@@ -20,10 +20,12 @@ from govoplan_campaign.backend.db.models import (
|
||||
)
|
||||
from govoplan_campaign.backend.sending.execution import clear_execution_snapshot
|
||||
from govoplan_campaign.backend.campaign.mail_profile_boundary import (
|
||||
campaign_editor_state_for_edit,
|
||||
campaign_mail_profile_boundary_violations,
|
||||
campaign_mail_profile_id,
|
||||
assert_campaign_uses_mail_profile_reference,
|
||||
public_campaign_mail_server,
|
||||
validate_campaign_editor_state,
|
||||
)
|
||||
from govoplan_campaign.backend.integrations import files_integration, mail_integration
|
||||
from govoplan_campaign.backend.persistence.campaigns import (
|
||||
@@ -391,7 +393,11 @@ def fork_campaign_version_for_edit(
|
||||
current_flow=current_flow if current_flow is not None else (source.current_flow or CampaignVersionFlow.MANUAL.value),
|
||||
current_step=current_step if current_step is not None else source.current_step,
|
||||
is_complete=False,
|
||||
editor_state=editor_state if editor_state is not None else copy.deepcopy(source.editor_state or {}),
|
||||
editor_state=(
|
||||
validate_campaign_editor_state(editor_state)
|
||||
if editor_state is not None
|
||||
else campaign_editor_state_for_edit(source.editor_state)
|
||||
),
|
||||
autosaved_at=datetime.now(UTC) if autosave else None,
|
||||
)
|
||||
session.add(new_version)
|
||||
@@ -573,7 +579,7 @@ def update_campaign_version(
|
||||
if is_complete is not None:
|
||||
version.is_complete = is_complete
|
||||
if editor_state is not None:
|
||||
version.editor_state = editor_state
|
||||
version.editor_state = validate_campaign_editor_state(editor_state)
|
||||
if source_filename is not None:
|
||||
version.source_filename = source_filename
|
||||
if source_base_path is not None:
|
||||
|
||||
Reference in New Issue
Block a user