diff options
author | provokateurin <kate@provokateurin.de> | 2024-09-06 09:44:04 +0200 |
---|---|---|
committer | provokateurin <kate@provokateurin.de> | 2024-09-09 11:09:37 +0200 |
commit | 007be83a968e6aee649ff8de173163cb5ef93a86 (patch) | |
tree | 18e03c4a5562989bbd6482e9e6a47f3619b71e30 /lib/private/Security | |
parent | fc10fa592626d154a91d77d35c93beabdc7605c1 (diff) | |
download | nextcloud-server-fix/oc/inheritdoc.tar.gz nextcloud-server-fix/oc/inheritdoc.zip |
fix(OC): Remove doc blocks for OCP implementationsfix/oc/inheritdoc
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'lib/private/Security')
-rw-r--r-- | lib/private/Security/Bruteforce/Throttler.php | 27 | ||||
-rw-r--r-- | lib/private/Security/CSP/ContentSecurityPolicyManager.php | 1 | ||||
-rw-r--r-- | lib/private/Security/CertificateManager.php | 22 | ||||
-rw-r--r-- | lib/private/Security/CredentialsManager.php | 22 | ||||
-rw-r--r-- | lib/private/Security/Crypto.php | 19 | ||||
-rw-r--r-- | lib/private/Security/Hasher.php | 14 | ||||
-rw-r--r-- | lib/private/Security/RateLimiting/Limiter.php | 12 | ||||
-rw-r--r-- | lib/private/Security/SecureRandom.php | 7 | ||||
-rw-r--r-- | lib/private/Security/TrustedDomainHelper.php | 6 |
9 files changed, 0 insertions, 130 deletions
diff --git a/lib/private/Security/Bruteforce/Throttler.php b/lib/private/Security/Bruteforce/Throttler.php index 596fcf408fa..189fd204c67 100644 --- a/lib/private/Security/Bruteforce/Throttler.php +++ b/lib/private/Security/Bruteforce/Throttler.php @@ -43,9 +43,6 @@ class Throttler implements IThrottler { ) { } - /** - * {@inheritDoc} - */ public function registerAttempt(string $action, string $ip, array $metadata = []): void { @@ -79,9 +76,6 @@ class Throttler implements IThrottler { ); } - /** - * Check if the IP is whitelisted - */ public function isBypassListed(string $ip): bool { if (isset($this->ipIsWhitelisted[$ip])) { return $this->ipIsWhitelisted[$ip]; @@ -149,18 +143,12 @@ class Throttler implements IThrottler { return false; } - /** - * {@inheritDoc} - */ public function showBruteforceWarning(string $ip, string $action = ''): bool { $attempts = $this->getAttempts($ip, $action); // 4 failed attempts is the last delay below 5 seconds return $attempts >= 4; } - /** - * {@inheritDoc} - */ public function getAttempts(string $ip, string $action = '', float $maxAgeHours = 12): int { if ($maxAgeHours > 48) { $this->logger->error('Bruteforce has to use less than 48 hours'); @@ -185,9 +173,6 @@ class Throttler implements IThrottler { ); } - /** - * {@inheritDoc} - */ public function getDelay(string $ip, string $action = ''): int { $attempts = $this->getAttempts($ip, $action); if ($attempts === 0) { @@ -207,9 +192,6 @@ class Throttler implements IThrottler { return (int)\ceil($delay * 1000); } - /** - * {@inheritDoc} - */ public function resetDelay(string $ip, string $action, array $metadata): void { // No need to log if the bruteforce protection is disabled if (!$this->config->getSystemValueBool('auth.bruteforce.protection.enabled', true)) { @@ -230,9 +212,6 @@ class Throttler implements IThrottler { $this->hasAttemptsDeleted[$action] = true; } - /** - * {@inheritDoc} - */ public function resetDelayForIP(string $ip): void { // No need to log if the bruteforce protection is disabled if (!$this->config->getSystemValueBool('auth.bruteforce.protection.enabled', true)) { @@ -247,9 +226,6 @@ class Throttler implements IThrottler { $this->backend->resetAttempts($ipAddress->getSubnet()); } - /** - * {@inheritDoc} - */ public function sleepDelay(string $ip, string $action = ''): int { $delay = $this->getDelay($ip, $action); if (!$this->config->getSystemValueBool('auth.bruteforce.protection.testing')) { @@ -258,9 +234,6 @@ class Throttler implements IThrottler { return $delay; } - /** - * {@inheritDoc} - */ public function sleepDelayOrThrowOnMax(string $ip, string $action = ''): int { $delay = $this->getDelay($ip, $action); if (($delay === self::MAX_DELAY_MS) && $this->getAttempts($ip, $action, 0.5) > self::MAX_ATTEMPTS) { diff --git a/lib/private/Security/CSP/ContentSecurityPolicyManager.php b/lib/private/Security/CSP/ContentSecurityPolicyManager.php index 77ecceb03c3..0178da1c58a 100644 --- a/lib/private/Security/CSP/ContentSecurityPolicyManager.php +++ b/lib/private/Security/CSP/ContentSecurityPolicyManager.php @@ -24,7 +24,6 @@ class ContentSecurityPolicyManager implements IContentSecurityPolicyManager { ) { } - /** {@inheritdoc} */ public function addDefaultPolicy(EmptyContentSecurityPolicy $policy): void { $this->policies[] = $policy; } diff --git a/lib/private/Security/CertificateManager.php b/lib/private/Security/CertificateManager.php index 00babff735f..b8de32b4693 100644 --- a/lib/private/Security/CertificateManager.php +++ b/lib/private/Security/CertificateManager.php @@ -29,11 +29,6 @@ class CertificateManager implements ICertificateManager { ) { } - /** - * Returns all certificates trusted by the user - * - * @return \OCP\ICertificate[] - */ public function listCertificates(): array { if (!$this->config->getSystemValueBool('installed', false)) { return []; @@ -141,13 +136,6 @@ class CertificateManager implements ICertificateManager { $this->view->rename($tmpPath, $certPath); } - /** - * Save the certificate and re-generate the certificate bundle - * - * @param string $certificate the certificate data - * @param string $name the filename for the certificate - * @throws \Exception If the certificate could not get added - */ public function addCertificate(string $certificate, string $name): ICertificate { $path = $this->getPathToCertificates() . 'uploads/' . $name; $directory = dirname($path); @@ -169,9 +157,6 @@ class CertificateManager implements ICertificateManager { } } - /** - * Remove the certificate and re-generate the certificate bundle - */ public function removeCertificate(string $name): bool { $path = $this->getPathToCertificates() . 'uploads/' . $name; @@ -189,17 +174,10 @@ class CertificateManager implements ICertificateManager { return true; } - /** - * Get the path to the certificate bundle - */ public function getCertificateBundle(): string { return $this->getPathToCertificates() . 'rootcerts.crt'; } - /** - * Get the full local path to the certificate bundle - * @throws \Exception when getting bundle path fails - */ public function getAbsoluteBundlePath(): string { try { if ($this->bundlePath === null) { diff --git a/lib/private/Security/CredentialsManager.php b/lib/private/Security/CredentialsManager.php index fdf2c46ecf8..7de328f4f50 100644 --- a/lib/private/Security/CredentialsManager.php +++ b/lib/private/Security/CredentialsManager.php @@ -26,12 +26,6 @@ class CredentialsManager implements ICredentialsManager { ) { } - /** - * Store a set of credentials - * - * @param string $userId empty string for system-wide credentials - * @param mixed $credentials - */ public function store(string $userId, string $identifier, $credentials): void { $value = $this->crypto->encrypt(json_encode($credentials)); @@ -43,11 +37,6 @@ class CredentialsManager implements ICredentialsManager { ]); } - /** - * Retrieve a set of credentials - * - * @param string $userId empty string for system-wide credentials - */ public function retrieve(string $userId, string $identifier): mixed { $qb = $this->dbConnection->getQueryBuilder(); $qb->select('credentials') @@ -72,12 +61,6 @@ class CredentialsManager implements ICredentialsManager { return json_decode($this->crypto->decrypt($value), true); } - /** - * Delete a set of credentials - * - * @param string $userId empty string for system-wide credentials - * @return int rows removed - */ public function delete(string $userId, string $identifier): int { $qb = $this->dbConnection->getQueryBuilder(); $qb->delete(self::DB_TABLE) @@ -92,11 +75,6 @@ class CredentialsManager implements ICredentialsManager { return $qb->execute(); } - /** - * Erase all credentials stored for a user - * - * @return int rows removed - */ public function erase(string $userId): int { $qb = $this->dbConnection->getQueryBuilder(); $qb->delete(self::DB_TABLE) diff --git a/lib/private/Security/Crypto.php b/lib/private/Security/Crypto.php index b03f8a4ddce..6fce44af51d 100644 --- a/lib/private/Security/Crypto.php +++ b/lib/private/Security/Crypto.php @@ -34,11 +34,6 @@ class Crypto implements ICrypto { $this->cipher = new AES(); } - /** - * @param string $message The message to authenticate - * @param string $password Password to use (defaults to `secret` in config.php) - * @return string Calculated HMAC - */ public function calculateHMAC(string $message, string $password = ''): string { if ($password === '') { $password = $this->config->getSystemValueString('secret'); @@ -52,14 +47,6 @@ class Crypto implements ICrypto { return $hash->hash($message); } - /** - * Encrypts a value and adds an HMAC (Encrypt-Then-MAC) - * - * @param string $password Password to encrypt, if not specified the secret from config.php will be taken - * @return string Authenticated ciphertext - * @throws Exception if it was not possible to gather sufficient entropy - * @throws Exception if encrypting the data failed - */ public function encrypt(string $plaintext, string $password = ''): string { if ($password === '') { $password = $this->config->getSystemValueString('secret'); @@ -83,12 +70,6 @@ class Crypto implements ICrypto { return $ciphertext.'|'.$iv.'|'.$hmac.'|3'; } - /** - * Decrypts a value and verifies the HMAC (Encrypt-Then-Mac) - * @param string $password Password to encrypt, if not specified the secret from config.php will be taken - * @throws Exception If the HMAC does not match - * @throws Exception If the decryption failed - */ public function decrypt(string $authenticatedCiphertext, string $password = ''): string { $secret = $this->config->getSystemValue('secret'); try { diff --git a/lib/private/Security/Hasher.php b/lib/private/Security/Hasher.php index 3ab0e1bbcac..461b226b672 100644 --- a/lib/private/Security/Hasher.php +++ b/lib/private/Security/Hasher.php @@ -54,14 +54,6 @@ class Hasher implements IHasher { } } - /** - * Hashes a message using PHP's `password_hash` functionality. - * Please note that the size of the returned string is not guaranteed - * and can be up to 255 characters. - * - * @param string $message Message to generate hash from - * @return string Hash of the message with appended version parameter - */ public function hash(string $message): string { $alg = $this->getPrefferedAlgorithm(); @@ -144,12 +136,6 @@ class Hasher implements IHasher { return false; } - /** - * @param string $message Message to verify - * @param string $hash Assumed hash of the message - * @param null|string &$newHash Reference will contain the updated hash if necessary. Update the existing hash with this one. - * @return bool Whether $hash is a valid hash of $message - */ public function verify(string $message, string $hash, &$newHash = null): bool { $splittedHash = $this->splitHash($hash); diff --git a/lib/private/Security/RateLimiting/Limiter.php b/lib/private/Security/RateLimiting/Limiter.php index b7ac26d9132..953c2bbc85d 100644 --- a/lib/private/Security/RateLimiting/Limiter.php +++ b/lib/private/Security/RateLimiting/Limiter.php @@ -38,12 +38,6 @@ class Limiter implements ILimiter { $this->backend->registerAttempt($methodIdentifier, $userIdentifier, $period); } - /** - * Registers attempt for an anonymous request - * - * @param int $anonPeriod in seconds - * @throws RateLimitExceededException - */ public function registerAnonRequest( string $identifier, int $anonLimit, @@ -56,12 +50,6 @@ class Limiter implements ILimiter { $this->register($identifier, $anonHashIdentifier, $anonPeriod, $anonLimit); } - /** - * Registers attempt for an authenticated request - * - * @param int $userPeriod in seconds - * @throws RateLimitExceededException - */ public function registerUserRequest( string $identifier, int $userLimit, diff --git a/lib/private/Security/SecureRandom.php b/lib/private/Security/SecureRandom.php index b2a3d19ce74..8290d50413b 100644 --- a/lib/private/Security/SecureRandom.php +++ b/lib/private/Security/SecureRandom.php @@ -20,13 +20,6 @@ use OCP\Security\ISecureRandom; * @package OC\Security */ class SecureRandom implements ISecureRandom { - /** - * Generate a secure random string of specified length. - * @param int $length The length of the generated string - * @param string $characters An optional list of characters to use if no character list is - * specified all valid base64 characters are used. - * @throws \LengthException if an invalid length is requested - */ public function generate( int $length, string $characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', diff --git a/lib/private/Security/TrustedDomainHelper.php b/lib/private/Security/TrustedDomainHelper.php index a65779780e8..c3299ae95a3 100644 --- a/lib/private/Security/TrustedDomainHelper.php +++ b/lib/private/Security/TrustedDomainHelper.php @@ -33,9 +33,6 @@ class TrustedDomainHelper implements ITrustedDomainHelper { return $host; } - /** - * {@inheritDoc} - */ public function isTrustedUrl(string $url): bool { $parsedUrl = parse_url($url); if (empty($parsedUrl['host'])) { @@ -49,9 +46,6 @@ class TrustedDomainHelper implements ITrustedDomainHelper { return $this->isTrustedDomain($parsedUrl['host']); } - /** - * {@inheritDoc} - */ public function isTrustedDomain(string $domainWithPort): bool { // overwritehost is always trusted if ($this->config->getSystemValue('overwritehost') !== '') { |