Issues (524)

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.

js/reducers/deployment.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
const _ = require('underscore');
2
3
const actions = require('../_actions.js');
4
5
const initialState = {
6
	// this is the time of the last update we got from the server
7
	// it is used for syncronising with the backend
8
	server_time: 0,
9
	is_creating: false,
10
	is_loading: false,
11
	is_queuing: false,
12
	// this is the "list" (actually an object) of all deployments that we fetched, updated etc keyed by deployment id
13
	list: {},
14
	// point to a deployment in the list above and is used to for the modal
15
	current_id: "",
16
	// this is a "list" (actually an object) of deployment logs keyed by the deployment id
17
	logs: {},
18
	history_error: null,
19
	error: null,
20
	current_page: 1,
21
	history_is_loading: false,
22
	abort_is_loading: false
23
};
24
25
module.exports = function deployment(state, action) {
26
	if (typeof state === 'undefined') {
27
		return initialState;
28
	}
29
30
	switch (action.type) {
31
		case actions.SET_DEPLOY_HISTORY_PAGE: {
32
			return _.assign({}, state, {
33
				current_page: action.page
34
			});
35
		}
36
		case actions.START_DEPLOY_HISTORY_GET:
37
			return _.assign({}, state, {
38
				history_is_loading: true
39
			});
40
		case actions.FAIL_DEPLOY_HISTORY_GET:
41
			return _.assign({}, state, {
42
				history_is_loading: false,
43
				history_error: action.error.toString()
44
			});
45
		case actions.SUCCEED_DEPLOY_HISTORY_GET: {
46
			// get current list
47
			const newList = _.assign({}, state.list);
48
			let new_current_build_id = null;
49
50
			// add or update the entries in the current list
51
			for (let i = 0; i < action.data.list.length; i++) {
0 ignored issues
show
As per coding-style, please do not use ++, but use += 1 instead.
Loading history...
52
				// if one of the new entries is the current_build,
53
				// we'll be invalidating the current one for the new one
54
				if (action.data.list[i].is_current_build === true) {
55
					new_current_build_id = action.data.list[i].id;
56
				}
57
				newList[action.data.list[i].id] = action.data.list[i];
58
			}
59
60
			if (new_current_build_id !== null) {
61
				// first of all, set everything to not be the current build
62
				Object.keys(newList).forEach(function(key) {
63
					newList[key].is_current_build = false;
64
				});
65
				// now set the item we need to current
66
				newList[new_current_build_id].is_current_build = true;
67
			}
68
69
			return _.assign({}, state, {
70
				server_time: action.data.server_time,
71
				list: newList,
72
				history_is_loading: false
73
			});
74
		}
75
		case actions.NEW_DEPLOYMENT:
76
			return _.assign({}, state, {
77
				current_id: "",
78
				error: null,
79
			});
80
81
		case actions.START_DEPLOYMENT_CREATE:
82
			return _.assign({}, state, {
83
				is_creating: true,
84
			});
85
86
		case actions.SUCCEED_DEPLOYMENT_CREATE: {
87
			const newList = _.assign({}, state.list);
88
			newList[action.data.deployment.id] = action.data.deployment;
89
			return _.assign({}, state, {
90
				is_creating: false,
91
				current_id: action.data.deployment.id,
92
				list: newList
93
			});
94
		}
95
96
		case actions.FAIL_DEPLOYMENT_CREATE:
97
			return _.assign({}, state, {
98
				is_creating: false,
99
				error: action.error.toString()
100
			});
101
102
		case actions.START_DEPLOYMENT_GET:
103
			return _.assign({}, state, {
104
				is_loading: true,
105
				error: null
106
			});
107
108
		case actions.SET_APPROVER: {
109
			if (!state.list[state.current_id]) {
110
				return state;
111
			}
112
			const newList = _.assign({}, state.list);
113
			newList[state.current_id].approver_id = action.id;
114
			return _.assign({}, state, {
115
				list: newList
116
			});
117
		}
118
119
		case actions.SET_REJECT_REASON: {
120
			if (!state.list[state.current_id]) {
121
				return state;
122
			}
123
			const newList = _.assign({}, state.list);
124
			newList[state.current_id].rejected_reason = action.value;
125
126
			return _.assign({}, state, {
127
				list: newList
128
			});
129
		}
130
131
		case actions.START_DEPLOYMENT_QUEUE:
132
			return _.assign({}, state, {
133
				is_queuing: true
134
			});
135
136
		case actions.SUCCEED_APPROVAL_SUBMIT:
137
		case actions.SUCCEED_APPROVAL_CANCEL:
138
		case actions.SUCCEED_APPROVAL_APPROVE:
139
		case actions.SUCCEED_APPROVAL_REJECT:
140
		case actions.SUCCEED_DEPLOYMENT_QUEUE:
141
		case actions.SUCCEED_DEPLOYMENT_GET: {
142
			// get current list
143
			const newList = _.assign({}, state.list);
144
			newList[action.data.deployment.id] = action.data.deployment;
145
146
			return _.assign({}, state, {
147
				is_loading: false,
148
				is_queuing: false,
149
				error: null,
150
				current_id: action.data.deployment.id,
151
				list: newList
152
			});
153
		}
154
155
		case actions.FAIL_DEPLOYMENT_QUEUE:
156
		case actions.FAIL_DEPLOY_LOG_UPDATE:
157
		case actions.FAIL_DEPLOYMENT_GET:
158
			return _.assign({}, state, {
159
				is_loading: false,
160
				error: action.error.toString()
161
			});
162
163
		case actions.SUCCEED_DEPLOY_LOG_UPDATE: {
164
			const newList = _.assign({}, state.list);
165
			newList[action.data.deployment.id] = action.data.deployment;
166
167
			const newLogList = _.assign({}, state.logs);
168
			newLogList[action.data.deployment.id] = action.data.message;
169
170
			return _.assign({}, state, {
171
				logs: newLogList,
172
				error: null,
173
				list: newList
174
			});
175
		}
176
		case actions.SUCCEED_DEPLOYMENT_DELETE: {
177
			// get current list
178
			const newList = _.assign({}, state.list);
179
			newList[action.data.deployment.id] = action.data.deployment;
180
181
			return _.assign({}, state, {
182
				error: null,
183
				list: newList
184
			});
185
		}
186
187
		case actions.SET_TITLE:
188
		case actions.SET_SUMMARY:
189
		case actions.SET_REVISION:
190
		case actions.TOGGLE_OPTION: {
191
			if (!state.list[state.current_id]) {
192
				return state;
193
			}
194
			const newList = _.assign({}, state.list);
195
			newList[state.current_id].dirty = true;
196
			return _.assign({}, state, {
197
				list: newList
198
			});
199
		}
200
201
		case actions.START_ABORT_DEPLOYMENT:
202
			return _.assign({}, state, {
203
				abort_is_loading: true
204
			});
205
		case actions.FAIL_ABORT_DEPLOYMENT:
206
			return _.assign({}, state, {
207
				abort_is_loading: false
208
			});
209
		case actions.SUCCEED_ABORT_DEPLOYMENT: {
210
			const newList = _.assign({}, state.list);
211
			newList[action.data.deployment.id] = action.data.deployment;
212
213
			return _.assign({}, state, {
214
				list: newList,
215
				abort_is_loading: false
216
			});
217
		}
218
219
		default:
220
			return state;
221
	}
222
};
223