Skip to content

Commit 9ceab3e

Browse files
authored
Merge pull request mendix#6142 from Robinfr/microflow-validation-best-practices
Microflow validation best practices
2 parents f0f0619 + ced15ba commit 9ceab3e

4 files changed

Lines changed: 104 additions & 0 deletions

File tree

content/en/docs/howto7/general/dev-best-practices.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,32 @@ Use microflow [error handling](/howto7/logic-business-rules/set-up-error-handlin
310310

311311
Complex processes and important business logic (like workflow processing or validations) must include debug and trace [logging](/refguide7/logging/). Logging actions must write the current state and progress of the process and must include a request ID or other identifying information. The log node should be the name of the module. This will greatly assist error analysis.
312312

313+
#### 4.2.6 Validating Inputs in Microflows
314+
315+
When microflows are invoked from the client side, it is important to validate the inputs. By having validations, you prevent incorrect, inappropriate, or potentially harmful data from being used in your microflows. This protects your application against security vulnerabilities. The following presents the best practices regarding the integrity and validation of inputs in your microflows.
316+
317+
##### 4.2.6.1 Implementing Validation Checks
318+
319+
Adding validation checks is vital for ensuring that input data conforms to the expected data type, format, range, or other application-specific constraints. For instance, if a numeric input is expected within a defined range, validation checks should confirm that the input is indeed numeric and falls within the specified range.
320+
321+
##### 4.2.6.2 Managing Unexpected Values
322+
323+
When building microflows, it is important to account for the potential occurrence of unexpected values. These could be empty values, or values outside the expected range or format. It is also important to ensure that read-only attributes only contain expected values.
324+
325+
{{% alert color="warning" %}}
326+
We strongly recommend adding validation checks to all microflows inputs, including read-only attributes.
327+
328+
We also recommend avoiding storing intermediary values in attributes (such as, *TotalPrice*). Instead, calculate these values when needed to ensure you have the correct values.
329+
{{% /alert %}}
330+
331+
Microflows should incorporate mechanisms to detect unexpected values and respond suitably – this might involve returning an error message to the end-user or executing a fallback operation.
332+
333+
##### 4.2.6.3 Updating Validation Logic Regularly
334+
335+
As the application evolves, the validation logic within microflows should be updated accordingly to reflect changes in business logic or data models. This regular review and update of validation checks ensures that microflows remain secure and function correctly over time.
336+
337+
By prioritizing the validation of inputs in microflows, you not only enhance the security of your application, but also ensure a more predictable and stable user experience. This practice underscores the development of reliable and robust applications.
338+
313339
### 4.3 Warnings and Modeler Feedback
314340

315341
No warnings should be visible in the Modeler, unless explicitly documented with a reason. Warnings can indicate many issues, including maintainability and security risks, which must be resolved.

content/en/docs/howto8/general/dev-best-practices.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,32 @@ Use microflow [error handling](/howto8/logic-business-rules/set-up-error-handlin
329329

330330
Complex processes and important business logic (like workflow processing or validations) must include debug and trace [logging](/refguide8/logging/). Logging actions must write the current state and progress of the process and must include a request ID or other identifying information. The log node should be the name of the module. This will greatly assist error analysis.
331331

332+
#### 4.2.6 Validating Inputs in Microflows
333+
334+
When microflows are invoked from the client side, it is important to validate the inputs. By having validations, you prevent incorrect, inappropriate, or potentially harmful data from being used in your microflows. This protects your application against security vulnerabilities. The following presents the best practices regarding the integrity and validation of inputs in your microflows.
335+
336+
##### 4.2.6.1 Implementing Validation Checks
337+
338+
Adding validation checks is vital for ensuring that input data conforms to the expected data type, format, range, or other application-specific constraints. For instance, if a numeric input is expected within a defined range, validation checks should confirm that the input is indeed numeric and falls within the specified range.
339+
340+
##### 4.2.6.2 Managing Unexpected Values
341+
342+
When building microflows, it is important to account for the potential occurrence of unexpected values. These could be empty values, or values outside the expected range or format. It is also important to ensure that read-only attributes only contain expected values.
343+
344+
{{% alert color="warning" %}}
345+
We strongly recommend adding validation checks to all microflows inputs, including read-only attributes.
346+
347+
We also recommend avoiding storing intermediary values in attributes (such as, *TotalPrice*). Instead, calculate these values when needed to ensure you have the correct values.
348+
{{% /alert %}}
349+
350+
Microflows should incorporate mechanisms to detect unexpected values and respond suitably – this might involve returning an error message to the end-user or executing a fallback operation.
351+
352+
##### 4.2.6.3 Updating Validation Logic Regularly
353+
354+
As the application evolves, the validation logic within microflows should be updated accordingly to reflect changes in business logic or data models. This regular review and update of validation checks ensures that microflows remain secure and function correctly over time.
355+
356+
By prioritizing the validation of inputs in microflows, you not only enhance the security of your application, but also ensure a more predictable and stable user experience. This practice underscores the development of reliable and robust applications.
357+
332358
### 4.3 Warnings and Studio Pro Feedback
333359

334360
No warnings should be visible in Studio Pro, unless explicitly documented with a reason. Warnings can indicate many issues, including maintainability and security risks, which must be resolved.

content/en/docs/refguide/modeling/dev-best-practices.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,32 @@ Use microflow [error handling](/refguide/error-handling-in-microflows/) for all
360360

361361
Complex processes and important business logic (like workflow processing or validations) must include debug and trace [logging](/refguide/logging/). Logging actions must write the current state and progress of the process and must include a request ID or other identifying information. The log node should be the name of the module. This will greatly assist error analysis.
362362

363+
#### 4.2.6 Validating Inputs in Microflows
364+
365+
When microflows are invoked from the client side, it is important to validate the inputs. By having validations, you prevent incorrect, inappropriate, or potentially harmful data from being used in your microflows. This protects your application against security vulnerabilities. The following presents the best practices regarding the integrity and validation of inputs in your microflows.
366+
367+
##### 4.2.6.1 Implementing Validation Checks
368+
369+
Adding validation checks is vital for ensuring that input data conforms to the expected data type, format, range, or other application-specific constraints. For instance, if a numeric input is expected within a defined range, validation checks should confirm that the input is indeed numeric and falls within the specified range.
370+
371+
##### 4.2.6.2 Managing Unexpected Values
372+
373+
When building microflows, it is important to account for the potential occurrence of unexpected values. These could be empty values, or values outside the expected range or format. It is also important to ensure that read-only attributes only contain expected values.
374+
375+
{{% alert color="warning" %}}
376+
We strongly recommend adding validation checks to all microflows inputs, including read-only attributes.
377+
378+
We also recommend avoiding storing intermediary values in attributes (such as, *TotalPrice*). Instead, calculate these values when needed to ensure you have the correct values.
379+
{{% /alert %}}
380+
381+
Microflows should incorporate mechanisms to detect unexpected values and respond suitably – this might involve returning an error message to the end-user or executing a fallback operation.
382+
383+
##### 4.2.6.3 Updating Validation Logic Regularly
384+
385+
As the application evolves, the validation logic within microflows should be updated accordingly to reflect changes in business logic or data models. This regular review and update of validation checks ensures that microflows remain secure and function correctly over time.
386+
387+
By prioritizing the validation of inputs in microflows, you not only enhance the security of your application, but also ensure a more predictable and stable user experience. This practice underscores the development of reliable and robust applications.
388+
363389
### 4.3 Workflows
364390

365391
Guidelines below can help you choose a short yet meaningful name for your workflow:

content/en/docs/refguide9/modeling/dev-best-practices.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,32 @@ Use microflow [error handling](/refguide9/error-handling-in-microflows/) for all
360360

361361
Complex processes and important business logic (like workflow processing or validations) must include debug and trace [logging](/refguide9/logging/). Logging actions must write the current state and progress of the process and must include a request ID or other identifying information. The log node should be the name of the module. This will greatly assist error analysis.
362362

363+
#### 4.2.6 Validating Inputs in Microflows
364+
365+
When microflows are invoked from the client side, it is important to validate the inputs. By having validations, you prevent incorrect, inappropriate, or potentially harmful data from being used in your microflows. This protects your application against security vulnerabilities. The following presents the best practices regarding the integrity and validation of inputs in your microflows.
366+
367+
##### 4.2.6.1 Implementing Validation Checks
368+
369+
Adding validation checks is vital for ensuring that input data conforms to the expected data type, format, range, or other application-specific constraints. For instance, if a numeric input is expected within a defined range, validation checks should confirm that the input is indeed numeric and falls within the specified range.
370+
371+
##### 4.2.6.2 Managing Unexpected Values
372+
373+
When building microflows, it is important to account for the potential occurrence of unexpected values. These could be empty values, or values outside the expected range or format. It is also important to ensure that read-only attributes only contain expected values.
374+
375+
{{% alert color="warning" %}}
376+
We strongly recommend adding validation checks to all microflows inputs, including read-only attributes.
377+
378+
We also recommend avoiding storing intermediary values in attributes (such as, *TotalPrice*). Instead, calculate these values when needed to ensure you have the correct values.
379+
{{% /alert %}}
380+
381+
Microflows should incorporate mechanisms to detect unexpected values and respond suitably – this might involve returning an error message to the end-user or executing a fallback operation.
382+
383+
##### 4.2.6.3 Updating Validation Logic Regularly
384+
385+
As the application evolves, the validation logic within microflows should be updated accordingly to reflect changes in business logic or data models. This regular review and update of validation checks ensures that microflows remain secure and function correctly over time.
386+
387+
By prioritizing the validation of inputs in microflows, you not only enhance the security of your application, but also ensure a more predictable and stable user experience. This practice underscores the development of reliable and robust applications.
388+
363389
### 4.3 Workflows
364390

365391
Guidelines below can help you choose a short yet meaningful name for your workflow:

0 commit comments

Comments
 (0)