feat(cloud-security): add endpoints to trigger scans and get run status#2176
feat(cloud-security): add endpoints to trigger scans and get run status#2176
Conversation
PR SummaryMedium Risk Overview Updates the app’s Written by Cursor Bugbot for commit 3cfdc12. This will update automatically on new commits. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| success: run.isCompleted ? run.isSuccess : false, | ||
| output: run.isCompleted ? run.output : null, | ||
| }; | ||
| } |
There was a problem hiding this comment.
IDOR: run status endpoint lacks run-to-connection authorization
High Severity
getRunStatus validates that connectionId belongs to the caller's organizationId, but never verifies that runId is actually associated with that connection. Since runs.retrieve(runId) from Trigger.dev returns any run within the project, an attacker can supply their own valid connectionId alongside another organization's runId to read that organization's scan output, including sensitive cloud security findings.
Additional Locations (1)
| const message = | ||
| error instanceof Error ? error.message : 'Failed to trigger scan'; | ||
| throw new HttpException(message, HttpStatus.BAD_REQUEST); | ||
| } |
There was a problem hiding this comment.
All triggerScan errors incorrectly mapped to 400
Medium Severity
The triggerScan catch block maps every error to HttpStatus.BAD_REQUEST (400), including internal failures from tasks.trigger(...) which are server-side errors deserving a 500 status. Additionally, the service throws a plain Error for missing connections instead of the purpose-built ConnectionNotFoundError, preventing differentiated error handling like getRunStatus does.
Additional Locations (1)
|
🎉 This PR is included in version 1.84.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |


What does this PR do?
Visual Demo (For contributors especially)
A visual demonstration is strongly recommended, for both the original and new change (video / image - any one).
Video Demo (if applicable):
Image Demo (if applicable):
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Checklist