open-formulieren / open-forms

Smart and dynamic forms
https://open-forms.readthedocs.io
Other
36 stars 27 forks source link

It's possible to reuse single-use form definitions via import #3335

Open sergei-maertens opened 1 year ago

sergei-maertens commented 1 year ago

Product versie / Product version

latest (c9206923fcfab8180aba3fa7922d4bd9b200b82b)

Omschrijf het probleem / Describe the bug

Form definitions are marked as reusable to share them between forms. If the flag is set to False, that means the FD may only be used in a single form (and deleting that step in turn causes the form definition to be deleted too).

However, if you create an export of a form and then change the form slug in the export data, the same form definition is now used in multiple forms.

Stappen om te reproduceren / Steps to reproduce

(untested, this is a theory)

  1. Create export of a form with a form definition that is single-use
  2. Edit the slug of the form in the export JSON
  3. Import the export into the same environment
  4. The form definition is now (likely) used in both forms

Probably it's also possible by just re-importing the same form into the same environment, because our import logic will create a unique slug for it after which the same correlation logic will happen.

Verwacht gedrag / Expected behavior

A new form definition is created if it's not reusable.

Screen resolution

None

Device

None

OS

None

Browser

No response

joeribekker commented 1 year ago

Refinement: should be tackled when we rework the import/export

leaving the triage label because the bug is unconfirmed

sergei-maertens commented 1 year ago

I think the bug is now confirmed via https://github.com/open-formulieren/open-forms/issues/3378#issuecomment-1693359787