Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clone Input when the workflow execution forks #5621

Conversation

tovask
Copy link
Contributor

@tovask tovask commented Sep 10, 2024

Proposed changes

Closes #5598

When the execution forks into multiple branches during a workflow, the subsequent subtemplates under a Matcher Name based condition check run with a new clone of the Input, so that they won't overwrite each other's extracted shared variables.

(This is not an issue when there are simle conditional subtemplates without a Matcher Name, because in that case the execution won't fork due to the slightly different logic. Though I'm not sure if this is intentional.)

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/regression tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@auto-assign auto-assign bot requested a review from dogancanbakir September 10, 2024 08:49
@GeorginaReeder
Copy link

Thanks so much for your contribution @tovask ! :)

@ehsandeep ehsandeep requested a review from Mzack9999 September 10, 2024 18:48
Copy link
Member

@Mzack9999 Mzack9999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm - The shared context was initially intentional as nested templates would have been able to share values and modify them (for example a nested login), but I agree that it's just cleaner to consider each branch independent and pass values copies.

@ehsandeep ehsandeep merged commit 6347efa into projectdiscovery:dev Sep 19, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Shared variables are overwritten when the execution forks during a workflow
5 participants