[BUG] Shared variables are overwritten when the execution forks during a workflow #5598
Closed
1 task done
Labels
Type: Bug
Inconsistencies or issues which will cause an issue or problem for users or implementors.
Milestone
Is there an existing issue for this?
Current Behavior
During a workflow, when a template has multiple matches for the same target (and the subtemlate is under a Matcher Name based condition check), therefore the execution forks and continues for each match separatelly, the extracted shared variables are overwritten between these fork execution flows in deeper subtemplates. Seems they share the same context in deeper templates between all the matches.
Expected Behavior
When there are multiple matches, the subsequent execution context of each match is separate.
Steps To Reproduce
Create a workflow that has deep subtemplates, a Matcher Name based condition check that will be hit multiple times, extract variables from the first template with different value for each match, try to refer them in deeper templates.
debug_workflow_deep.yaml
debug_first.yaml
debug_between.yaml
debug_last.yaml
Execution
nuclei -target https://httpbin.org/uuid -workflows debug_workflow_deep.yaml -v
It's visible that in the first subtemplate receive separate values, but after its execution of the second match, it overwrites the first value in subsequence subtemplates.
It is usually not an issue for workflows where is only one level of subtemplates:
debug_workflow_flat.yaml
I guess the overwriting happens here as well but since there's no more subtemplates it's not causing a problem.
Relevant log output
Environment
Anything else?
It is really good that the workflow execution fork when there are multiple matches and the subtemlates are executed for each one, please don't remove this feature! 🙂
The text was updated successfully, but these errors were encountered: