Issues (158)

Security Analysis    no request data  

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.

app/container.php (1 issue)

Languages
Severity

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
 * Copyright (c) 2014, Tobia De Koninck hey--at--ledfan.be
4
 * This file is licensed under the AGPL version 3 or later.
5
 * See the COPYING file.
6
 */
7
8
namespace OCA\Chat\App;
9
10
use OCA\Chat\Controller\AppController;
11
use OCA\Chat\Controller\OCH\ApiController;
12
use OCA\Chat\Controller\ConfigController;
13
use OCA\Chat\Controller\AdminController;
14
use OCP\AppFramework\App;
15
use OCA\Chat\OCH\Db\ConversationMapper;
16
use OCA\Chat\OCH\Db\MessageMapper;
17
use OCA\Chat\OCH\Db\PushMessageMapper;
18
use OCA\Chat\OCH\Db\UserMapper;
19
use OCA\Chat\OCH\Db\UserOnlineMapper;
20
use OCA\Chat\OCH\Db\AttachmentMapper;
21
use OCA\Chat\Db\ConfigMapper;
22
use OCA\Chat\OCH\Commands\Greet;
23
use OCA\Chat\OCH\Commands\Invite;
24
use OCA\Chat\OCH\Commands\Join;
25
use OCA\Chat\OCH\Commands\Offline;
26
use OCA\Chat\OCH\Commands\Online;
27
use OCA\Chat\OCH\Commands\SendChatMsg;
28
use OCA\Chat\OCH\Commands\StartConv;
29
use OCA\Chat\OCH\Commands\SyncOnline;
30
use OCA\Chat\OCH\Commands\AttachFile;
31
use OCA\Chat\OCH\Commands\RemoveFile;
32
use OCA\Chat\OCH\Data\GetUsers;
33
use OCA\Chat\OCH\Data\Messages;
34
use OCA\Chat\OCH\Push\Get;
35
use OCA\Chat\OCH\Push\Delete;
36
use OCA\Chat\OCH\OCH;
37
use OCA\Chat\XMPP\XMPP;
38
use OCA\Chat\BackendManager;
39
use OCA\Chat\IBackend;
40
use OCA\Chat\Middleware\ErrorMiddleware;
41
42
/**
43
 * Class Chat
44
 * @package OCA\Chat\App
45
 */
