Skip to content

fix(workflow-engine): Validate AssignedTo condition targets belong to the organization#117110

Merged
malwilley merged 2 commits into
masterfrom
malwilley/manado
Jun 9, 2026
Merged

fix(workflow-engine): Validate AssignedTo condition targets belong to the organization#117110
malwilley merged 2 commits into
masterfrom
malwilley/manado

Conversation

@malwilley

Copy link
Copy Markdown
Member

Followup to #117007

When creating or updating a workflow with an AssignedTo condition, nothing previously stopped you from referencing a team or member from a completely different organization. This adds server-side validation to reject those cross-org references at save time.

The approach adds a validate_comparison classmethod to DataConditionHandler so that consumers can add additional validation checks beyond basic json schema validation. AssignedToConditionHandler overrides it to check that the referenced team/member actually belongs to the organization. The organization data is already present in the condition context.

… the organization

Add a validate_comparison hook to DataConditionHandler that runs after
JSON schema validation. The AssignedTo handler uses it to verify that
referenced teams and members actually belong to the request organization,
preventing cross-org references in workflow conditions.

Thread the organization context from the workflow validator through
DataConditionGroupValidator into BaseDataConditionValidator so the
handler can perform the org-scoped lookup.
@malwilley malwilley requested a review from a team as a code owner June 8, 2026 18:17
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 8, 2026
)

organization = self.context.get("organization")
if organization is not None:

@malwilley malwilley Jun 8, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I wish context was strongly typed so this guard was not necessary. I believe organization should be guaranteed?

I see a similar todo comment here:

if not organization:
# ¯\_(ツ)_/¯
# TODO(kylec): Require organization to be in the context.
return

@ceorourke ceorourke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

great fix 🙏

@malwilley malwilley enabled auto-merge (squash) June 9, 2026 18:17
@malwilley malwilley merged commit af5102f into master Jun 9, 2026
71 checks passed
@malwilley malwilley deleted the malwilley/manado branch June 9, 2026 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants