[codex] Harden public outbound URL validation#2199
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ 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. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR refactors public URL validation into a centralized module with DNS and private-IP detection, then migrates webhook and website preview URL validation to use this system. Webhook handlers now perform async hostname validation before delivery. Tests verify syntax validation, DNS-based blocking of private IPs, and redirect revalidation. ChangesPublic URL Validation & Webhook Security
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
🚥 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 unit tests (beta)
Comment |
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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 `@src/pages/admin/dashboard/replication.vue`:
- Around line 111-112: The error thrown when session?.access_token is missing
still references a removed "replication secret" fallback; update the check in
the replication code to throw a clear message that only session-based
authentication is supported by changing the Error thrown in the
session?.access_token guard (the if (!session?.access_token) branch) to
something like "No session available; replication requires session-based
authentication" so it no longer mentions the removed VITE_REPLICATION_API_SECRET
fallback.
- Line 205: The class on the loading container uses an invalid Tailwind utility
`min-h-75`; update the div with v-else-if="isLoading && !data" to use a valid
Tailwind min-height such as `min-h-72` or `min-h-80`, or use arbitrary value
syntax like `min-h-[18.75rem]` so the spinner container gets the intended
minimum height.
In `@supabase/functions/_backend/utils/publicUrl.ts`:
- Around line 154-157: The two sequential awaits building ips cause A and AAAA
lookups to be serialized; change to run them in parallel by using Promise.all to
await both resolveHostnameIps(url.hostname, 'A') and
resolveHostnameIps(url.hostname, 'AAAA') concurrently and then merge the results
into ips (so keep the same variable name and downstream logic, e.g. const [aIps,
aaaaIps] = await Promise.all([...]) or const results = await Promise.all([...])
and spread results into ips). Ensure this preserves behavior when
requireDnsResolution is false and retains the same fallback semantics.
🪄 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: 8b396577-ea16-4ed3-96ad-93947eb24c9e
📒 Files selected for processing (13)
src/components/Sidebar.vuesrc/pages/admin/dashboard/replication.vuesupabase/functions/_backend/private/website_preview.tssupabase/functions/_backend/public/webhooks/deliveries.tssupabase/functions/_backend/public/webhooks/post.tssupabase/functions/_backend/public/webhooks/put.tssupabase/functions/_backend/public/webhooks/test.tssupabase/functions/_backend/triggers/webhook_dispatcher.tssupabase/functions/_backend/utils/publicUrl.tssupabase/functions/_backend/utils/webhook.tstests/public-url-validation.unit.test.tstests/webhook-delivery-redirect.unit.test.tstests/webhook-delivery-security.unit.test.ts
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|



Summary (AI generated)
Motivation (AI generated)
DNS-based SSRF advisories kept recurring because webhook targets only had syntactic URL checks. Centralizing public outbound validation gives the advisory scanners a concrete preflight path while keeping the existing Cloudflare serverless assumptions documented in code.
Business Impact (AI generated)
This should reduce repeated advisory noise around website preview and webhooks without blocking normal customer webhooks when DNS preflight is unavailable. Explicit private DNS answers are blocked before outbound delivery.
Test Plan (AI generated)
bun lint:backendbunx vitest run tests/public-url-validation.unit.test.ts tests/webhook-delivery-security.unit.test.ts tests/webhook-delivery-redirect.unit.test.tsbun typecheckSummary by CodeRabbit
Release Notes
Bug Fixes
Style
Tests