Issues (221)

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.

lib/Controller/BoardApiController.php (1 issue)

Labels
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 Copyright (c) 2017 Steven R. Baker <[email protected]>
4
 *
5
 * @author Steven R. Baker <[email protected]>
6
 * @author Ryan Fletcher <[email protected]>
7
 *
8
 * @license GNU AGPL version 3 or any later version
9
 *
10
 *  This program is free software: you can redistribute it and/or modify
11
 *  it under the terms of the GNU Affero General Public License as
12
 *  published by the Free Software Foundation, either version 3 of the
13
 *  License, or (at your option) any later version.
14
 *
15
 *  This program is distributed in the hope that it will be useful,
16
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 *  GNU Affero General Public License for more details.
19
 *
20
 *  You should have received a copy of the GNU Affero General Public License
21
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
 *
23
 */
24
25
namespace OCA\Deck\Controller;
26
27
use OCA\Deck\StatusException;
28
use OCP\AppFramework\ApiController;
29
use OCP\AppFramework\Http;
30
use OCP\AppFramework\Http\DataResponse;
31
use OCP\IRequest;
32
33
use OCA\Deck\Service\BoardService;
34
use Sabre\HTTP\Util;
35
36
/**
37
 * Class BoardApiController
38
 *
39
 * @package OCA\Deck\Controller
40
 */
41
class BoardApiController extends ApiController {
42
43
	private $boardService;
44
45
	/**
46
	 * @param string $appName
47
	 * @param IRequest $request
48
	 * @param BoardService $service
49
	 * @param $userId
50
	 */
51
	public function __construct($appName, IRequest $request, BoardService $service, $userId) {
52
		parent::__construct($appName, $request);
53
		$this->boardService = $service;
54
		$this->userId = $userId;
0 ignored issues
show
The property userId does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
55
	}
56
57
	/**
58
	 * @NoAdminRequired
59
	 * @CORS
60
	 * @NoCSRFRequired
61
	 *
62
	 * Return all of the boards that the current user has access to.
63
	 * @throws StatusException
64
	 */
65
	public function index($details = null) {
66
		$modified = $this->request->getHeader('If-Modified-Since');
67
		if ($modified === null || $modified === '') {
68
			$boards = $this->boardService->findAll(0, $details);
69
		} else {
70
			$date = Util::parseHTTPDate($modified);
71
			if (!$date) {
72
				throw new StatusException('Invalid If-Modified-Since header provided.');
73
			}
74
			$boards = $this->boardService->findAll($date->getTimestamp(), $details);
75
		}
76
		return new DataResponse($boards, HTTP::STATUS_OK);
77
	 }
78
79
	/**
80
	 * @NoAdminRequired
81
	 * @CORS
82
	 * @NoCSRFRequired
83
	 *
84
	 *
85
	 * Return the board specified by $this->request->getParam('boardId').
86
	 */
87
	public function get() {
88
		$board = $this->boardService->find($this->request->getParam('boardId'));
89
		return new DataResponse($board, HTTP::STATUS_OK);
90
	}
91
92
	/**
93
	 * @NoAdminRequired
94
	 * @CORS
95
	 * @NoCSRFRequired
96
	 *
97
	 * @params $title
98
	 * @params $color
99
	 *
100
	 * Create a board with the specified title and color.
101
	 */
102
	public function create($title, $color) {
103
		$board = $this->boardService->create($title, $this->userId, $color);
104
		return new DataResponse($board, HTTP::STATUS_OK);
105
	}
106
107
	/**
108
	 * @NoAdminRequired
109
	 * @CORS
110
	 * @NoCSRFRequired
111
	 *
112
	 * @params $title
113
	 * @params $color
114
	 * @params $archived
115
	 *
116
	 * Update a board with the specified boardId, title and color, and archived state.
117
	 */
118
	public function update($title, $color, $archived = false) {
119
		$board = $this->boardService->update($this->request->getParam('boardId'), $title, $color, $archived);
120
		return new DataResponse($board, HTTP::STATUS_OK);
121
	}
122
123
	/**
124
	 * @NoAdminRequired
125
	 * @CORS
126
	 * @NoCSRFRequired
127
	 *
128
	 *
129
	 * Delete the board specified by $boardId.  Return the board that was deleted.
130
	 */
131
	public function delete() {
132
		$board = $this->boardService->delete($this->request->getParam('boardId'));
133
		return new DataResponse($board, HTTP::STATUS_OK);
134
	}
135
136
	/**
137
	 * @NoAdminRequired
138
	 * @CORS
139
	 * @NoCSRFRequired
140
	 *
141
	 *
142
	 * Undo the deletion of the board specified by $boardId.
143
	 */
144
	public function undoDelete() {
145
		$board = $this->boardService->deleteUndo($this->request->getParam('boardId'));
146
		return new DataResponse($board, HTTP::STATUS_OK);
147
	}
148
149
	/**
150
	 * @NoAdminRequired
151
	 * @CORS
152
	 * @NoCSRFRequired
153
	 */
154
	public function addAcl($boardId, $type, $participant, $permissionEdit, $permissionShare, $permissionManage) {
155
		$acl = $this->boardService->addAcl($boardId, $type, $participant, $permissionEdit, $permissionShare, $permissionManage);
156
		return new DataResponse($acl, HTTP::STATUS_OK);
157
	}
158
159
	/**
160
	 * @NoAdminRequired
161
	 * @CORS
162
	 * @NoCSRFRequired
163
	 */
164
	public function updateAcl($aclId, $permissionEdit, $permissionShare, $permissionManage) {
165
		$acl = $this->boardService->updateAcl($aclId, $permissionEdit, $permissionShare, $permissionManage);
166
		return new DataResponse($acl, HTTP::STATUS_OK);
167
	}
168
169
	/**
170
	 * @NoAdminRequired
171
	 * @CORS
172
	 * @NoCSRFRequired
173
	 */
174
	public function deleteAcl($aclId) {
175
		$acl = $this->boardService->deleteAcl($aclId);
176
		return new DataResponse($acl, HTTP::STATUS_OK);
177
	}
178
179
}
180