Disable integrations OAuth flow for billing/viewer roles#4008
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughBackend OAuth POST route now requires workspace ChangesWorkspace Permissions for OAuth and Integrations
Estimated code review effort🎯 4 (Complex) | ⏱️ ~40 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for the sandbox. 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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/web/app/app.dub.co/`(auth)/oauth/authorize/authorize-form.tsx:
- Around line 34-40: The current useMemo treats a missing workspace as a
harmless clean state which allows form submission; update the logic in the
useMemo block (the computation that produces permissionsError and missingScopes)
to treat a selectedWorkspace that does not resolve to an actual workspace as a
not-yet-resolved/error state: if selectedWorkspace is set but workspaces is
undefined or workspace === undefined, return a non-empty permissionsError (or a
distinct flag) and ensure missingScopes stays empty so the UI disables the
submit button until the slug resolves to a real workspace entry; adjust any
consumers that check permissionsError/missingScopes (the submit enablement
logic) to rely on this new state.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 78fcdf4a-ed6e-4d3d-9760-6e37112e009f
📒 Files selected for processing (3)
apps/web/app/api/oauth/authorize/route.tsapps/web/app/app.dub.co/(auth)/oauth/authorize/authorize-form.tsxapps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/integrations/[integrationSlug]/page-client.tsx
|
@coderabbitai full review. any breaking changes? |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
echo "=== oauth authorize route ==="
cat apps/web/app/api/oauth/authorize/route.ts
echo ""
echo "=== authorize-form.tsx ==="
cat "apps/web/app/app.dub.co/(auth)/oauth/authorize/authorize-form.tsx"
echo ""
echo "=== page-client.tsx ==="
cat "apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/integrations/[integrationSlug]/page-client.tsx"
echo ""
echo "=== clientAccessCheck implementation ==="
rg -rn "clientAccessCheck" --type=ts --type=tsx -B2 -A15 | head -100
echo ""
echo "=== withWorkspace options/types ==="
rg -rn "requiredPermissions" --type=ts -B2 -A5 | head -80
echo ""
echo "=== integrations.write permission ==="
rg -rn "integrations.write" --type=ts -B2 -A2 | head -60
echo ""
echo "=== Authorize GET route (to check if it also needs protection) ==="
cat apps/web/app/api/oauth/authorize/route.ts 2>/dev/null | head -20
echo ""
echo "=== GET route check ==="
rg -rn "export const GET" apps/web/app/api/oauth/authorize/route.ts
echo ""
echo "=== Roles and permissions config ==="
rg -rn "\"integrations.write\"" --type=ts -B2 -A2 | head -60
echo ""
echo "=== billing viewer role constants ==="
rg -rn "billing|viewer" apps/web/lib/role-permissions.ts 2>/dev/null | head -40
fd "role" apps/web/lib --type=f | head -10Length of output: 37947 🏁 Script executed: #!/bin/bash
echo "=== permissions.ts full ==="
cat apps/web/lib/api/rbac/permissions.ts
echo ""
echo "=== workspace-roles.ts ==="
cat apps/web/lib/workspace-roles.ts
echo ""
echo "=== clientAccessCheck full implementation ==="
fd "client-access-check" --type=f | xargs cat
echo ""
echo "=== withWorkspace WorkspaceOptions type ==="
rg -n "requiredPermissions" apps/web/lib/auth --type=ts -B2 -A5
echo ""
echo "=== scopes for role function ==="
rg -n "getScopesForRole" apps/web/lib/api/tokens/scopes.ts -A20
echo ""
echo "=== does the Authorize button also have the workspaceUnresolvedMessage in disabled? ==="
rg -n "workspaceUnresolvedMessage" "apps/web/app/app.dub.co/(auth)/oauth/authorize/authorize-form.tsx"
echo ""
echo "=== getIntegrationInstallUrl action - check for permissions ==="
fd "get-integration-install-url" --type=f | xargs cat 2>/dev/null
echo ""
echo "=== installAppsFlyerAction - check for permissions ==="
fd "install.ts" apps/web/lib/integrations/appsflyer --type=f | xargs cat 2>/dev/nullLength of output: 12576
SummaryThe PR adds both server-side ( Breaking ChangesYes — intentional and expected:
This is the intended behavior. No owner/member workflows are disrupted. Issues Found🔴 Permission Enforcement Gap —
|
Summary by CodeRabbit
New Features
Bug Fixes