fix(api-service): Environment ID organization check#10063
Conversation
… get-workflow Co-authored-by: Dima Grossman <dima@grossman.io>
|
Cursor Agent can help with this pull request. Just |
✅ Deploy Preview for dashboard-v2-novu-staging canceled.
|
|
Hey there and thank you for opening this pull request! 👋 We require pull request titles to follow specific formatting rules and it looks like your proposed title needs to be adjusted. Your PR title is: Requirements:
Expected format: Details: PR title must end with 'fixes TICKET-ID' (e.g., 'fixes NOV-123') or include ticket ID in branch name |
|
Caution Review failedThe pull request is closed. WalkthroughThis change introduces environment awareness to the workflow retrieval flow. The Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What changed? Why was the change needed?
This change introduces a validation mechanism for the
environmentIdwhen it's provided as a query parameter to thegetWorkflowendpoint.Previously, a custom
environmentIdfrom the query parameter would directly override the user's sessionenvironmentId. This could lead to unauthorized access or incorrect data retrieval if the providedenvironmentIddid not belong to the user's organization.Now, if a custom
environmentIdis passed and differs from the session'senvironmentId, the system verifies that this customenvironmentIdbelongs to the current user's organization. If the environment is not found within the organization, aNotFoundExceptionis thrown, enhancing security and data integrity.Specifically:
GetWorkflowCommandnow includes an optionalenvironmentIdfield.WorkflowControllerpasses the queryenvironmentIdto the command as this new, separate field.GetWorkflowUseCaseinjectsEnvironmentRepositoryto perform the necessary validation.Screenshots
Slack Thread