Skip to content

Commit

Permalink
🐛 [#5035] Avoid the total configuration wrapper mutating the first st…
Browse files Browse the repository at this point in the history
…ep configuration

The total configuration wrapper merges the configuration wrapper of
each step into a single object for optimized access to values/
components. It takes the first step and merges the remaining steps into
it. However, this had the unintended side-effect of mutating the config
of the first step, manifesting in the objects API v1 registration with
the json_summary tag which contained extra, unexpected keys in the
submission data of the first step.

Fixed by making a deep copy first to end up with a different instance
that can be safely mutated.
  • Loading branch information
sergei-maertens committed Jan 28, 2025
1 parent 97d0cc4 commit 9e90a4c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/openforms/submissions/models/submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import logging
import uuid
from copy import deepcopy
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Mapping

Expand Down Expand Up @@ -429,9 +430,8 @@ def total_configuration_wrapper(self) -> FormioConfigurationWrapper:
if len(form_steps) == 0:
return FormioConfigurationWrapper(configuration={})

wrapper = FormioConfigurationWrapper(
form_steps[0].form_definition.configuration
)
begin_configuration = deepcopy(form_steps[0].form_definition.configuration)
wrapper = FormioConfigurationWrapper(begin_configuration)
for form_step in form_steps[1:]:
wrapper += form_step.form_definition.configuration_wrapper
self._total_configuration_wrapper = wrapper
Expand Down

0 comments on commit 9e90a4c

Please sign in to comment.