46
class Container extends App{
47
48
	/**
49
	 * @param array $urlParams
50
	 */
51
	public function __construct(array $urlParams = array()) {
52
		parent::__construct('chat', $urlParams);
53
		$container = $this->getContainer();
54
		$container->registerMiddleware('ErrorMiddleware');
55
56
		/**
57
		 * Chat Class
58
		 */
59
		$container->registerService('Chat', function($c){
60
			return new Chat(
61
				$c->query('BackendManager'),
62
				$c->query('UserOnlineMapper'),
63
				$c->query('SyncOnlineCommand'),
64
				$c->query('UserId'),
65
				$c->query('OCP\Contacts\IManager'),
66
				$c->query('OCP\Files\IRootFolder')
67
			);
68
		});
69
70
		/**
71
		 * Controllers
72
		 */
73
		$container->registerService('AppController', function ($c) {
74
			return new AppController(
75
				$c->query('AppName'),
76
				$c->query('Request'),
77
				$c->query('Chat'),
78
				$c->query('OCP\Contacts\IManager'),
79
				$c->query('OCP\IConfig'),
80
				$c->query('GreetCommand')
81
			);
82
		});
83
84
		$container->registerService('ApiController', function ($c) {
85
			return new ApiController(
86
				$c->query('AppName'),
87
				$c->query('Request'),
88
				$c->query('Chat'),
89
				$this
90
			);
91
		});
92
93
		$container->registerService('ConfigController', function ($c) {
94
			return new ConfigController(
95
				$c->query('AppName'),
96
				$c->query('Request'),
97
				$c->query('ConfigMapper'),
98
				$c->query('BackendManager')
99
			);
100
		});
101
102
		$container->registerService('AdminController', function ($c) {
103
			return new AdminController(
104
				$c->query('AppName'),
105
				$c->query('Request'),
106
				$c->query('BackendManager')
107
			);
108
		});
109
110
		/**
111
		 * DataMappers
112
		 */
113
114
		$container->registerService('ConversationMapper', function ($c) {
115
			return new ConversationMapper(
116
				$c->query('OCP\IDb')
117
			);
118
		});
119
120
		$container->registerService('ConversationMapper', function ($c) {
121
			return new ConversationMapper(
122
				$c->query('OCP\IDb')
123
			);
124
		});
125
126
		$container->registerService('MessageMapper', function ($c) {
127
			return new MessageMapper(
128
				$c->query('OCP\IDb')
129
			);
130
		});
131
132
		$container->registerService('PushMessageMapper', function ($c) {
133
			return new PushMessageMapper(
134
				$c->query('OCP\IDb'),
135
				$c['UserOnlineMapper'],
136
				$c['UserMapper']
137
			);
138
		});
139
140
		$container->registerService('UserMapper', function ($c) {
141
			return new UserMapper(
142
				$c->query('OCP\IDb')
143
			);
144
		});
145
146
		$container->registerService('UserOnlineMapper', function ($c) {
147
			return new UserOnlineMapper(
148
				$c->query('OCP\IDb')
149
			);
150
		});
151
152
		$container->registerService('AttachmentMapper', function ($c) {
153
			return new AttachmentMapper(
154
				$c->query('OCP\IDb'),
155
				$c->query('Chat')
156
			);
157
		});
158
159
		$container->registerService('ConfigMapper', function ($c) {
160
			return new ConfigMapper(
161
				$c->query('OCP\IDb'),
162
				$c->query('Chat')->getUserId(),
163
				$c->query('OCP\Security\ICrypto')
164
			);
165
		});
166
167
		/**
168
		 * Command API Requests
169
		 */
170
		$container->registerService('GreetCommand', function ($c) {
171
			return new Greet(
172
				$c->query('PushMessageMapper'),
173
				$c->query('UserOnlineMapper')
174
			);
175
		});
176
177
		$container->registerService('InviteCommand', function ($c) {
178
			return new Invite(
179
				$c->query('PushMessageMapper'),
180
				$c->query('JoinCommand'),
181
				$c->query('GetUsersData')
182
			);
183
		});
184
185
		$container->registerService('JoinCommand', function ($c) {
186
			return new Join(
187
				$c->query('PushMessageMapper'),
188
				$c->query('GetUsersData'),
189
				$c->query('UserMapper')
190
			);
191
		});
192
193
		$container->registerService('OfflineCommand', function ($c) {
194
			return new Offline(
195
				$c->query('PushMessageMapper'),
196
				$c->query('UserOnlineMapper'),
197
				$c->query('SyncOnlineCommand')
198
			);
199
		});
200
201
		$container->registerService('OnlineCommand', function ($c) {
202
			return new Online(
203
				$c->query('UserOnlineMapper'),
204
				$c->query('SyncOnlineCommand')
205
			);
206
		});
207
208
		$container->registerService('SendChatMsgCommand', function ($c) {
209
			return new SendChatMsg(
210
				$c->query('PushMessageMapper'),
211
				$c->query('MessageMapper')
212
			);
213
		});
214
215
		$container->registerService('StartConvCommand', function ($c) {
216
			return new StartConv(
217
				$c->query('MessageMapper'),
218
				$c->query('ConversationMapper'),
219
				$c->query('InviteCommand'),
220
				$c->query('JoinCommand'),
221
				$c->query('GetUsersData'),
222
				$c->query('MessagesData')
223
			);
224
		});
225
226
227
		$container->registerService('SyncOnlineCommand', function ($c) {
228
			return new SyncOnline(
229
				$c->query('UserOnlineMapper')
230
			);
231
		});
232
233
		$container->registerService('AttachFileCommand', function ($c) {
234
			return new AttachFile(
235
				$c->query('Chat'),
236
				$c->query('UserMapper'),
237
				$c->query('AttachmentMapper'),
238
				$c->query('PushMessageMapper')
239
			);
240
		});
241
242
		$container->registerService('RemoveFileCommand', function ($c) {
243
			return new RemoveFile(
244
				$c->query('Chat'),
245
				$c->query('PushMessageMapper'),
246
				$c->query('AttachmentMapper'),
247
				$c->query('UserMapper')
248
			);
249
		});
250
251
252
		/**
253
		 * Push API Requests
254
		 */
255
		$container->registerService('GetPush', function ($c) {
256
			return new Get(
257
				$c->query('PushMessageMapper')
258
			);
259
		});
260
261
		$container->registerService('DeletePush', function ($c) {
262
			return new Delete(
263
				$c->query('PushMessageMapper')
264
			);
265
		});
266
267
		/**
268
		 * Data API Requests
269
		 */
270
		$container->registerService('GetUsersData', function ($c) {
271
			return new GetUsers(
272
				$c->query('Chat'),
273
				$c->query('UserMapper')
274
			);
275
		});
276
277
		$container->registerService('MessagesData', function ($c) {
278
			return new Messages(
279
				$c->query('MessageMapper')
280
			);
281
		});
282
283
		/**
284
		 * Manager
285
		 */
286
		$container->registerService('BackendManager', function($c){
0 ignored issues
show
The parameter $c is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
287
			return new BackendManager();
288
		});
289
290
		$container->registerService('OCH', function($c){
291
			return new OCH(
292
				$c->query('ConfigMapper'),
293
				$c->query('OCP\IConfig'),
294
				$c->query('UserMapper'),
295
				$c->query('AttachmentMapper'),
296
				$c->query('StartConvCommand'),
297
				$c->query('MessagesData'),
298
				$c->query('JoinCommand'),
299
				$c->query('Chat')
300
			);
301
		});
302
303
		$container->registerService('XMPP', function($c){
304
			return new XMPP(
305
				$c->query('ConfigMapper'),
306
				$c->query('OCP\IConfig'),
307
				$c->query('Chat')
308
			);
309
		});
310
311
		$container->registerService('ErrorMiddleware', function($c){
312
			return new ErrorMiddleware($c->query('Chat'));
313
		});
314
315
	}
316
317
	public function query($param){
318
		return $this->getContainer()->query($param);
319
	}
320
321
}
322