fix(workflow-engine): Validate AssignedTo condition targets belong to the organization#117110
Merged
Conversation
… 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
commented
Jun 8, 2026
| ) | ||
|
|
||
| organization = self.context.get("organization") | ||
| if organization is not None: |
Member
Author
There was a problem hiding this comment.
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:
sentry/src/sentry/workflow_engine/endpoints/validators/base/action.py
Lines 71 to 74 in bbc7505
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_comparisonclassmethod toDataConditionHandlerso that consumers can add additional validation checks beyond basic json schema validation.AssignedToConditionHandleroverrides it to check that the referenced team/member actually belongs to the organization. The organization data is already present in the conditioncontext.