Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ build:
- rm -rf data/* config/config.php # TODO: remove this - temporary fix for CI issues
- git submodule update --init
- NOCOVERAGE=true TEST_SELECTION=NODB ./autotest.sh sqlite
nodb-php7.1:
image: nextcloudci/php7.1:php7.1-3
commands:
- rm -rf data/* config/config.php # TODO: remove this - temporary fix for CI issues
- git submodule update --init
- NOCOVERAGE=true TEST_SELECTION=NODB ./autotest.sh sqlite
sqlite-php5.6:
image: nextcloudci/php5.6:php5.6-2
commands:
Expand All @@ -27,6 +33,12 @@ build:
- rm -rf data/* config/config.php # TODO: remove this - temporary fix for CI issues
- git submodule update --init
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh sqlite
sqlite-php7.1:
image: nextcloudci/php7.1:php7.1-3
commands:
- rm -rf data/* config/config.php # TODO: remove this - temporary fix for CI issues
- git submodule update --init
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh sqlite
mysql-php5.6:
image: nextcloudci/php5.6:php5.6-2
commands:
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty
Submodule 3rdparty updated 33 files
+1 −1 composer.json
+16 −12 composer.lock
+1 −0 composer/autoload_files.php
+1 −0 composer/autoload_static.php
+0 −1 composer/include_paths.php
+94 −90 composer/installed.json
+1 −0 phpseclib/phpseclib/AUTHORS
+1 −1 phpseclib/phpseclib/LICENSE
+10 −12 phpseclib/phpseclib/phpseclib/Crypt/AES.php
+224 −168 phpseclib/phpseclib/phpseclib/Crypt/Base.php
+38 −44 phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php
+51 −64 phpseclib/phpseclib/phpseclib/Crypt/DES.php
+46 −47 phpseclib/phpseclib/phpseclib/Crypt/Hash.php
+80 −55 phpseclib/phpseclib/phpseclib/Crypt/RC2.php
+42 −39 phpseclib/phpseclib/phpseclib/Crypt/RC4.php
+192 −194 phpseclib/phpseclib/phpseclib/Crypt/RSA.php
+62 −22 phpseclib/phpseclib/phpseclib/Crypt/Random.php
+63 −164 phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php
+55 −35 phpseclib/phpseclib/phpseclib/Crypt/TripleDES.php
+59 −60 phpseclib/phpseclib/phpseclib/Crypt/Twofish.php
+26 −26 phpseclib/phpseclib/phpseclib/File/ANSI.php
+89 −74 phpseclib/phpseclib/phpseclib/File/ASN1.php
+2 −2 phpseclib/phpseclib/phpseclib/File/ASN1/Element.php
+559 −304 phpseclib/phpseclib/phpseclib/File/X509.php
+222 −197 phpseclib/phpseclib/phpseclib/Math/BigInteger.php
+20 −23 phpseclib/phpseclib/phpseclib/Net/SCP.php
+295 −210 phpseclib/phpseclib/phpseclib/Net/SFTP.php
+80 −69 phpseclib/phpseclib/phpseclib/Net/SFTP/Stream.php
+130 −130 phpseclib/phpseclib/phpseclib/Net/SSH1.php
+420 −396 phpseclib/phpseclib/phpseclib/Net/SSH2.php
+10 −7 phpseclib/phpseclib/phpseclib/System/SSH/Agent.php
+15 −16 phpseclib/phpseclib/phpseclib/System/SSH/Agent/Identity.php
+16 −0 phpseclib/phpseclib/phpseclib/bootstrap.php
2 changes: 1 addition & 1 deletion build/OCPSinceChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function getErrors() {
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);
Expand Down
2 changes: 1 addition & 1 deletion lib/private/App/InfoParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function xmlToArray($xml) {
$totalElement = count($xml->{$element});

if (!isset($array[$element])) {
$array[$element] = "";
$array[$element] = $totalElement > 1 ? [] : "";
}
/** @var \SimpleXMLElement $node */
// Has attributes
Expand Down
6 changes: 5 additions & 1 deletion lib/private/IntegrityCheck/Checker.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ private function createSignatureData(array $hashes,

$privateKey->setSignatureMode(RSA::SIGNATURE_PSS);
$privateKey->setMGFHash('sha512');
// See https://tools.ietf.org/html/rfc3447#page-38
$privateKey->setSaltLength(0);
$signature = $privateKey->sign(json_encode($hashes));

return [
Expand Down Expand Up @@ -343,7 +345,7 @@ private function verify($signaturePath, $basePath, $certificateCN) {
// 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') {
throw new InvalidSignatureException(
sprintf('Certificate is not valid for required scope. (Requested: %s, current: %s)', $certificateCN, $x509->getDN(true))
sprintf('Certificate is not valid for required scope. (Requested: %s, current: CN=%s)', $certificateCN, $x509->getDN(true)['CN'])
);
}

Expand All @@ -352,6 +354,8 @@ private function verify($signaturePath, $basePath, $certificateCN) {
$rsa->loadKey($x509->currentCert['tbsCertificate']['subjectPublicKeyInfo']['subjectPublicKey']);
$rsa->setSignatureMode(RSA::SIGNATURE_PSS);
$rsa->setMGFHash('sha512');
// See https://tools.ietf.org/html/rfc3447#page-38
$rsa->setSaltLength(0);
if(!$rsa->verify(json_encode($expectedHashes), $signature)) {
throw new InvalidSignatureException('Signature could not get verified.');
}
Expand Down
2 changes: 1 addition & 1 deletion settings/Controller/SecuritySettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected function returnSuccess() {
* @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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public function testTrustedDomainsEmpty() {
$this->container['Config']
->expects($this->once())
->method('getSystemValue')
->with('trusted_domains')
->will($this->returnValue(''));
->with($this->equalTo('trusted_domains'), $this->equalTo([]))
->willReturn([]);

$response = $this->securitySettingsController->trustedDomains('newdomain.com');
$expectedResponse = array('status' => 'success');
Expand Down
37 changes: 31 additions & 6 deletions tests/lib/IntegrityCheck/CheckerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,13 @@ public function testWriteAppSignature() {
->expects($this->once())
->method('file_put_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json',
$expectedSignatureFileData
$this->equalTo(\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json'),
$this->callback(function($signature) use ($expectedSignatureFileData) {
$expectedArray = json_decode($expectedSignatureFileData, true);
$actualArray = json_decode($signature, true);
$this->assertEquals($expectedArray, $actualArray);
return true;
})
);

$keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/SomeApp.crt');
Expand Down Expand Up @@ -456,7 +461,12 @@ public function testWriteCoreSignature() {
->method('file_put_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json',
$expectedSignatureFileData
$this->callback(function($signature) use ($expectedSignatureFileData) {
$expectedArray = json_decode($expectedSignatureFileData, true);
$actualArray = json_decode($signature, true);
$this->assertEquals($expectedArray, $actualArray);
return true;
})
);

$keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt');
Expand Down Expand Up @@ -486,7 +496,12 @@ public function testWriteCoreSignatureWithUnmodifiedHtaccess() {
->method('file_put_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified//core/signature.json',
$expectedSignatureFileData
$this->callback(function($signature) use ($expectedSignatureFileData) {
$expectedArray = json_decode($expectedSignatureFileData, true);
$actualArray = json_decode($signature, true);
$this->assertEquals($expectedArray, $actualArray);
return true;
})
);

$keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt');
Expand All @@ -511,7 +526,12 @@ public function testWriteCoreSignatureWithInvalidModifiedHtaccess() {
->method('file_put_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithInvalidModifiedContent//core/signature.json',
$expectedSignatureFileData
$this->callback(function($signature) use ($expectedSignatureFileData) {
$expectedArray = json_decode($expectedSignatureFileData, true);
$actualArray = json_decode($signature, true);
$this->assertEquals($expectedArray, $actualArray);
return true;
})
);

$keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt');
Expand Down Expand Up @@ -542,7 +562,12 @@ public function testWriteCoreSignatureWithValidModifiedHtaccessAndUserIni() {
->method('file_put_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent/core/signature.json',
$expectedSignatureFileData
$this->callback(function($signature) use ($expectedSignatureFileData) {
$expectedArray = json_decode($expectedSignatureFileData, true);
$actualArray = json_decode($signature, true);
$this->assertEquals($expectedArray, $actualArray);
return true;
})
);

$keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt');
Expand Down