This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
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
|
|||
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 |
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.