Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2021-05-18 09:43:13 +0300
committerGitHub <noreply@github.com>2021-05-18 09:43:13 +0300
commitee3dc57cbd9c9cf2f88d97a35f54ed67ab556aa7 (patch)
tree0bb2f6b2310032256a0147e2148f8930cb5775d8
parent44a638f9617aa53da9e38378b1f62923cf2d2514 (diff)
parentca7b37ce5a5c68ea4a105377754005a772c5deaa (diff)
Merge pull request #26626 from J0WI/strict-security
Make Security module strict
-rw-r--r--lib/private/Security/Bruteforce/Capabilities.php5
-rw-r--r--lib/private/Security/Certificate.php23
-rw-r--r--lib/private/Security/CertificateManager.php22
-rw-r--r--lib/private/Security/CredentialsManager.php17
-rw-r--r--lib/private/Security/TrustedDomainHelper.php7
-rw-r--r--lib/public/ICertificate.php27
-rw-r--r--lib/public/ICertificateManager.php14
-rw-r--r--lib/public/Security/IContentSecurityPolicyManager.php3
-rw-r--r--lib/public/Security/ICredentialsManager.php11
-rw-r--r--tests/lib/Security/Bruteforce/CapabilitiesTest.php3
-rw-r--r--tests/lib/Security/Bruteforce/ThrottlerTest.php3
-rw-r--r--tests/lib/Security/CSP/AddContentSecurityPolicyEventTest.php1
-rw-r--r--tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php3
-rw-r--r--tests/lib/Security/CSP/ContentSecurityPolicyNonceManagerTest.php3
-rw-r--r--tests/lib/Security/CSRF/CsrfTokenGeneratorTest.php3
-rw-r--r--tests/lib/Security/CSRF/CsrfTokenManagerTest.php3
-rw-r--r--tests/lib/Security/CSRF/CsrfTokenTest.php3
-rw-r--r--tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php3
-rw-r--r--tests/lib/Security/CertificateManagerTest.php3
-rw-r--r--tests/lib/Security/CertificateTest.php3
-rw-r--r--tests/lib/Security/CredentialsManagerTest.php3
-rw-r--r--tests/lib/Security/CryptoTest.php3
-rw-r--r--tests/lib/Security/HasherTest.php3
-rw-r--r--tests/lib/Security/IdentityProof/KeyTest.php3
-rw-r--r--tests/lib/Security/IdentityProof/ManagerTest.php3
-rw-r--r--tests/lib/Security/IdentityProof/SignerTest.php3
-rw-r--r--tests/lib/Security/Normalizer/IpAddressTest.php3
-rw-r--r--tests/lib/Security/RateLimiting/Backend/MemoryCacheTest.php3
-rw-r--r--tests/lib/Security/RateLimiting/LimiterTest.php3
-rw-r--r--tests/lib/Security/SecureRandomTest.php3
-rw-r--r--tests/lib/Security/TrustedDomainHelperTest.php3
31 files changed, 143 insertions, 50 deletions
diff --git a/lib/private/Security/Bruteforce/Capabilities.php b/lib/private/Security/Bruteforce/Capabilities.php
index 7547348ce34..7c4c2a13671 100644
--- a/lib/private/Security/Bruteforce/Capabilities.php
+++ b/lib/private/Security/Bruteforce/Capabilities.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @copyright Copyright (c) 2017 Roeland Jago Douma <roeland@famdouma.nl>
*
@@ -46,7 +49,7 @@ class Capabilities implements IPublicCapability {
$this->throttler = $throttler;
}
- public function getCapabilities() {
+ public function getCapabilities(): array {
if (version_compare(\OC::$server->getConfig()->getSystemValue('version', '0.0.0.0'), '12.0.0.0', '<')) {
return [];
}
diff --git a/lib/private/Security/Certificate.php b/lib/private/Security/Certificate.php
index c89122f9a4b..e299f9d2b8f 100644
--- a/lib/private/Security/Certificate.php
+++ b/lib/private/Security/Certificate.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -49,7 +52,7 @@ class Certificate implements ICertificate {
* @param string $name
* @throws \Exception If the certificate could not get parsed
*/
- public function __construct($data, $name) {
+ public function __construct(string $data, string $name) {
$this->name = $name;
$gmt = new \DateTimeZone('GMT');
@@ -75,42 +78,42 @@ class Certificate implements ICertificate {
/**
* @return string
*/
- public function getName() {
+ public function getName(): string {
return $this->name;
}
/**
* @return string|null
*/
- public function getCommonName() {
+ public function getCommonName(): ?string {
return $this->commonName;
}
/**
- * @return string
+ * @return string|null
*/
- public function getOrganization() {
+ public function getOrganization(): ?string {
return $this->organization;
}
/**
* @return \DateTime
*/
- public function getIssueDate() {
+ public function getIssueDate(): \DateTime {
return $this->issueDate;
}
/**
* @return \DateTime
*/
- public function getExpireDate() {
+ public function getExpireDate(): \DateTime {
return $this->expireDate;
}
/**
* @return bool
*/
- public function isExpired() {
+ public function isExpired(): bool {
$now = new \DateTime();
return $this->issueDate > $now or $now > $this->expireDate;
}
@@ -118,14 +121,14 @@ class Certificate implements ICertificate {
/**
* @return string|null
*/
- public function getIssuerName() {
+ public function getIssuerName(): ?string {
return $this->issuerName;
}
/**
* @return string|null
*/
- public function getIssuerOrganization() {
+ public function getIssuerOrganization(): ?string {
return $this->issuerOrganization;
}
}
diff --git a/lib/private/Security/CertificateManager.php b/lib/private/Security/CertificateManager.php
index ef0c6563320..9734f9b6446 100644
--- a/lib/private/Security/CertificateManager.php
+++ b/lib/private/Security/CertificateManager.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -30,6 +33,7 @@
namespace OC\Security;
use OC\Files\Filesystem;
+use OCP\ICertificate;
use OCP\ICertificateManager;
use OCP\IConfig;
use OCP\ILogger;
@@ -78,7 +82,7 @@ class CertificateManager implements ICertificateManager {
*
* @return \OCP\ICertificate[]
*/
- public function listCertificates() {
+ public function listCertificates(): array {
if (!$this->config->getSystemValue('installed', false)) {
return [];
}
@@ -130,7 +134,7 @@ class CertificateManager implements ICertificateManager {
/**
* create the certificate bundle of all trusted certificated
*/
- public function createCertificateBundle() {
+ public function createCertificateBundle(): void {
$path = $this->getPathToCertificates();
$certs = $this->listCertificates();
@@ -182,7 +186,7 @@ class CertificateManager implements ICertificateManager {
* @return \OCP\ICertificate
* @throws \Exception If the certificate could not get added
*/
- public function addCertificate($certificate, $name) {
+ public function addCertificate(string $certificate, string $name): ICertificate {
if (!Filesystem::isValidPath($name) or Filesystem::isFileBlacklisted($name)) {
throw new \Exception('Filename is not valid');
}
@@ -209,7 +213,7 @@ class CertificateManager implements ICertificateManager {
* @param string $name
* @return bool
*/
- public function removeCertificate($name) {
+ public function removeCertificate(string $name): bool {
if (!Filesystem::isValidPath($name)) {
return false;
}
@@ -226,7 +230,7 @@ class CertificateManager implements ICertificateManager {
*
* @return string
*/
- public function getCertificateBundle() {
+ public function getCertificateBundle(): string {
return $this->getPathToCertificates() . 'rootcerts.crt';
}
@@ -235,7 +239,7 @@ class CertificateManager implements ICertificateManager {
*
* @return string
*/
- public function getAbsoluteBundlePath() {
+ public function getAbsoluteBundlePath(): string {
if (!$this->hasCertificates()) {
return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
}
@@ -250,7 +254,7 @@ class CertificateManager implements ICertificateManager {
/**
* @return string
*/
- private function getPathToCertificates() {
+ private function getPathToCertificates(): string {
return '/files_external/';
}
@@ -259,7 +263,7 @@ class CertificateManager implements ICertificateManager {
*
* @return bool
*/
- private function needsRebundling() {
+ private function needsRebundling(): bool {
$targetBundle = $this->getCertificateBundle();
if (!$this->view->file_exists($targetBundle)) {
return true;
@@ -274,7 +278,7 @@ class CertificateManager implements ICertificateManager {
*
* @return int
*/
- protected function getFilemtimeOfCaBundle() {
+ protected function getFilemtimeOfCaBundle(): int {
return filemtime(\OC::$SERVERROOT . '/resources/config/ca-bundle.crt');
}
}
diff --git a/lib/private/Security/CredentialsManager.php b/lib/private/Security/CredentialsManager.php
index 7ba8a0020ff..4688bea8dcf 100644
--- a/lib/private/Security/CredentialsManager.php
+++ b/lib/private/Security/CredentialsManager.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -59,11 +62,11 @@ class CredentialsManager implements ICredentialsManager {
* @param string $identifier
* @param mixed $credentials
*/
- public function store($userId, $identifier, $credentials) {
+ public function store(string $userId, string $identifier, $credentials): void {
$value = $this->crypto->encrypt(json_encode($credentials));
$this->dbConnection->setValues(self::DB_TABLE, [
- 'user' => (string)$userId,
+ 'user' => $userId,
'identifier' => $identifier,
], [
'credentials' => $value,
@@ -77,7 +80,7 @@ class CredentialsManager implements ICredentialsManager {
* @param string $identifier
* @return mixed
*/
- public function retrieve($userId, $identifier) {
+ public function retrieve(string $userId, string $identifier) {
$qb = $this->dbConnection->getQueryBuilder();
$qb->select('credentials')
->from(self::DB_TABLE)
@@ -86,7 +89,7 @@ class CredentialsManager implements ICredentialsManager {
if ($userId === '') {
$qb->andWhere($qb->expr()->emptyString('user'));
} else {
- $qb->andWhere($qb->expr()->eq('user', $qb->createNamedParameter((string)$userId)));
+ $qb->andWhere($qb->expr()->eq('user', $qb->createNamedParameter($userId)));
}
$qResult = $qb->execute();
@@ -108,7 +111,7 @@ class CredentialsManager implements ICredentialsManager {
* @param string $identifier
* @return int rows removed
*/
- public function delete($userId, $identifier) {
+ public function delete(string $userId, string $identifier): int {
$qb = $this->dbConnection->getQueryBuilder();
$qb->delete(self::DB_TABLE)
->where($qb->expr()->eq('identifier', $qb->createNamedParameter($identifier)));
@@ -116,7 +119,7 @@ class CredentialsManager implements ICredentialsManager {
if ($userId === '') {
$qb->andWhere($qb->expr()->emptyString('user'));
} else {
- $qb->andWhere($qb->expr()->eq('user', $qb->createNamedParameter((string)$userId)));
+ $qb->andWhere($qb->expr()->eq('user', $qb->createNamedParameter($userId)));
}
return $qb->execute();
@@ -128,7 +131,7 @@ class CredentialsManager implements ICredentialsManager {
* @param string $userId
* @return int rows removed
*/
- public function erase($userId) {
+ public function erase(string $userId): int {
$qb = $this->dbConnection->getQueryBuilder();
$qb->delete(self::DB_TABLE)
->where($qb->expr()->eq('user', $qb->createNamedParameter($userId)))
diff --git a/lib/private/Security/TrustedDomainHelper.php b/lib/private/Security/TrustedDomainHelper.php
index 8004bf7dc6f..f99b505157a 100644
--- a/lib/private/Security/TrustedDomainHelper.php
+++ b/lib/private/Security/TrustedDomainHelper.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -51,7 +54,7 @@ class TrustedDomainHelper {
* @param string $host
* @return string $host without appended port
*/
- private function getDomainWithoutPort($host) {
+ private function getDomainWithoutPort(string $host): string {
$pos = strrpos($host, ':');
if ($pos !== false) {
$port = substr($host, $pos + 1);
@@ -71,7 +74,7 @@ class TrustedDomainHelper {
* @return bool true if the given domain is trusted or if no trusted domains
* have been configured
*/
- public function isTrustedDomain($domainWithPort) {
+ public function isTrustedDomain(string $domainWithPort): bool {
// overwritehost is always trusted
if ($this->config->getSystemValue('overwritehost') !== '') {
return true;
diff --git a/lib/public/ICertificate.php b/lib/public/ICertificate.php
index dbedd274305..c9e56e0e879 100644
--- a/lib/public/ICertificate.php
+++ b/lib/public/ICertificate.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -33,47 +36,47 @@ interface ICertificate {
* @return string
* @since 8.0.0
*/
- public function getName();
+ public function getName(): string;
/**
- * @return string
+ * @return string|null
* @since 8.0.0
*/
- public function getCommonName();
+ public function getCommonName(): ?string;
/**
- * @return string
+ * @return string|null
* @since 8.0.0
*/
- public function getOrganization();
+ public function getOrganization(): ?string;
/**
* @return \DateTime
* @since 8.0.0
*/
- public function getIssueDate();
+ public function getIssueDate(): \DateTime;
/**
* @return \DateTime
* @since 8.0.0
*/
- public function getExpireDate();
+ public function getExpireDate(): \DateTime;
/**
* @return bool
* @since 8.0.0
*/
- public function isExpired();
+ public function isExpired(): bool;
/**
- * @return string
+ * @return string|null
* @since 8.0.0
*/
- public function getIssuerName();
+ public function getIssuerName(): ?string;
/**
- * @return string
+ * @return string|null
* @since 8.0.0
*/
- public function getIssuerOrganization();
+ public function getIssuerOrganization(): ?string;
}
diff --git a/lib/public/ICertificateManager.php b/lib/public/ICertificateManager.php
index da97dc105d0..2014ec3ec06 100644
--- a/lib/public/ICertificateManager.php
+++ b/lib/public/ICertificateManager.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -35,7 +38,7 @@ interface ICertificateManager {
* @return \OCP\ICertificate[]
* @since 8.0.0
*/
- public function listCertificates();
+ public function listCertificates(): array;
/**
* @param string $certificate the certificate data
@@ -44,13 +47,14 @@ interface ICertificateManager {
* @throws \Exception If the certificate could not get added
* @since 8.0.0 - since 8.1.0 throws exception instead of returning false
*/
- public function addCertificate($certificate, $name);
+ public function addCertificate(string $certificate, string $name): \OCP\ICertificate;
/**
* @param string $name
+ * @return bool
* @since 8.0.0
*/
- public function removeCertificate($name);
+ public function removeCertificate(string $name): bool;
/**
* Get the path to the certificate bundle
@@ -58,7 +62,7 @@ interface ICertificateManager {
* @return string
* @since 8.0.0
*/
- public function getCertificateBundle();
+ public function getCertificateBundle(): string;
/**
* Get the full local path to the certificate bundle
@@ -66,5 +70,5 @@ interface ICertificateManager {
* @return string
* @since 9.0.0
*/
- public function getAbsoluteBundlePath();
+ public function getAbsoluteBundlePath(): string;
}
diff --git a/lib/public/Security/IContentSecurityPolicyManager.php b/lib/public/Security/IContentSecurityPolicyManager.php
index ccd6ec16133..346816e23cb 100644
--- a/lib/public/Security/IContentSecurityPolicyManager.php
+++ b/lib/public/Security/IContentSecurityPolicyManager.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
diff --git a/lib/public/Security/ICredentialsManager.php b/lib/public/Security/ICredentialsManager.php
index 47c8c7dbef2..ce42905577a 100644
--- a/lib/public/Security/ICredentialsManager.php
+++ b/lib/public/Security/ICredentialsManager.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -38,7 +41,7 @@ interface ICredentialsManager {
* @param mixed $credentials
* @since 8.2.0
*/
- public function store($userId, $identifier, $credentials);
+ public function store(string $userId, string $identifier, $credentials): void;
/**
* Retrieve a set of credentials
@@ -48,7 +51,7 @@ interface ICredentialsManager {
* @return mixed
* @since 8.2.0
*/
- public function retrieve($userId, $identifier);
+ public function retrieve(string $userId, string $identifier);
/**
* Delete a set of credentials
@@ -58,7 +61,7 @@ interface ICredentialsManager {
* @return int rows removed
* @since 8.2.0
*/
- public function delete($userId, $identifier);
+ public function delete(string $userId, string $identifier): int;
/**
* Erase all credentials stored for a user
@@ -67,5 +70,5 @@ interface ICredentialsManager {
* @return int rows removed
* @since 8.2.0
*/
- public function erase($userId);
+ public function erase(string $userId): int;
}
diff --git a/tests/lib/Security/Bruteforce/CapabilitiesTest.php b/tests/lib/Security/Bruteforce/CapabilitiesTest.php
index cd43d94f8cb..1c2bbb6bc53 100644
--- a/tests/lib/Security/Bruteforce/CapabilitiesTest.php
+++ b/tests/lib/Security/Bruteforce/CapabilitiesTest.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @copyright Copyright (c) 2017 Roeland Jago Douma <roeland@famdouma.nl>
*
diff --git a/tests/lib/Security/Bruteforce/ThrottlerTest.php b/tests/lib/Security/Bruteforce/ThrottlerTest.php
index b4a7016bc20..fb28a7c9c7a 100644
--- a/tests/lib/Security/Bruteforce/ThrottlerTest.php
+++ b/tests/lib/Security/Bruteforce/ThrottlerTest.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
*
diff --git a/tests/lib/Security/CSP/AddContentSecurityPolicyEventTest.php b/tests/lib/Security/CSP/AddContentSecurityPolicyEventTest.php
index ef894bb56f3..7de4665ec58 100644
--- a/tests/lib/Security/CSP/AddContentSecurityPolicyEventTest.php
+++ b/tests/lib/Security/CSP/AddContentSecurityPolicyEventTest.php
@@ -1,6 +1,7 @@
<?php
declare(strict_types=1);
+
/**
* @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
*
diff --git a/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php b/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php
index 2fc7a53e78d..b91482ab2c6 100644
--- a/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php
+++ b/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @author Lukas Reschke <lukas@owncloud.com>
*
diff --git a/tests/lib/Security/CSP/ContentSecurityPolicyNonceManagerTest.php b/tests/lib/Security/CSP/ContentSecurityPolicyNonceManagerTest.php
index 783eb35eef9..0e21f13e6f7 100644
--- a/tests/lib/Security/CSP/ContentSecurityPolicyNonceManagerTest.php
+++ b/tests/lib/Security/CSP/ContentSecurityPolicyNonceManagerTest.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
*
diff --git a/tests/lib/Security/CSRF/CsrfTokenGeneratorTest.php b/tests/lib/Security/CSRF/CsrfTokenGeneratorTest.php
index 10ab0f00c94..256199eff15 100644
--- a/tests/lib/Security/CSRF/CsrfTokenGeneratorTest.php
+++ b/tests/lib/Security/CSRF/CsrfTokenGeneratorTest.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @author Lukas Reschke <lukas@owncloud.com>
*
diff --git a/tests/lib/Security/CSRF/CsrfTokenManagerTest.php b/tests/lib/Security/CSRF/CsrfTokenManagerTest.php
index 29fbbfe3b26..44a9a7a929d 100644
--- a/tests/lib/Security/CSRF/CsrfTokenManagerTest.php
+++ b/tests/lib/Security/CSRF/CsrfTokenManagerTest.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @author Lukas Reschke <lukas@owncloud.com>
*
diff --git a/tests/lib/Security/CSRF/CsrfTokenTest.php b/tests/lib/Security/CSRF/CsrfTokenTest.php
index fbb92cd315a..b694e797232 100644
--- a/tests/lib/Security/CSRF/CsrfTokenTest.php
+++ b/tests/lib/Security/CSRF/CsrfTokenTest.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @author Lukas Reschke <lukas@owncloud.com>
*
diff --git a/tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php b/tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php
index 8d4a966efea..f55cf49f142 100644
--- a/tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php
+++ b/tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @author Lukas Reschke <lukas@owncloud.com>
*
diff --git a/tests/lib/Security/CertificateManagerTest.php b/tests/lib/Security/CertificateManagerTest.php
index 3af4b564612..c50296c2a33 100644
--- a/tests/lib/Security/CertificateManagerTest.php
+++ b/tests/lib/Security/CertificateManagerTest.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* Copyright (c) 2014 Lukas Reschke <lukas@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
diff --git a/tests/lib/Security/CertificateTest.php b/tests/lib/Security/CertificateTest.php
index 223fb226904..5d3fd602fb2 100644
--- a/tests/lib/Security/CertificateTest.php
+++ b/tests/lib/Security/CertificateTest.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @author Lukas Reschke <lukas@owncloud.com>
*
diff --git a/tests/lib/Security/CredentialsManagerTest.php b/tests/lib/Security/CredentialsManagerTest.php
index e8ede3bfd66..3335e18a8b1 100644
--- a/tests/lib/Security/CredentialsManagerTest.php
+++ b/tests/lib/Security/CredentialsManagerTest.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @author Robin McCorkell <rmccorkell@owncloud.com>
*
diff --git a/tests/lib/Security/CryptoTest.php b/tests/lib/Security/CryptoTest.php
index 0c7c1aa1ac7..bdbad8b2610 100644
--- a/tests/lib/Security/CryptoTest.php
+++ b/tests/lib/Security/CryptoTest.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* Copyright (c) 2014 Lukas Reschke <lukas@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
diff --git a/tests/lib/Security/HasherTest.php b/tests/lib/Security/HasherTest.php
index 3bd98625529..5836703504e 100644
--- a/tests/lib/Security/HasherTest.php
+++ b/tests/lib/Security/HasherTest.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* Copyright (c) 2014 Lukas Reschke <lukas@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
diff --git a/tests/lib/Security/IdentityProof/KeyTest.php b/tests/lib/Security/IdentityProof/KeyTest.php
index ae5f77f1609..4c852ff7020 100644
--- a/tests/lib/Security/IdentityProof/KeyTest.php
+++ b/tests/lib/Security/IdentityProof/KeyTest.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @copyright 2016, Roeland Jago Douma <roeland@famdouma.nl>
*
diff --git a/tests/lib/Security/IdentityProof/ManagerTest.php b/tests/lib/Security/IdentityProof/ManagerTest.php
index 16ceec248ae..0a6f97f3fcd 100644
--- a/tests/lib/Security/IdentityProof/ManagerTest.php
+++ b/tests/lib/Security/IdentityProof/ManagerTest.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
*
diff --git a/tests/lib/Security/IdentityProof/SignerTest.php b/tests/lib/Security/IdentityProof/SignerTest.php
index 3ce211d51e7..f9abf84071d 100644
--- a/tests/lib/Security/IdentityProof/SignerTest.php
+++ b/tests/lib/Security/IdentityProof/SignerTest.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @copyright 2016, Roeland Jago Douma <roeland@famdouma.nl>
*
diff --git a/tests/lib/Security/Normalizer/IpAddressTest.php b/tests/lib/Security/Normalizer/IpAddressTest.php
index 044fc52b4b9..b202ecd7234 100644
--- a/tests/lib/Security/Normalizer/IpAddressTest.php
+++ b/tests/lib/Security/Normalizer/IpAddressTest.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @copyright Copyright (c) 2017 Lukas Reschke <lukas@statuscode.ch>
*
diff --git a/tests/lib/Security/RateLimiting/Backend/MemoryCacheTest.php b/tests/lib/Security/RateLimiting/Backend/MemoryCacheTest.php
index 902c586dc13..ff58bd5c09e 100644
--- a/tests/lib/Security/RateLimiting/Backend/MemoryCacheTest.php
+++ b/tests/lib/Security/RateLimiting/Backend/MemoryCacheTest.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @copyright Copyright (c) 2017 Lukas Reschke <lukas@statuscode.ch>
*
diff --git a/tests/lib/Security/RateLimiting/LimiterTest.php b/tests/lib/Security/RateLimiting/LimiterTest.php
index 76121a49bc1..8b3509a4790 100644
--- a/tests/lib/Security/RateLimiting/LimiterTest.php
+++ b/tests/lib/Security/RateLimiting/LimiterTest.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* @copyright Copyright (c) 2017 Lukas Reschke <lukas@statuscode.ch>
*
diff --git a/tests/lib/Security/SecureRandomTest.php b/tests/lib/Security/SecureRandomTest.php
index 0ffd7ae7c14..7257d52e8f5 100644
--- a/tests/lib/Security/SecureRandomTest.php
+++ b/tests/lib/Security/SecureRandomTest.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* Copyright (c) 2014 Lukas Reschke <lukas@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
diff --git a/tests/lib/Security/TrustedDomainHelperTest.php b/tests/lib/Security/TrustedDomainHelperTest.php
index 2796dead0e2..aedc4cb6a17 100644
--- a/tests/lib/Security/TrustedDomainHelperTest.php
+++ b/tests/lib/Security/TrustedDomainHelperTest.php
@@ -1,4 +1,7 @@
<?php
+
+declare(strict_types=1);
+
/**
* Copyright (c) 2015 Lukas Reschke <lukas@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or