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.

js/src/app/backends/och.js (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
angular.module('chat').factory('och', ['convs', 'contacts', 'session', 'initvar', 'time', function(convs, contacts, $session, initvar, Time) {
2
	api = {
3
		command: {
4
			attachFile : function(convId, paths, user){
5
				api.util.doRequest({
6
					"type": "command::attach_file::request",
7
					"data": {
8
						"conv_id": convId,
9
						"timestamp": Time.now(),
10
						"user": user,
11
						"session_id": $session.id,
12
						"paths" : paths
13
					}
14
				}, function(){});
15
			},
16
			removeFile : function(convId, path){
17
				api.util.doRequest({
18
					"type": "command::remove_file::request",
19
					"data": {
20
						"conv_id": convId,
21
						"timestamp": Time.now(),
22
						"user": $session.user,
23
						"session_id": $session.id,
24
						"path" : path
25
					}
26
				}, function(){});
27
			},
28
			join: function (convId, success) {
29
				api.util.doRequest({
30
					"type": "command::join::request",
31
					"data": {
32
						"conv_id": convId,
33
						"timestamp": Time.now(),
34
						"user": $session.user,
35
						"session_id": $session.id
36
					}
37
				}, success);
38
			},
39
			invite: function (userToInvite, convId, success) {
40
				api.util.doRequest({
41
					"type": "command::invite::request",
42
					"data": {
43
						"conv_id": convId,
44
						"timestamp": Time.now(),
45
						"user_to_invite": userToInvite,
46
						"user": $session.user,
47
						"session_id": $session.id
48
					}
49
				}, success);
50
			},
51
			sendChatMsg: function (msg, convId, success) {
52
				api.util.doRequest({
53
					"type": "command::send_chat_msg::request",
54
					"data": {
55
						"conv_id": convId,
56
						"chat_msg": msg,
57
						"user": $session.user,
58
						"session_id": $session.id,
59
						"timestamp": Time.now()
60
					}
61
				}, success);
62
			},
63
			online: function () {
64
				api.util.doRequest({
65
					"type": "command::online::request",
66
					"data": {
67
						"user": $session.user,
68
						"session_id": $session.id,
69
						"timestamp": Time.now()
70
					}
71
				}, function () {
72
				});
73
			},
74
			offline: function () {
75
				api.util.doSyncRequest({
76
					"type": "command::offline::request",
77
					"data": {
78
						"user": $session.user,
79
						"session_id": $session.id,
80
						"timestamp": Time.now()
81
					}
82
				}, function () {
83
				});
84
			},
85
			startConv: function (userToInvite, success) {
86
				api.util.doRequest({
87
					"type": "command::start_conv::request",
88
					"data": {
89
						"user": $session.user,
90
						"session_id": $session.id,
91
						"timestamp": Time.now(),
92
						"user_to_invite": userToInvite
93
					}
94
				}, success);
95
			},
96
			getMessages: function (convId, startpoint, success) {
97
				api.util.doRequest({
98
					"type": "data::messages::request",
99
					"data": {
100
						"user": $session.user,
101
						"session_id": $session.id,
102
						"conv_id": convId,
103
						"startpoint": startpoint
104
					}
105
				}, success);
106
			},
107
			getUsers: function (convId, success) {
108
				api.util.doRequest({
109
					"type": "data::get_users::request",
110
					"data": {
111
						"user": $session.user,
112
						"session_id": $session.id,
113
						"conv_id": convId
114
					}
115
				}, success);
116
			},
117
			getOldMessages: function (convId, start, stop, success) {
118
				api.util.doRequest({
119
					"type": "data::messages::request",
120
					"data": {
121
						"user": $session.user,
122
						"session_id": $session.id,
123
						"conv_id": convId,
124
						"limit": [start, stop]
125
					}
126
				}, function(data){
127
					success(data.data.messages)
0 ignored issues
show
There should be a semicolon.

Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers.

Further Readings:

Loading history...
128
				});
129
			}
130
		},
131
		on: {
132
			invite: function (data) {
133
				// Here update the view
134
				var convId = data.conv_id;
135
				// TODO check if data.user is a user or a contact
136
				if (convs.get(convId) === undefined) {
137
					api.command.join(data.conv_id, function (dataJoin) {
138
						// After we joined we should update the users array with all users in this conversation
139
						var users = dataJoin.data.users;
140
						var msgs = dataJoin.data.messages;
141
						convs.addConv(convId, users, 'och', msgs);
142
					});
143
				}
144
			},
145
			chatMessage: function (data) {
146
				convs.addChatMsg(data.conv_id, data.user, data.chat_msg,
147
					data.timestamp, 'och');
148
			},
149
			joined: function (data) {
150
				//Chat.scope.$apply(function(){
151
				//	Chat.scope.view.replaceUsers();
152
				//});
153
					convs.replaceUsers(data.conv_id, data.users);
154
			},
155
			online: function (data) {
156
				contacts.markOnline(data.user.id);
157
			},
158
			offline: function (data) {
159
				contacts.markOffline(data.user.id);
160
			},
161
			fileAttached : function(data){
162
				convs.attachFile(data.conv_id, data.path, data.timestamp, data.user);
163
			},
164
			fileRemoved : function(data){
165
                convs.removeFile(data.conv_id, data.path, data.timestamp, data.user);
166
			}
167
		},
168
		util: {
169
			doRequest: function (request, success) {
170
				$.ajax({
171
					type: "POST",
172
					url: OC.generateUrl('/apps/chat/och/api'),
173
					data: JSON.stringify(request),
174
					headers: {'Content-Type': 'application/json'}
175
				}).always(function (data) {
176
					success(data);
177
				});
178
			},
179
			doSyncRequest: function (request, success, error) {
180
				$.ajax({
181
					type: "POST",
182
					url: OC.generateUrl('/apps/chat/och/api'),
183
					data: JSON.stringify(request),
184
					headers: {'Content-Type': 'application/json'},
185
					async: true
186
				});
187
188
			},
189
			longPoll: function () {
190
				api.util.getPushMessages(function (data) {
191
					var ids_del = [];
192
					for (var push_id in data.push_msgs) {
193
						var push_msg = data.push_msgs[push_id];
194
						ids_del.push(push_id);
195
						api.util.handlePushMessage(push_msg);
196
					}
197
					api.util.deletePushMessages(ids_del, function () {
198
						api.util.longPoll();
199
					});
200
				});
201
			},
202
			handlePushMessage: function (push_msg) {
203
				if (push_msg.type === "invite") {
204
					api.on.invite(push_msg.data);
205
				} else if (push_msg.type === "send_chat_msg") {
206
					api.on.chatMessage(push_msg.data);
207
				} else if (push_msg.type === "joined") {
208
					api.on.joined(push_msg.data);
209
				} else if (push_msg.type === "online") {
210
					api.on.online(push_msg.data);
211
				} else if (push_msg.type === "offline") {
212
					api.on.offline(push_msg.data);
213
				} else if (push_msg.type === 'file_attached'){
214
					api.on.fileAttached(push_msg.data);
215
				} else if (push_msg.type === 'file_removed'){
216
					api.on.fileRemoved(push_msg.data);
217
				}
218
			},
219
			getPushMessages: function (success) {
220
				api.util.doRequest({
221
					"type": "push::get::request",
222
					"data": {
223
						"user": $session.user,
224
						"session_id": $session.id
225
					}
226
				}, success);
227
			},
228
			deletePushMessages: function (ids, success) {
229
				api.util.doRequest({
230
					"type": "push::delete::request",
231
					"data": {
232
						"user": $session.user,
233
						"session_id": $session.id,
234
						ids: ids
235
					}
236
				}, function (data) {
237
					success();
238
				});
239
			}
240
		},
241
		INVALID_HTTP_TYPE : 0,
242
		COMMAND_NOT_FOUND : 1,
243
		PUSH_ACTION_NOT_FOUND : 2,
244
		DATA_ACTION_NOT_FOUND : 3,
245
		NO_SESSION_ID : 6,
246
		USER_NOT_EQUAL_TO_OC_USER : 7,
247
		NO_TIMESTAMP : 8,
248
		NO_CONV_ID : 9,
249
		NO_USER_TO_INVITE : 10,
250
		USER_EQUAL_TO_USER_TO_INVITE : 11,
251
		USER_TO_INVITE_NOT_OC_USER : 12,
252
		NO_CHAT_MSG : 13
253
	};
254
	return {
255
		init : function(){
256
			api.util.longPoll();
257
			setInterval(api.command.online, 30000);
258
			initvar.backends.och.connected = true;
259
		},
260
		quit : function(){
261
			api.command.offline();
262
		},
263
		sendChatMsg : function(convId, msg){
264
			api.command.sendChatMsg(msg, convId, function(){});
265
		},
266
		invite : function(convId, userToInvite, groupConv, callback){
267
			if(groupConv){
268
				// We are in a group conversation
269
				api.command.invite(userToInvite, convId, callback);
270
			} else {
271
				var users = [];
272
				for (var key in convs.get(convId).users) {
273
					users.push(convs.get(convId).users[key]);
274
				}
275
				users.push(userToInvite);
276
				this.newConv(users, callback);
277
			}
278
		},
279
		newConv : function(userToInvite, success){
280
			api.command.startConv(
281
				userToInvite,
282
				success
283
			);
284
		},
285
		attachFile : function(convId, paths, user){
286
			api.command.attachFile(convId, paths, user);
287
		},
288
		removeFile : function(convId, path){
289
			api.command.removeFile(convId, path);
290
		},
291
		configChanged : function(){
292
		},
293
		getOldMessages : function (convId, start, stop, success) {
294
			api.command.getOldMessages(convId, start, stop, success);
295
		}
296
	};
297
}]);