mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-10-03 01:39:15 +02:00
Compare commits
4 commits
2c1a17a07f
...
0a398d73f0
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0a398d73f0 | ||
![]() |
fae7e233f3 | ||
![]() |
64165d9928 | ||
![]() |
bdfe74c077 |
3 changed files with 44 additions and 0 deletions
|
@ -1,9 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
export PATH="$PATH:$HOME/.composer/vendor/bin"
|
||||
export PATH="$PATH:$PWD/vendor/bin"
|
||||
echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bashrc
|
||||
echo 'export PATH="$PATH:$PWD/vendor/bin"' >> ~/.bashrc
|
||||
ln -s ./conf.sample.php cfg/conf.php
|
||||
composer install --no-dev --optimize-autoloader
|
||||
|
||||
# for PHP unit testing
|
||||
composer require google/cloud-storage
|
||||
composer install --optimize-autoloader
|
||||
|
||||
sudo chmod a+x "$(pwd)" && sudo rm -rf /var/www/html && sudo ln -s "$(pwd)" /var/www/html
|
||||
|
||||
npm install --global nyc
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -25,6 +25,7 @@ vendor/**/tst
|
|||
vendor/**/tests
|
||||
vendor/**/build_phar.php
|
||||
!vendor/**/*.php
|
||||
vendor/bin/**
|
||||
|
||||
# Ignore local node modules, unit testing logs, api docs and IDE project files
|
||||
js/node_modules/
|
||||
|
|
|
@ -47,6 +47,42 @@ class YourlsProxyTest extends TestCase
|
|||
$this->assertEquals($yourls->getUrl(), 'https://example.com/1');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerInvalidUrl
|
||||
*/
|
||||
public function testImvalidUrl($uri)
|
||||
{
|
||||
$yourls = new YourlsProxy($this->_conf, $uri);
|
||||
$this->assertTrue($yourls->isError());
|
||||
$this->assertEquals($yourls->getError(), 'Invalid URL given.');
|
||||
}
|
||||
|
||||
public function providerInvalidUrl() {
|
||||
return array(
|
||||
array(''),
|
||||
array(' '),
|
||||
array('foo'),
|
||||
array('https://'),
|
||||
array('ftp://example.com/?n=np'),
|
||||
array('https://example.com'), // missing path and query parameter,
|
||||
array('https://example.com/'), // missing query parameter
|
||||
array('https://example.com?paste=something'), // missing path parameter
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* This tests for a trick using username of an URI, see:
|
||||
* {@see https://cloud.google.com/blog/topics/threat-intelligence/url-obfuscation-schema-abuse/?hl=en}
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testForeignUrlUsingUsernameTrick()
|
||||
{
|
||||
$yourls = new YourlsProxy($this->_conf, 'https://example.com/@foreign.malicious.example?foo#bar');
|
||||
$this->assertTrue($yourls->isError());
|
||||
$this->assertEquals($yourls->getError(), 'Trying to shorten a URL that isn\'t pointing at our instance.');
|
||||
}
|
||||
|
||||
public function testForeignUrl()
|
||||
{
|
||||
$yourls = new YourlsProxy($this->_conf, 'https://other.example.com/?foo#bar');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue