-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix: permissions check for duplicating workflow #706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR fixes a permission-related issue in the workflow duplication functionality. Previously, only workflow owners could duplicate workflows, which was too restrictive. The changes now allow users with admin or write permissions in a workspace to duplicate workflows within that workspace, even if they don't own them directly.
The key changes include:
- Removing the user ID restriction from the initial workflow query
- Adding a proper permission check that validates either workflow ownership or workspace permissions
- Improving error handling to properly distinguish between 404 (not found) and 403 (access denied) cases
The changes align with the workspace-based permission model and improve the collaborative workflow experience.
PR Description Notes:
- The PR description has marked all types of changes which seems excessive - this appears to be primarily a bug fix with some security enhancement
- The testing section could be more detailed about specific test cases
Confidence score: 4/5
- This PR is safe to merge with proper testing in staging
- The code changes are well-structured with clear permission checks and error handling
- The route.ts file needs careful testing to verify all permission scenarios work as expected
1 file reviewed, 1 comment
Edit PR Review Bot Settings | Greptile
| if (!canAccessSource) { | ||
| throw new Error('Source workflow not found or access denied') | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider moving error message to a const variable at the top of the file since it's referenced in two places (here and error handling)
|
✅ No security or compliance issues detected. Reviewed everything up to 3c7342a. Security Overview
Detected Code Changes
Reply to this PR with |
Description
Fixed the 404 error for duplicating a workflow where the user is not the owner. Now users with admin or write permissions can duplicate.
Type of change
How Has This Been Tested?
Test in staging.
Checklist:
bun run test)Security Considerations: