Skip to content

fix(api-service): Environment ID organization check#10063

Merged
scopsy merged 1 commit intonextfrom
cursor/environment-id-organization-check-19cd
Feb 19, 2026
Merged

fix(api-service): Environment ID organization check#10063
scopsy merged 1 commit intonextfrom
cursor/environment-id-organization-check-19cd

Conversation

@scopsy
Copy link
Contributor

@scopsy scopsy commented Feb 19, 2026

What changed? Why was the change needed?

This change introduces a validation mechanism for the environmentId when it's provided as a query parameter to the getWorkflow endpoint.

Previously, a custom environmentId from the query parameter would directly override the user's session environmentId. This could lead to unauthorized access or incorrect data retrieval if the provided environmentId did not belong to the user's organization.

Now, if a custom environmentId is passed and differs from the session's environmentId, the system verifies that this custom environmentId belongs to the current user's organization. If the environment is not found within the organization, a NotFoundException is thrown, enhancing security and data integrity.

Specifically:

  • The GetWorkflowCommand now includes an optional environmentId field.
  • The WorkflowController passes the query environmentId to the command as this new, separate field.
  • The GetWorkflowUseCase injects EnvironmentRepository to perform the necessary validation.

Screenshots


Slack Thread

Open in Cursor Open in Web

… get-workflow

Co-authored-by: Dima Grossman <dima@grossman.io>
@cursor
Copy link
Contributor

cursor bot commented Feb 19, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@netlify
Copy link

netlify bot commented Feb 19, 2026

Deploy Preview for dashboard-v2-novu-staging canceled.

Name Link
🔨 Latest commit 09f076a
🔍 Latest deploy log https://app.netlify.com/projects/dashboard-v2-novu-staging/deploys/6996d2cc0a4c790008cd65cf

@github-actions
Copy link
Contributor

github-actions bot commented Feb 19, 2026

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: fix(api-service): Environment ID organization check

Requirements:

  1. Follow the Conventional Commits specification
  2. As a team member, include Linear ticket ID at the end: fixes TICKET-ID or include it in your branch name

Expected format: feat(scope): Add fancy new feature fixes NOV-123

Details:

PR title must end with 'fixes TICKET-ID' (e.g., 'fixes NOV-123') or include ticket ID in branch name

@scopsy scopsy changed the title Environment ID organization check fix(api-service): Environment ID organization check Feb 19, 2026
@scopsy scopsy marked this pull request as ready for review February 19, 2026 13:30
@scopsy scopsy merged commit c6a066d into next Feb 19, 2026
29 of 30 checks passed
@scopsy scopsy deleted the cursor/environment-id-organization-check-19cd branch February 19, 2026 13:31
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 19, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

This change introduces environment awareness to the workflow retrieval flow. The GetWorkflowCommand now accepts an optional environmentId parameter alongside the existing workflowIdOrInternalId. The GetWorkflowUseCase gains an EnvironmentRepository dependency and implements logic to validate and resolve the effective environment ID. When an explicit environment ID is provided that differs from the user's environment, the system verifies the environment exists through the repository. The controller is updated to pass environment ID as a separate field rather than mutating the user object. The resolved environment ID flows through the workflow retrieval process.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants