fix: align webhook edit page with PBAC middleware#28769
Conversation
📝 WalkthroughWalkthroughThe webhook edit page now includes server-side authentication and authorization validation. The page retrieves the current user session via 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@apps/web/app/`(use-page-wrapper)/settings/(settings-layout)/developer/webhooks/[id]/page.tsx:
- Around line 34-35: The call to
WebhookRepository.getInstance().findByWebhookId(id) can throw (it uses
findUniqueOrThrow), so wrap the await webhookRepository.findByWebhookId(id) in a
try-catch inside the page handler (the page component surrounding code) and
catch the not-found/prisma error; when caught, return the same 404/unauthorized
response you use for missing/unauthorized webhooks (instead of letting it bubble
to a 500). Ensure you only rethrow unexpected errors and map the specific
not-found error from findByWebhookId to the existing 404 response path.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c8d6e6f6-e0bf-4c8c-b727-555891db2c59
📒 Files selected for processing (1)
apps/web/app/(use-page-wrapper)/settings/(settings-layout)/developer/webhooks/[id]/page.tsx
E2E results are ready! |
What does this PR do?
Adds authentication and permission verification to the webhook edit page. The page was loading webhook data directly without verifying the current user's access, which could result in incorrect data being displayed.
Changes
PermissionCheckServiceHow should this be tested?
/settings/developer/webhooks/{id}for your own webhook → should load normallyMandatory Tasks (DO NOT REMOVE)