feat: support custom oauth & oidc providers#2357
Conversation
| } | ||
|
|
||
| // Resolve hostname to IP addresses | ||
| ips, err := net.LookupIP(hostname) |
There was a problem hiding this comment.
🟠 Severity: HIGH
DNS Rebinding Attack (TOCTOU): The URL validation performs DNS resolution at validation time, but the actual HTTP request happens later. An attacker can exploit DNS rebinding by having their DNS server return a safe IP during validation, then quickly change to a private IP (e.g., 169.254.169.254) before the actual request. The ssrfProtectedTransport attempts to mitigate this but only re-validates the URL string, not the resolved IP. Consider implementing IP-pinning where validated IPs are cached and reused.
Helpful? Add 👍 / 👎
💡 Fix Suggestion
Suggestion: To properly fix the DNS rebinding vulnerability, implement IP pinning: 1) Modify ValidateOAuthURL to return the resolved and validated IP addresses along with the error, 2) Update ssrfProtectedTransport to accept and store pinned IPs during validation, 3) Implement a custom net.Dialer in the transport that only connects to the pinned IPs (bypassing the hostname resolution). This ensures the HTTP connection uses the exact IPs that were validated, preventing DNS rebinding attacks. The implementation should resolve the hostname once during validation, validate all returned IPs, then configure the transport's DialContext to connect directly to one of those validated IPs using the Host header for TLS SNI.
Pull Request Test Coverage Report for Build 21715046627Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
Summary
Add configurable custom OAuth/OIDC providers (phase 1) so projects can integrate self‑hosted/regional identity providers without requiring code changes.
Problem
Current OAuth/OIDC providers are hardcoded, require provider-specific code and env vars, and block customers who need self‑hosted or custom IdPs (e.g. GitHub Enterprise, LINE, internal OIDC servers).
Solution
Introduce database‑backed
oauth_providerswith custom:{identifier} IDs, OIDC discovery + OAuth2 manual configuration, admin CRUD APIs, and tier‑gated quotas, reusing existing /authorize and /callback flows with JWT state + PKCE.Things to review
How to encrypt client secrets?