Issues (1798)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

core/Application.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * @author Bernhard Posselt <[email protected]>
4
 * @author Christoph Wurst <[email protected]>
5
 * @author Lukas Reschke <[email protected]>
6
 * @author Morris Jobke <[email protected]>
7
 * @author Peter Prochaska <[email protected]>
8
 * @author Roeland Jago Douma <[email protected]>
9
 * @author Thomas Müller <[email protected]>
10
 * @author Victor Dubiniuk <[email protected]>
11
 *
12
 * @copyright Copyright (c) 2018, ownCloud GmbH
13
 * @license AGPL-3.0
14
 *
15
 * This code is free software: you can redistribute it and/or modify
16
 * it under the terms of the GNU Affero General Public License, version 3,
17
 * as published by the Free Software Foundation.
18
 *
19
 * This program is distributed in the hope that it will be useful,
20
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
 * GNU Affero General Public License for more details.
23
 *
24
 * You should have received a copy of the GNU Affero General Public License, version 3,
25
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
26
 *
27
 */
28
29
namespace OC\Core;
30
31
use OC\AppFramework\Utility\SimpleContainer;
32
use OC\AppFramework\Utility\TimeFactory;
33
use OC\Core\Controller\AvatarController;
34
use OC\Core\Controller\CloudController;
35
use OC\Core\Controller\CronController;
36
use OC\Core\Controller\LoginController;
37
use OC\Core\Controller\LostController;
38
use OC\Core\Controller\TokenController;
39
use OC\Core\Controller\TwoFactorChallengeController;
40
use OC\Core\Controller\UserController;
41
use OC_Defaults;
42
use OCP\AppFramework\App;
43
use OCP\BackgroundJob\IJobList;
44
use OCP\IConfig;
45
use OCP\ILogger;
46
use OCP\IServerContainer;
47
use OCP\Util;
48
49
/**
50
 * Class Application
51
 *
52
 * @package OC\Core
53
 */
54
class Application extends App {
55
56
	/**
57
	 * @param array $urlParams
58
	 */
59
	public function __construct(array $urlParams= []) {
60
		parent::__construct('core', $urlParams);
61
62
		$container = $this->getContainer();
63
64
		/**
65
		 * Controllers
66
		 */
67
		$container->registerService('LostController', function (SimpleContainer $c) {
68
			return new LostController(
69
				$c->query('AppName'),
70
				$c->query('Request'),
71
				$c->query('URLGenerator'),
72
				$c->query('UserManager'),
73
				$c->query('Defaults'),
74
				$c->query('L10N'),
75
				$c->query('Config'),
76
				$c->query('SecureRandom'),
77
				$c->query('DefaultEmailAddress'),
78
				$c->query('IsEncryptionEnabled'),
79
				$c->query('Mailer'),
80
				$c->query('TimeFactory'),
81
				$c->query('Logger'),
82
				$c->query('UserSession')
83
			);
84
		});
85
		$container->registerService('UserController', function (SimpleContainer $c) {
86
			return new UserController(
87
				$c->query('AppName'),
88
				$c->query('Request'),
89
				$c->query('UserManager'),
90
				$c->query('Defaults')
91
			);
92
		});
93
		$container->registerService('AvatarController', function (SimpleContainer $c) {
94
			/** @var IServerContainer $server */
95
			$server = $c->query('ServerContainer');
96
			return new AvatarController(
97
				$c->query('AppName'),
98
				$c->query('Request'),
99
				$c->query('AvatarManager'),
100
				$c->query('Cache'),
101
				$c->query('L10N'),
102
				$c->query('UserManager'),
103
				$c->query('UserSession'),
104
				$server->getRootFolder(),
105
				$c->query('Logger')
106
			);
107
		});
108 View Code Duplication
		$container->registerService('LoginController', function (SimpleContainer $c) {
109
			return new LoginController(
110
				$c->query('AppName'),
111
				$c->query('Request'),
112
				$c->query('UserManager'),
113
				$c->query('Config'),
114
				$c->query('Session'),
115
				$c->query('UserSession'),
116
				$c->query('URLGenerator'),
117
				$c->query('TwoFactorAuthManager')
118
			);
119
		});
120
		$container->registerService('TwoFactorChallengeController', function (SimpleContainer $c) {
121
			return new TwoFactorChallengeController(
122
				$c->query('AppName'),
123
				$c->query('Request'),
124
				$c->query('TwoFactorAuthManager'),
125
				$c->query('UserSession'),
126
				$c->query('Session'),
127
				$c->query('URLGenerator'));
128
		});
129 View Code Duplication
		$container->registerService('TokenController', function (SimpleContainer $c) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
130
			return new TokenController(
131
				$c->query('AppName'),
132
				$c->query('Request'),
133
				$c->query('UserManager'),
134
				$c->query('ServerContainer')->query('OC\Authentication\Token\IProvider'),
135
				$c->query('TwoFactorAuthManager'),
136
				$c->query('SecureRandom')
137
			);
138
		});
139
		$container->registerService('CloudController', function (SimpleContainer $c) {
140
			return new CloudController(
141
				$c->query('AppName'),
142
				$c->query('Request')
143
			);
144
		});
145
		$container->registerService('CronController', function (SimpleContainer $c) {
146
			return new CronController(
147
				$c->query('AppName'),
148
				$c->query('Request'),
149
				$c->query(IConfig::class),
150
				$c->query(ILogger::class),
151
				$c->query(IJobList::class)
152
			);
153
		});
154
155
		/**
156
		 * Core class wrappers
157
		 */
158
		$container->registerService('IsEncryptionEnabled', function (SimpleContainer $c) {
159
			return $c->query('ServerContainer')->getEncryptionManager()->isEnabled();
160
		});
161
		$container->registerService('URLGenerator', function (SimpleContainer $c) {
162
			return $c->query('ServerContainer')->getURLGenerator();
163
		});
164
		$container->registerService('UserManager', function (SimpleContainer $c) {
165
			return $c->query('ServerContainer')->getUserManager();
166
		});
167
		$container->registerService('Config', function (SimpleContainer $c) {
168
			return $c->query('ServerContainer')->getConfig();
169
		});
170
		$container->registerService('L10N', function (SimpleContainer $c) {
171
			return $c->query('ServerContainer')->getL10N('core');
172
		});
173
		$container->registerService('SecureRandom', function (SimpleContainer $c) {
174
			return $c->query('ServerContainer')->getSecureRandom();
175
		});
176
		$container->registerService('AvatarManager', function (SimpleContainer $c) {
177
			return $c->query('ServerContainer')->getAvatarManager();
178
		});
179
		$container->registerService('Session', function (SimpleContainer $c) {
180
			return $c->query('ServerContainer')->getSession();
181
		});
182
		$container->registerService('UserSession', function (SimpleContainer $c) {
183
			return $c->query('ServerContainer')->getUserSession();
184
		});
185
		$container->registerService('Cache', function (SimpleContainer $c) {
186
			return $c->query('ServerContainer')->getCache();
187
		});
188
		$container->registerService('Defaults', function () {
189
			return new OC_Defaults;
190
		});
191
		$container->registerService('Mailer', function (SimpleContainer $c) {
192
			return $c->query('ServerContainer')->getMailer();
193
		});
194
		$container->registerService('Logger', function (SimpleContainer $c) {
195
			return $c->query('ServerContainer')->getLogger();
196
		});
197
		$container->registerService('TimeFactory', function (SimpleContainer $c) {
198
			return new TimeFactory();
199
		});
200
		$container->registerService('DefaultEmailAddress', function () {
201
			return Util::getDefaultEmailAddress('lostpassword-noreply');
202
		});
203
		$container->registerService('TwoFactorAuthManager', function (SimpleContainer $c) {
204
			return $c->query('ServerContainer')->getTwoFactorAuthManager();
205
		});
206
	}
207
}
208