Skip to content

Allow restricting CURLOPT_PROXY with get_curl_resolve_info()#83

Open
Inverle wants to merge 2 commits into
FreshRSS:freshrssfrom
Inverle:restrict-curlopt-proxy-ssrf
Open

Allow restricting CURLOPT_PROXY with get_curl_resolve_info()#83
Inverle wants to merge 2 commits into
FreshRSS:freshrssfrom
Inverle:restrict-curlopt-proxy-ssrf

Conversation

@Inverle

@Inverle Inverle commented Jun 28, 2026

Copy link
Copy Markdown
Member

@Inverle Inverle requested a review from Alkarex June 28, 2026 19:32
@Inverle Inverle force-pushed the restrict-curlopt-proxy-ssrf branch 2 times, most recently from cd6a9ed to 3781610 Compare June 28, 2026 19:49
@Inverle Inverle force-pushed the restrict-curlopt-proxy-ssrf branch from 3781610 to acb9077 Compare June 28, 2026 19:54
Comment thread src/File.php
} else { // FreshRSS
defined('CURLPROXY_HTTPS') or define('CURLPROXY_HTTPS', 2); // Compatibility cURL 7.51
$proxy_scheme = null;
switch ($proxy_type) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a case for match ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not available in PHP 7

Comment thread src/File.php
Comment on lines +499 to +515
if ($for_proxy) {
$parsed = parse_url($url);
if ($parsed === false) {
return false;
}
$credentials = '';
$user = $parsed['user'] ?? null;
$pass = $parsed['pass'] ?? null;
if (is_string($user) && is_string($pass)) {
$credentials = "$user:$pass@";
}
$proxy = $parsed['host'] ?? '';
if (is_int($parsed['port'] ?? null)) {
$proxy .= ':' . $parsed['port'];
}
return $credentials . $proxy;
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could it be enough to just return the contents after ://?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants