Workflow element update via REST doesn't validate given data

Created on 13 June 2023, about 1 year ago

Problem/Motivation

Modules in use

  • webform
  • webform_rest
  • webform_workflows_element

When webform submission is created with webform workflow element, there is row in the webform_submission_data with

  • name: workflow
  • propery: workflow_state
  • value:

Problem is that the property and value can be freely set with random value when using webform_rest patch.
Example of "invalid" PATCH payload workflow part

{
  ...
  "workflow": {
    "cat": "dog"
  }
}

Example of "valid" PATCH payload

{
  ...
  "workflow": {
    "workflow_state": "input_needed"
  }
}

Note that I haven't yet checked if the issue is on the webform_rest side.

Steps to reproduce

  • Configure a webform workflow
  • Create new webform
  • Add workflow element to the webform using the created workflow
  • Create new submission
  • Use example Postman to send the webform_rest PATCH request with the "invalid" payload

The database value can be seen with query select * from webform_submission_data where name='workflow' order by sid desc;.

Proposed resolution

Trigger error when webform is being validated.

Remaining tasks

  1. Find where the issue occurs in the code
  2. Write patch.

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇫🇮Finland MikaT

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024