fix: restrict webhook secret access to admin-only#1678
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
✨ Finishing Touches🧪 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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dbe829485f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| public.get_identity( | ||
| '{read,upload,write,all}'::public.key_mode [] |
There was a problem hiding this comment.
Replace get_identity with org-scoped helper
AGENTS.md explicitly says to never use get_identity() directly in RLS policies, and this new webhook SELECT policy still does so. get_identity() does not enforce API key org scoping (limited_to_orgs), so an API key tied to an admin user can pass check_min_rights('admin', ...) based on that user’s org membership even when the key is not allowed for that org, which still exposes webhook secrets cross-org; this table should use get_identity_org_allowed(..., org_id) instead.
Useful? React with 👍 / 👎.
|



Summary (AI generated)
20260224000000_fix_webhooks_select_permission.sqlto restrictSELECTaccess onpublic.webhooksto admin-level API credentials.Motivation (AI generated)
A security report shows non-admin/read API keys could query
/rest/v1/webhooksand readsecretvalues. That secret enables forging signed webhook payloads. This change closes that data leak at the RLS layer.Business Impact (AI generated)
This restores webhook integrity by preventing signed request forgery from keys with read-only permission, protecting downstream automation, billing/workflow triggers, and customer event pipelines from unauthorized event injection.
Test Plan (AI generated)
bun lint.bun lint:backend.secret.Generated with AI