prevent bypassing YOURLS proxy URL filter, allowing to shorten non-self URLs

This commit is contained in:
El RIDO
2024-06-29 20:26:09 +02:00
parent 0eae149474
commit 2c711e9d3c
3 changed files with 9 additions and 1 deletions
+7
View File
@@ -54,6 +54,13 @@ class YourlsProxyTest extends TestCase
$this->assertEquals($yourls->getError(), 'Trying to shorten a URL that isn\'t pointing at our instance.');
}
public function testSneakyForeignUrl()
{
$yourls = new YourlsProxy($this->_conf, 'https://other.example.com/?q=https://example.com/?foo#bar');
$this->assertTrue($yourls->isError());
$this->assertEquals($yourls->getError(), 'Trying to shorten a URL that isn\'t pointing at our instance.');
}
public function testYourlsError()
{
// when statusCode is not 200, shorturl may not have been set