Issues (159)

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/activitytabview.js (2 issues)

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
/*
2
 * Copyright (c) 2015
3
 *
4
 * This file is licensed under the Affero General Public License version 3
5
 * or later.
6
 *
7
 * See the COPYING-README file.
8
 *
9
 */
10
11
(function() {
12
13
	/**
14
	 * @class OCA.Activity.ActivityTabView
15
	 * @classdesc
16
	 *
17
	 * Displays activity information for a given file
18
	 *
19
	 */
20
	var ActivityTabView = OCA.Files.DetailTabView.extend(/** @lends OCA.Activity.ActivityTabView.prototype */ {
21
		id: 'activityTabView',
22
		className: 'activityTabView tab',
23
24
		events: {
25
			'click .showMore': '_onClickShowMore'
26
		},
27
28
		_loading: false,
29
		_plugins: [],
30
31
		initialize: function() {
32
			this.collection = new OCA.Activity.ActivityCollection();
33
			this.collection.setObjectType('files');
34
			this.collection.on('request', this._onRequest, this);
35
			this.collection.on('sync', this._onEndRequest, this);
36
			this.collection.on('error', this._onError, this);
37
			this.collection.on('add', this._onAddModel, this);
38
39
			this._plugins = OC.Plugins.getPlugins('OCA.Activity.RenderingPlugins');
40
			_.each(this._plugins, function(plugin) {
41
				if (_.isFunction(plugin.initialize)) {
42
					plugin.initialize();
43
				}
44
			});
45
		},
46
47
		template: function(data) {
48
			return OCA.Activity.Templates['activitytabview'](data);
0 ignored issues
show
['activitytabview'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
49
		},
50
51
		get$: function() {
52
			return this.$el;
53
		},
54
55
		getLabel: function() {
56
			return t('activity', 'Activity');
57
		},
58
59
		getIcon: function() {
60
			return 'icon-activity';
61
		},
62
63
		setFileInfo: function(fileInfo) {
64
			this._fileInfo = fileInfo;
65
			if (this._fileInfo) {
66
				this.collection.setObjectId(this._fileInfo.get('id'));
67
				this.collection.reset();
68
				this.collection.fetch();
69
70
				_.each(this._plugins, function(plugin) {
71
					if (_.isFunction(plugin.setFileInfo)) {
72
						plugin.setFileInfo('files', fileInfo.get('id'));
73
					}
74
				});
75
			} else {
76
				this.collection.reset();
77
78
				_.each(this._plugins, function(plugin) {
79
					if (_.isFunction(plugin.resetFileInfo)) {
80
						plugin.resetFileInfo();
81
					}
82
				});
83
			}
84
		},
85
86
		_onError: function() {
87
			var $emptyContent = this.$el.find('.emptycontent');
88
			$emptyContent.removeClass('hidden');
89
			$emptyContent.find('p').text(t('activity', 'An error occurred while loading activities'));
90
		},
91
92
		_onRequest: function() {
93
			if (this.collection.lastGivenId === 0) {
94
				this.render();
95
			}
96
			this.$el.find('.showMore').addClass('hidden');
97
		},
98
99
		_onEndRequest: function() {
100
			this.$container.removeClass('hidden');
101
			this.$el.find('.loading').addClass('hidden');
102
			if (this.collection.length) {
103
				this.$el.find('.emptycontent').addClass('hidden');
104
			}
105
			if (this.collection.hasMore) {
106
				this.$el.find('.showMore').removeClass('hidden');
107
			}
108
		},
109
110
		_onClickShowMore: function() {
111
			this.collection.fetch({
112
				reset: false
113
			});
114
		},
115
116
		/**
117
		 * Format an activity model for display
118
		 *
119
		 * @param {OCA.Activity.ActivityModel} activity
120
		 * @return {Object}
121
		 */
122
		_formatItem: function(activity) {
123
124
			var subject = activity.get('subject'),
125
				subject_rich = activity.get('subject_rich');
126
			if (subject_rich[0].length > 1) {
127
				subject = OCA.Activity.RichObjectStringParser.parseMessage(subject_rich[0], subject_rich[1]);
128
			}
129
			var message = activity.get('message'),
130
				message_rich = activity.get('message_rich');
131
			if (message_rich[0].length > 1) {
132
				message = OCA.Activity.RichObjectStringParser.parseMessage(message_rich[0], message_rich[1]);
133
			}
134
135
			var output = {
136
				subject: subject,
137
				formattedDate: activity.getRelativeDate(),
138
				formattedDateTooltip: activity.getFullDate(),
139
				timestamp: moment(activity.get('datetime')).valueOf(),
140
				message: message,
141
				icon: activity.get('icon')
142
			};
143
144
			/**
145
			 * Disable previews in the rightside bar,
146
			 * it's always the same image anyway.
147
			 if (activity.has('previews')) {
148
					output.previews = _.map(activity.get('previews'), function(data) {
149
						return {
150
							previewClass: data.isMimeTypeIcon ? 'preview-mimetype-icon': '',
151
							source: data.source
152
						};
153
					});
154
				}
155
			 */
156
			return output;
157
		},
158
159
		activityTemplate: function(params) {
160
			return OCA.Activity.Templates['activitytabview_activity'](params);
0 ignored issues
show
['activitytabview_activity'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
161
		},
162
163
		_onAddModel: function(model, collection, options) {
164
			var $el = $(this.activityTemplate(this._formatItem(model)));
165
166
			_.each(this._plugins, function(plugin) {
167
				if (_.isFunction(plugin.prepareModelForDisplay)) {
168
					plugin.prepareModelForDisplay(model, $el, 'ActivityTabView');
169
				}
170
			});
171
172
			if (!_.isUndefined(options.at) && collection.length > 1) {
173
				this.$container.find('li').eq(options.at).before($el);
174
			} else {
175
				this.$container.append($el);
176
			}
177
178
			this._postRenderItem($el);
179
		},
180
181
		_postRenderItem: function($el) {
182
			$el.find('.avatar').each(function() {
183
				var element = $(this);
184
				if (element.data('user-display-name')) {
185
					element.avatar(element.data('user'), 21, undefined, false, undefined, element.data('user-display-name'));
186
				} else {
187
					element.avatar(element.data('user'), 21);
188
				}
189
			});
190
			$el.find('.avatar-name-wrapper').each(function() {
191
				var element = $(this);
192
				var avatar = element.find('.avatar');
193
				var label = element.find('strong');
194
195
				$.merge(avatar, label).contactsMenu(element.data('user'), 0, element);
196
			});
197
			$el.find('.has-tooltip').tooltip({
198
				placement: 'bottom'
199
			});
200
		},
201
202
203
		/**
204
		 * Renders this details view
205
		 */
206
		render: function() {
207
			if (this._fileInfo) {
208
				this.$el.html(this.template({
209
					emptyMessage: t('activity', 'No activity yet'),
210
					moreLabel: t('activity', 'Load more activities')
211
				}));
212
				this.$container = this.$el.find('ul.activities');
213
			}
214
		}
215
	});
216
217
	OCA.Activity = OCA.Activity || {};
218
	OCA.Activity.ActivityTabView = ActivityTabView;
219
})();
220