Fix OAuth PKCE length, Webhook SSRF, and Crypto Type Errors#12205
Fix OAuth PKCE length, Webhook SSRF, and Crypto Type Errors#12205Sunil56224972 wants to merge 3 commits intoappwrite:1.9.xfrom
Conversation
Greptile SummaryThis PR fixes PKCE in Confidence Score: 3/5Not safe to merge as-is — the Webhooks.php change breaks SSL opt-out for self-signed cert users and needs to be reverted or moved outside the guard block. The Etsy PKCE fix is correct and the X.php guards are benign, but the Webhooks.php change introduces a P1 regression: setting CURLOPT_SSL_VERIFYPEER=true inside the security=false block creates an inconsistent state (peer cert verified, hostname not), causing cURL SSL errors for any webhook targeting a server with a self-signed or private-CA cert. src/Appwrite/Platform/Workers/Webhooks.php — the SSL change is inside the wrong conditional block. Important Files Changed
Reviews (2): Last reviewed commit: "Fix type-checking logic in OAuth PKCE ve..." | Re-trigger Greptile |
| if (!$webhook->getAttribute('security', true)) { | ||
| \curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); | ||
| \curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | ||
| \curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); | ||
| } |
There was a problem hiding this comment.
Contradictory SSL state breaks the security opt-out
This block only executes when a user has explicitly disabled SSL verification (security = false). Changing CURLOPT_SSL_VERIFYPEER to true while leaving CURLOPT_SSL_VERIFYHOST as false creates a contradictory state: certificate chain is verified but the hostname is not. Any user who set security = false to reach a server with a self-signed or private-CA certificate will now receive a cURL SSL error and webhook delivery will fail silently. If the intent is to enforce peer verification globally, CURLOPT_SSL_VERIFYPEER = true should be set unconditionally outside this block (it is already the cURL default and does not belong inside the opt-out guard).
This PR includes the following security fixes:
$data,$iv,$tag) in thedecryptPKCEVerifierfunction to prevent potential type errors and security bypasses.