Passed
Push — master ( 0571fd...48a8f0 )
by Blizzz
19:19 queued 08:57
created
lib/private/Log/ExceptionSerializer.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 
100 100
 	private function filterTrace(array $trace) {
101 101
 		$sensitiveValues = [];
102
-		$trace = array_map(function (array $traceLine) use (&$sensitiveValues) {
102
+		$trace = array_map(function(array $traceLine) use (&$sensitiveValues) {
103 103
 			$className = $traceLine['class'] ?? '';
104 104
 			if ($className && isset(self::methodsWithSensitiveParametersByClass[$className])
105 105
 				&& in_array($traceLine['function'], self::methodsWithSensitiveParametersByClass[$className], true)) {
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 			}
113 113
 			return $traceLine;
114 114
 		}, $trace);
115
-		return array_map(function (array $traceLine) use ($sensitiveValues) {
115
+		return array_map(function(array $traceLine) use ($sensitiveValues) {
116 116
 			if (isset($traceLine['args'])) {
117 117
 				$traceLine['args'] = $this->removeValuesFromArgs($traceLine['args'], $sensitiveValues);
118 118
 			}
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 
134 134
 	private function encodeTrace($trace) {
135 135
 		$filteredTrace = $this->filterTrace($trace);
136
-		return array_map(function (array $line) {
136
+		return array_map(function(array $line) {
137 137
 			if (isset($line['args'])) {
138 138
 				$line['args'] = array_map([$this, 'encodeArg'], $line['args']);
139 139
 			}
Please login to merge, or discard this patch.
Indentation   +149 added lines, -149 removed lines patch added patch discarded remove patch
@@ -32,153 +32,153 @@
 block discarded – undo
32 32
 use OC\Setup;
33 33
 
34 34
 class ExceptionSerializer {
35
-	public const methodsWithSensitiveParameters = [
36
-		// Session/User
37
-		'completeLogin',
38
-		'login',
39
-		'checkPassword',
40
-		'checkPasswordNoLogging',
41
-		'loginWithPassword',
42
-		'updatePrivateKeyPassword',
43
-		'validateUserPass',
44
-		'loginWithToken',
45
-		'{closure}',
46
-		'createSessionToken',
47
-
48
-		// Provisioning
49
-		'addUser',
50
-
51
-		// TokenProvider
52
-		'getToken',
53
-		'isTokenPassword',
54
-		'getPassword',
55
-		'decryptPassword',
56
-		'logClientIn',
57
-		'generateToken',
58
-		'validateToken',
59
-
60
-		// TwoFactorAuth
61
-		'solveChallenge',
62
-		'verifyChallenge',
63
-
64
-		// ICrypto
65
-		'calculateHMAC',
66
-		'encrypt',
67
-		'decrypt',
68
-
69
-		// LoginController
70
-		'tryLogin',
71
-		'confirmPassword',
72
-
73
-		// LDAP
74
-		'bind',
75
-		'areCredentialsValid',
76
-		'invokeLDAPMethod',
77
-
78
-		// Encryption
79
-		'storeKeyPair',
80
-		'setupUser',
81
-
82
-		// files_external: OC_Mount_Config
83
-		'getBackendStatus',
84
-
85
-		// files_external: UserStoragesController
86
-		'update',
87
-	];
88
-
89
-	public const methodsWithSensitiveParametersByClass = [
90
-		SetupController::class => [
91
-			'run',
92
-			'display',
93
-			'loadAutoConfig',
94
-		],
95
-		Setup::class => [
96
-			'install'
97
-		]
98
-	];
99
-
100
-	private function editTrace(array &$sensitiveValues, array $traceLine): array {
101
-		if (isset($traceLine['args'])) {
102
-			$sensitiveValues = array_merge($sensitiveValues, $traceLine['args']);
103
-		}
104
-		$traceLine['args'] = ['*** sensitive parameters replaced ***'];
105
-		return $traceLine;
106
-	}
107
-
108
-	private function filterTrace(array $trace) {
109
-		$sensitiveValues = [];
110
-		$trace = array_map(function (array $traceLine) use (&$sensitiveValues) {
111
-			$className = $traceLine['class'] ?? '';
112
-			if ($className && isset(self::methodsWithSensitiveParametersByClass[$className])
113
-				&& in_array($traceLine['function'], self::methodsWithSensitiveParametersByClass[$className], true)) {
114
-				return $this->editTrace($sensitiveValues, $traceLine);
115
-			}
116
-			foreach (self::methodsWithSensitiveParameters as $sensitiveMethod) {
117
-				if (strpos($traceLine['function'], $sensitiveMethod) !== false) {
118
-					return $this->editTrace($sensitiveValues, $traceLine);
119
-				}
120
-			}
121
-			return $traceLine;
122
-		}, $trace);
123
-		return array_map(function (array $traceLine) use ($sensitiveValues) {
124
-			if (isset($traceLine['args'])) {
125
-				$traceLine['args'] = $this->removeValuesFromArgs($traceLine['args'], $sensitiveValues);
126
-			}
127
-			return $traceLine;
128
-		}, $trace);
129
-	}
130
-
131
-	private function removeValuesFromArgs($args, $values) {
132
-		foreach ($args as &$arg) {
133
-			if (in_array($arg, $values, true)) {
134
-				$arg = '*** sensitive parameter replaced ***';
135
-			} elseif (is_array($arg)) {
136
-				$arg = $this->removeValuesFromArgs($arg, $values);
137
-			}
138
-		}
139
-		return $args;
140
-	}
141
-
142
-	private function encodeTrace($trace) {
143
-		$filteredTrace = $this->filterTrace($trace);
144
-		return array_map(function (array $line) {
145
-			if (isset($line['args'])) {
146
-				$line['args'] = array_map([$this, 'encodeArg'], $line['args']);
147
-			}
148
-			return $line;
149
-		}, $filteredTrace);
150
-	}
151
-
152
-	private function encodeArg($arg) {
153
-		if (is_object($arg)) {
154
-			$data = get_object_vars($arg);
155
-			$data['__class__'] = get_class($arg);
156
-			return array_map([$this, 'encodeArg'], $data);
157
-		} elseif (is_array($arg)) {
158
-			return array_map([$this, 'encodeArg'], $arg);
159
-		} else {
160
-			return $arg;
161
-		}
162
-	}
163
-
164
-	public function serializeException(\Throwable $exception) {
165
-		$data = [
166
-			'Exception' => get_class($exception),
167
-			'Message' => $exception->getMessage(),
168
-			'Code' => $exception->getCode(),
169
-			'Trace' => $this->encodeTrace($exception->getTrace()),
170
-			'File' => $exception->getFile(),
171
-			'Line' => $exception->getLine(),
172
-		];
173
-
174
-		if ($exception instanceof HintException) {
175
-			$data['Hint'] = $exception->getHint();
176
-		}
177
-
178
-		if ($exception->getPrevious()) {
179
-			$data['Previous'] = $this->serializeException($exception->getPrevious());
180
-		}
181
-
182
-		return $data;
183
-	}
35
+    public const methodsWithSensitiveParameters = [
36
+        // Session/User
37
+        'completeLogin',
38
+        'login',
39
+        'checkPassword',
40
+        'checkPasswordNoLogging',
41
+        'loginWithPassword',
42
+        'updatePrivateKeyPassword',
43
+        'validateUserPass',
44
+        'loginWithToken',
45
+        '{closure}',
46
+        'createSessionToken',
47
+
48
+        // Provisioning
49
+        'addUser',
50
+
51
+        // TokenProvider
52
+        'getToken',
53
+        'isTokenPassword',
54
+        'getPassword',
55
+        'decryptPassword',
56
+        'logClientIn',
57
+        'generateToken',
58
+        'validateToken',
59
+
60
+        // TwoFactorAuth
61
+        'solveChallenge',
62
+        'verifyChallenge',
63
+
64
+        // ICrypto
65
+        'calculateHMAC',
66
+        'encrypt',
67
+        'decrypt',
68
+
69
+        // LoginController
70
+        'tryLogin',
71
+        'confirmPassword',
72
+
73
+        // LDAP
74
+        'bind',
75
+        'areCredentialsValid',
76
+        'invokeLDAPMethod',
77
+
78
+        // Encryption
79
+        'storeKeyPair',
80
+        'setupUser',
81
+
82
+        // files_external: OC_Mount_Config
83
+        'getBackendStatus',
84
+
85
+        // files_external: UserStoragesController
86
+        'update',
87
+    ];
88
+
89
+    public const methodsWithSensitiveParametersByClass = [
90
+        SetupController::class => [
91
+            'run',
92
+            'display',
93
+            'loadAutoConfig',
94
+        ],
95
+        Setup::class => [
96
+            'install'
97
+        ]
98
+    ];
99
+
100
+    private function editTrace(array &$sensitiveValues, array $traceLine): array {
101
+        if (isset($traceLine['args'])) {
102
+            $sensitiveValues = array_merge($sensitiveValues, $traceLine['args']);
103
+        }
104
+        $traceLine['args'] = ['*** sensitive parameters replaced ***'];
105
+        return $traceLine;
106
+    }
107
+
108
+    private function filterTrace(array $trace) {
109
+        $sensitiveValues = [];
110
+        $trace = array_map(function (array $traceLine) use (&$sensitiveValues) {
111
+            $className = $traceLine['class'] ?? '';
112
+            if ($className && isset(self::methodsWithSensitiveParametersByClass[$className])
113
+                && in_array($traceLine['function'], self::methodsWithSensitiveParametersByClass[$className], true)) {
114
+                return $this->editTrace($sensitiveValues, $traceLine);
115
+            }
116
+            foreach (self::methodsWithSensitiveParameters as $sensitiveMethod) {
117
+                if (strpos($traceLine['function'], $sensitiveMethod) !== false) {
118
+                    return $this->editTrace($sensitiveValues, $traceLine);
119
+                }
120
+            }
121
+            return $traceLine;
122
+        }, $trace);
123
+        return array_map(function (array $traceLine) use ($sensitiveValues) {
124
+            if (isset($traceLine['args'])) {
125
+                $traceLine['args'] = $this->removeValuesFromArgs($traceLine['args'], $sensitiveValues);
126
+            }
127
+            return $traceLine;
128
+        }, $trace);
129
+    }
130
+
131
+    private function removeValuesFromArgs($args, $values) {
132
+        foreach ($args as &$arg) {
133
+            if (in_array($arg, $values, true)) {
134
+                $arg = '*** sensitive parameter replaced ***';
135
+            } elseif (is_array($arg)) {
136
+                $arg = $this->removeValuesFromArgs($arg, $values);
137
+            }
138
+        }
139
+        return $args;
140
+    }
141
+
142
+    private function encodeTrace($trace) {
143
+        $filteredTrace = $this->filterTrace($trace);
144
+        return array_map(function (array $line) {
145
+            if (isset($line['args'])) {
146
+                $line['args'] = array_map([$this, 'encodeArg'], $line['args']);
147
+            }
148
+            return $line;
149
+        }, $filteredTrace);
150
+    }
151
+
152
+    private function encodeArg($arg) {
153
+        if (is_object($arg)) {
154
+            $data = get_object_vars($arg);
155
+            $data['__class__'] = get_class($arg);
156
+            return array_map([$this, 'encodeArg'], $data);
157
+        } elseif (is_array($arg)) {
158
+            return array_map([$this, 'encodeArg'], $arg);
159
+        } else {
160
+            return $arg;
161
+        }
162
+    }
163
+
164
+    public function serializeException(\Throwable $exception) {
165
+        $data = [
166
+            'Exception' => get_class($exception),
167
+            'Message' => $exception->getMessage(),
168
+            'Code' => $exception->getCode(),
169
+            'Trace' => $this->encodeTrace($exception->getTrace()),
170
+            'File' => $exception->getFile(),
171
+            'Line' => $exception->getLine(),
172
+        ];
173
+
174
+        if ($exception instanceof HintException) {
175
+            $data['Hint'] = $exception->getHint();
176
+        }
177
+
178
+        if ($exception->getPrevious()) {
179
+            $data['Previous'] = $this->serializeException($exception->getPrevious());
180
+        }
181
+
182
+        return $data;
183
+    }
184 184
 }
Please login to merge, or discard this patch.
lib/public/Support/CrashReport/IRegistry.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -32,45 +32,45 @@
 block discarded – undo
32 32
  */
33 33
 interface IRegistry {
34 34
 
35
-	/**
36
-	 * Register a reporter instance
37
-	 *
38
-	 * @param IReporter $reporter
39
-	 *
40
-	 * @since 13.0.0
41
-	 */
42
-	public function register(IReporter $reporter): void;
35
+    /**
36
+     * Register a reporter instance
37
+     *
38
+     * @param IReporter $reporter
39
+     *
40
+     * @since 13.0.0
41
+     */
42
+    public function register(IReporter $reporter): void;
43 43
 
44
-	/**
45
-	 * Delegate breadcrumb collection to all registered reporters
46
-	 *
47
-	 * @param string $message
48
-	 * @param string $category
49
-	 * @param array $context
50
-	 *
51
-	 * @since 15.0.0
52
-	 */
53
-	public function delegateBreadcrumb(string $message, string $category, array $context = []): void;
44
+    /**
45
+     * Delegate breadcrumb collection to all registered reporters
46
+     *
47
+     * @param string $message
48
+     * @param string $category
49
+     * @param array $context
50
+     *
51
+     * @since 15.0.0
52
+     */
53
+    public function delegateBreadcrumb(string $message, string $category, array $context = []): void;
54 54
 
55
-	/**
56
-	 * Delegate crash reporting to all registered reporters
57
-	 *
58
-	 * @param Exception|Throwable $exception
59
-	 * @param array $context
60
-	 *
61
-	 * @since 13.0.0
62
-	 */
63
-	public function delegateReport($exception, array $context = []);
55
+    /**
56
+     * Delegate crash reporting to all registered reporters
57
+     *
58
+     * @param Exception|Throwable $exception
59
+     * @param array $context
60
+     *
61
+     * @since 13.0.0
62
+     */
63
+    public function delegateReport($exception, array $context = []);
64 64
 
65
-	/**
66
-	 * Delegate a message to all reporters that implement IMessageReporter
67
-	 *
68
-	 * @param string $message
69
-	 * @param array $context
70
-	 *
71
-	 * @return void
72
-	 *
73
-	 * @since 17.0.0
74
-	 */
75
-	public function delegateMessage(string $message, array $context = []): void;
65
+    /**
66
+     * Delegate a message to all reporters that implement IMessageReporter
67
+     *
68
+     * @param string $message
69
+     * @param array $context
70
+     *
71
+     * @return void
72
+     *
73
+     * @since 17.0.0
74
+     */
75
+    public function delegateMessage(string $message, array $context = []): void;
76 76
 }
Please login to merge, or discard this patch.
lib/public/Support/CrashReport/IMessageReporter.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -30,14 +30,14 @@
 block discarded – undo
30 30
  */
31 31
 interface IMessageReporter extends IReporter {
32 32
 
33
-	/**
34
-	 * Report a (error) message
35
-	 *
36
-	 * @param string $message
37
-	 * @param array $context
38
-	 *
39
-	 * @since 17.0.0
40
-	 */
41
-	public function reportMessage(string $message, array $context = []): void;
33
+    /**
34
+     * Report a (error) message
35
+     *
36
+     * @param string $message
37
+     * @param array $context
38
+     *
39
+     * @since 17.0.0
40
+     */
41
+    public function reportMessage(string $message, array $context = []): void;
42 42
 
43 43
 }
Please login to merge, or discard this patch.
lib/private/Support/CrashReport/Registry.php 1 patch
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -31,62 +31,62 @@
 block discarded – undo
31 31
 
32 32
 class Registry implements IRegistry {
33 33
 
34
-	/** @var IReporter[] */
35
-	private $reporters = [];
34
+    /** @var IReporter[] */
35
+    private $reporters = [];
36 36
 
37
-	/**
38
-	 * Register a reporter instance
39
-	 *
40
-	 * @param IReporter $reporter
41
-	 */
42
-	public function register(IReporter $reporter): void {
43
-		$this->reporters[] = $reporter;
44
-	}
37
+    /**
38
+     * Register a reporter instance
39
+     *
40
+     * @param IReporter $reporter
41
+     */
42
+    public function register(IReporter $reporter): void {
43
+        $this->reporters[] = $reporter;
44
+    }
45 45
 
46
-	/**
47
-	 * Delegate breadcrumb collection to all registered reporters
48
-	 *
49
-	 * @param string $message
50
-	 * @param string $category
51
-	 * @param array $context
52
-	 *
53
-	 * @since 15.0.0
54
-	 */
55
-	public function delegateBreadcrumb(string $message, string $category, array $context = []): void {
56
-		foreach ($this->reporters as $reporter) {
57
-			if ($reporter instanceof ICollectBreadcrumbs) {
58
-				$reporter->collect($message, $category, $context);
59
-			}
60
-		}
61
-	}
46
+    /**
47
+     * Delegate breadcrumb collection to all registered reporters
48
+     *
49
+     * @param string $message
50
+     * @param string $category
51
+     * @param array $context
52
+     *
53
+     * @since 15.0.0
54
+     */
55
+    public function delegateBreadcrumb(string $message, string $category, array $context = []): void {
56
+        foreach ($this->reporters as $reporter) {
57
+            if ($reporter instanceof ICollectBreadcrumbs) {
58
+                $reporter->collect($message, $category, $context);
59
+            }
60
+        }
61
+    }
62 62
 
63
-	/**
64
-	 * Delegate crash reporting to all registered reporters
65
-	 *
66
-	 * @param Exception|Throwable $exception
67
-	 * @param array $context
68
-	 */
69
-	public function delegateReport($exception, array $context = []): void {
70
-		/** @var IReporter $reporter */
71
-		foreach ($this->reporters as $reporter) {
72
-			$reporter->report($exception, $context);
73
-		}
74
-	}
63
+    /**
64
+     * Delegate crash reporting to all registered reporters
65
+     *
66
+     * @param Exception|Throwable $exception
67
+     * @param array $context
68
+     */
69
+    public function delegateReport($exception, array $context = []): void {
70
+        /** @var IReporter $reporter */
71
+        foreach ($this->reporters as $reporter) {
72
+            $reporter->report($exception, $context);
73
+        }
74
+    }
75 75
 
76
-	/**
77
-	 * Delegate a message to all reporters that implement IMessageReporter
78
-	 *
79
-	 * @param string $message
80
-	 * @param array $context
81
-	 *
82
-	 * @return void
83
-	 */
84
-	public function delegateMessage(string $message, array $context = []): void {
85
-		foreach ($this->reporters as $reporter) {
86
-			if ($reporter instanceof IMessageReporter) {
87
-				$reporter->reportMessage($message, $context);
88
-			}
89
-		}
90
-	}
76
+    /**
77
+     * Delegate a message to all reporters that implement IMessageReporter
78
+     *
79
+     * @param string $message
80
+     * @param array $context
81
+     *
82
+     * @return void
83
+     */
84
+    public function delegateMessage(string $message, array $context = []): void {
85
+        foreach ($this->reporters as $reporter) {
86
+            if ($reporter instanceof IMessageReporter) {
87
+                $reporter->reportMessage($message, $context);
88
+            }
89
+        }
90
+    }
91 91
 
92 92
 }
Please login to merge, or discard this patch.
lib/public/Support/Subscription/ISupportedApps.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,10 +28,10 @@
 block discarded – undo
28 28
  */
29 29
 interface ISupportedApps extends ISubscription {
30 30
 
31
-	/**
32
-	 * Fetches the list of app IDs that are supported by the subscription
33
-	 *
34
-	 * @since 17.0.0
35
-	 */
36
-	public function getSupportedApps(): array;
31
+    /**
32
+     * Fetches the list of app IDs that are supported by the subscription
33
+     *
34
+     * @since 17.0.0
35
+     */
36
+    public function getSupportedApps(): array;
37 37
 }
Please login to merge, or discard this patch.
core/templates/twofactorsetupselection.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -31,18 +31,18 @@
 block discarded – undo
31 31
 		<li>
32 32
 			<a class="two-factor-provider"
33 33
 			   href="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.setupProvider',
34
-								[
35
-									'providerId' => $provider->getId(),
36
-									'redirect_url' => $_['redirect_url'],
37
-								]
38
-							)) ?>">
34
+                                [
35
+                                    'providerId' => $provider->getId(),
36
+                                    'redirect_url' => $_['redirect_url'],
37
+                                ]
38
+                            )) ?>">
39 39
 				<?php
40
-				if ($provider instanceof \OCP\Authentication\TwoFactorAuth\IProvidesIcons) {
41
-					$icon = $provider->getLightIcon();
42
-				} else {
43
-					$icon = image_path('core', 'actions/password-white.svg');
44
-				}
45
-				?>
40
+                if ($provider instanceof \OCP\Authentication\TwoFactorAuth\IProvidesIcons) {
41
+                    $icon = $provider->getLightIcon();
42
+                } else {
43
+                    $icon = image_path('core', 'actions/password-white.svg');
44
+                }
45
+                ?>
46 46
 				<img src="<?php p($icon) ?>" alt="" />
47 47
 				<div>
48 48
 					<h3><?php p($provider->getDisplayName()) ?></h3>
Please login to merge, or discard this patch.
lib/public/Authentication/TwoFactorAuth/IActivatableAtLogin.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -31,13 +31,13 @@
 block discarded – undo
31 31
  */
32 32
 interface IActivatableAtLogin extends IProvider {
33 33
 
34
-	/**
35
-	 * @param IUser $user
36
-	 *
37
-	 * @return ILoginSetupProvider
38
-	 *
39
-	 * @since 17.0.0
40
-	 */
41
-	public function getLoginSetup(IUser $user): ILoginSetupProvider;
34
+    /**
35
+     * @param IUser $user
36
+     *
37
+     * @return ILoginSetupProvider
38
+     *
39
+     * @since 17.0.0
40
+     */
41
+    public function getLoginSetup(IUser $user): ILoginSetupProvider;
42 42
 
43 43
 }
Please login to merge, or discard this patch.
lib/public/Authentication/TwoFactorAuth/ILoginSetupProvider.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,11 +31,11 @@
 block discarded – undo
31 31
  */
32 32
 interface ILoginSetupProvider {
33 33
 
34
-	/**
35
-	 * @return Template
36
-	 *
37
-	 * @since 17.0.0
38
-	 */
39
-	public function getBody(): Template;
34
+    /**
35
+     * @return Template
36
+     *
37
+     * @since 17.0.0
38
+     */
39
+    public function getBody(): Template;
40 40
 
41 41
 }
Please login to merge, or discard this patch.
lib/private/Authentication/Exceptions/WipeTokenException.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,16 +26,16 @@
 block discarded – undo
26 26
 use OC\Authentication\Token\IToken;
27 27
 
28 28
 class WipeTokenException extends InvalidTokenException {
29
-	/** @var IToken */
30
-	private $token;
29
+    /** @var IToken */
30
+    private $token;
31 31
 
32
-	public function __construct(IToken $token) {
33
-		parent::__construct();
32
+    public function __construct(IToken $token) {
33
+        parent::__construct();
34 34
 
35
-		$this->token = $token;
36
-	}
35
+        $this->token = $token;
36
+    }
37 37
 
38
-	public function getToken(): IToken {
39
-		return $this->token;
40
-	}
38
+    public function getToken(): IToken {
39
+        return $this->token;
40
+    }
41 41
 }
Please login to merge, or discard this patch.