mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 17:05:56 +00:00
af_proxy_http: require separate token to access imgproxy
This commit is contained in:
@@ -28,6 +28,9 @@ class Af_Proxy_Http extends Plugin {
|
|||||||
$host->add_hook($host::HOOK_ENCLOSURE_ENTRY, $this);
|
$host->add_hook($host::HOOK_ENCLOSURE_ENTRY, $this);
|
||||||
|
|
||||||
$host->add_hook($host::HOOK_PREFS_TAB, $this);
|
$host->add_hook($host::HOOK_PREFS_TAB, $this);
|
||||||
|
|
||||||
|
if (!$_SESSION['af_proxy_http_token'])
|
||||||
|
$_SESSION['af_proxy_http_token'] = uniqid_short();
|
||||||
}
|
}
|
||||||
|
|
||||||
function hook_enclosure_entry($enc) {
|
function hook_enclosure_entry($enc) {
|
||||||
@@ -48,7 +51,7 @@ class Af_Proxy_Http extends Plugin {
|
|||||||
$url = validate_url(clean($_REQUEST["url"]));
|
$url = validate_url(clean($_REQUEST["url"]));
|
||||||
|
|
||||||
// called without user context, let's just redirect to original URL
|
// called without user context, let's just redirect to original URL
|
||||||
if (!$_SESSION["uid"]) {
|
if (!$_SESSION["uid"] || $_REQUEST['af_proxy_http_token'] != $_SESSION['af_proxy_http_token']) {
|
||||||
header("Location: $url");
|
header("Location: $url");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -131,7 +134,8 @@ class Af_Proxy_Http extends Plugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->host->get_public_method_url($this, "imgproxy", ["url" => $url]);
|
return $this->host->get_public_method_url($this, "imgproxy",
|
||||||
|
["url" => $url, "af_proxy_http_token" => $_SESSION["af_proxy_http_token"]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user