Commit ae6a65f5 authored by Vincent Petry's avatar Vincent Petry Committed by GitHub
Browse files

Merge pull request #25346 from owncloud/php-7.1

Php 7.1
parents 11c30fce 5f6d5229
......@@ -14,6 +14,15 @@ timestampedNode('SLAVE') {
sh '''make test-js'''
}
stage 'PHPUnit on 7.1'
sh '''
export NOCOVERAGE=1
unset USEDOCKER
phpenv local 7.1
make test-php TEST_DATABASE=sqlite
'''
step([$class: 'JUnitResultArchiver', testResults: 'tests/autotest-results-sqlite.xml'])
stage 'PHPUnit'
executeAndReport('tests/autotest-results-sqlite.xml') {
sh '''
......
......@@ -111,7 +111,7 @@ $errors = [];
foreach($Regex as $file) {
$stmts = $parser->parse(file_get_contents($file[0]));
$visitor = new SinceTagCheckVisitor($this->blackListedClassNames);
$visitor = new SinceTagCheckVisitor();
$traverser = new \PhpParser\NodeTraverser();
$traverser->addVisitor($visitor);
$traverser->traverse($stmts);
......
......@@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "87fbc197c16f2ebe55d804030c1be921",
"content-hash": "f68d46522d8a8e7eb47c93ccd76fd948",
"hash": "fd0a46d62c83514a2b98e8d82442eab0",
"content-hash": "da1ba97fa9e1536c94e0fe0229fdf511",
"packages": [
{
"name": "bantu/ini-get-wrapper",
......@@ -1762,16 +1762,16 @@
},
{
"name": "phpseclib/phpseclib",
"version": "2.0.0",
"version": "2.0.3",
"source": {
"type": "git",
"url": "https://github.com/phpseclib/phpseclib.git",
"reference": "a74aa9efbe61430fcb60157c8e025a48ec8ff604"
"reference": "41f85e9c2582b3f6d1b7d20395fb40c687ad5370"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/a74aa9efbe61430fcb60157c8e025a48ec8ff604",
"reference": "a74aa9efbe61430fcb60157c8e025a48ec8ff604",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/41f85e9c2582b3f6d1b7d20395fb40c687ad5370",
"reference": "41f85e9c2582b3f6d1b7d20395fb40c687ad5370",
"shasum": ""
},
"require": {
......@@ -1787,19 +1787,18 @@
"ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.",
"ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.",
"ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.",
"ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations.",
"pear-pear/PHP_Compat": "Install PHP_Compat to get phpseclib working on PHP < 5.0.0."
"ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations."
},
"type": "library",
"autoload": {
"files": [
"phpseclib/bootstrap.php"
],
"psr-4": {
"phpseclib\\": "phpseclib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
"phpseclib/"
],
"license": [
"MIT"
],
......@@ -1823,6 +1822,11 @@
"name": "Hans-Jürgen Petrich",
"email": "petrich@tronic-media.com",
"role": "Developer"
},
{
"name": "Graham Campbell",
"email": "graham@alt-three.com",
"role": "Developer"
}
],
"description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.",
......@@ -1846,7 +1850,7 @@
"x.509",
"x509"
],
"time": "2015-08-04 04:48:03"
"time": "2016-08-18 18:49:14"
},
{
"name": "pimple/pimple",
......
......@@ -141,7 +141,7 @@ class InfoParser {
$totalElement = count($xml->{$element});
if (!isset($array[$element])) {
$array[$element] = "";
$array[$element] = $totalElement > 1 ? [] : "";
}
/** @var \SimpleXMLElement $node */
// Has attributes
......
......@@ -249,6 +249,7 @@ class Checker {
$privateKey->setSignatureMode(RSA::SIGNATURE_PSS);
$privateKey->setMGFHash('sha512');
$privateKey->setSaltLength(0);
$signature = $privateKey->sign(json_encode($hashes));
return [
......@@ -355,15 +356,16 @@ class Checker {
// Verify if certificate has proper CN. "core" CN is always trusted.
if($x509->getDN(X509::DN_OPENSSL)['CN'] !== $certificateCN && $x509->getDN(X509::DN_OPENSSL)['CN'] !== 'core') {
$cn = $x509->getDN(true)['CN'];
throw new InvalidSignatureException(
sprintf('Certificate is not valid for required scope. (Requested: %s, current: %s)', $certificateCN, $x509->getDN(true))
);
"Certificate is not valid for required scope. (Requested: $certificateCN, current: CN=$cn)");
}
// Check if the signature of the files is valid
$rsa = new \phpseclib\Crypt\RSA();
$rsa->loadKey($x509->currentCert['tbsCertificate']['subjectPublicKeyInfo']['subjectPublicKey']);
$rsa->setSignatureMode(RSA::SIGNATURE_PSS);
$rsa->setSaltLength(0);
$rsa->setMGFHash('sha512');
if(!$rsa->verify(json_encode($expectedHashes), $signature)) {
throw new InvalidSignatureException('Signature could not get verified.');
......
......@@ -60,7 +60,7 @@ class SecuritySettingsController extends Controller {
* @return array
*/
public function trustedDomains($newTrustedDomain) {
$trustedDomains = $this->config->getSystemValue('trusted_domains');
$trustedDomains = $this->config->getSystemValue('trusted_domains', []);
$trustedDomains[] = $newTrustedDomain;
$this->config->setSystemValue('trusted_domains', $trustedDomains);
......
......@@ -58,7 +58,7 @@ class SecuritySettingsControllerTest extends \PHPUnit_Framework_TestCase {
->expects($this->once())
->method('getSystemValue')
->with('trusted_domains')
->will($this->returnValue(''));
->will($this->returnValue([]));
$response = $this->securitySettingsController->trustedDomains('newdomain.com');
$expectedResponse = ['status' => 'success'];
......
......@@ -51,12 +51,12 @@ class CheckerTest extends TestCase {
public function setUp() {
parent::setUp();
$this->environmentHelper = $this->createMock('\OC\IntegrityCheck\Helpers\EnvironmentHelper');
$this->fileAccessHelper = $this->createMock('\OC\IntegrityCheck\Helpers\FileAccessHelper');
$this->appLocator = $this->createMock('\OC\IntegrityCheck\Helpers\AppLocator');
$this->config = $this->createMock('\OCP\IConfig');
$this->cacheFactory = $this->createMock('\OCP\ICacheFactory');
$this->appManager = $this->createMock('\OCP\App\IAppManager');
$this->environmentHelper = $this->createMock(EnvironmentHelper::class);
$this->fileAccessHelper = $this->createMock(FileAccessHelper::class);
$this->appLocator = $this->createMock(AppLocator::class);
$this->config = $this->createMock(IConfig::class);
$this->cacheFactory = $this->createMock(ICacheFactory::class);
$this->appManager = $this->createMock(IAppManager::class);
$this->cacheFactory
->expects($this->any())
......@@ -103,7 +103,13 @@ class CheckerTest extends TestCase {
->method('file_put_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json',
$expectedSignatureFileData
$this->callback(function ($arg) use ($expectedSignatureFileData) {
$this->assertEquals(
json_decode($expectedSignatureFileData, true),
json_decode($arg, true)
);
return true;
})
);
$keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/SomeApp.crt');
......@@ -456,7 +462,13 @@ class CheckerTest extends TestCase {
->method('file_put_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json',
$expectedSignatureFileData
$this->callback(function ($arg) use ($expectedSignatureFileData) {
$this->assertEquals(
json_decode($expectedSignatureFileData, true),
json_decode($arg, true)
);
return true;
})
);
$keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt');
......@@ -486,7 +498,13 @@ class CheckerTest extends TestCase {
->method('file_put_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified//core/signature.json',
$expectedSignatureFileData
$this->callback(function ($arg) use ($expectedSignatureFileData) {
$this->assertEquals(
json_decode($expectedSignatureFileData, true),
json_decode($arg, true)
);
return true;
})
);
$keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt');
......@@ -511,7 +529,13 @@ class CheckerTest extends TestCase {
->method('file_put_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithInvalidModifiedContent//core/signature.json',
$expectedSignatureFileData
$this->callback(function ($arg) use ($expectedSignatureFileData) {
$this->assertEquals(
json_decode($expectedSignatureFileData, true),
json_decode($arg, true)
);
return true;
})
);
$keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt');
......@@ -542,7 +566,13 @@ class CheckerTest extends TestCase {
->method('file_put_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent/core/signature.json',
$expectedSignatureFileData
$this->callback(function ($arg) use ($expectedSignatureFileData) {
$this->assertEquals(
json_decode($expectedSignatureFileData, true),
json_decode($arg, true)
);
return true;
})
);
$keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment