Issues (2)

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.

controller/notescontroller.php (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
<?php
2
/**
3
 * ownCloud - Notes
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the COPYING file.
7
 *
8
 * @author Bernhard Posselt <[email protected]>
9
 * @copyright Bernhard Posselt 2012, 2014
10
 */
11
12
namespace OCA\Notes\Controller;
13
14
use OCP\AppFramework\Controller;
15
use OCP\IRequest;
16
use OCP\IConfig;
17
use OCP\AppFramework\Http\DataResponse;
18
19
use OCA\Notes\Service\NotesService;
20
21
/**
22
 * Class NotesController
23
 *
24
 * @package OCA\Notes\Controller
25
 */
26
class NotesController extends Controller {
27
	use Errors;
28
29
	/** @var NotesService */
30
	private $notesService;
31
	/** @var IConfig */
32
	private $settings;
33
	/** @var string */
34
	private $userId;
35
36
	/**
37
	 * @param string $AppName
38
	 * @param IRequest $request
39
	 * @param NotesService $service
40
	 * @param IConfig $settings
41
	 * @param string $UserId
42
	 */
43 View Code Duplication
	public function __construct($AppName, IRequest $request,
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
44 8
								NotesService $service, IConfig $settings,
45
								$UserId) {
46
		parent::__construct($AppName, $request);
47 8
		$this->notesService = $service;
48 8
		$this->settings = $settings;
49 8
		$this->userId = $UserId;
50 8
	}
51 8
52
	/**
53
	 * @NoAdminRequired
54
	 */
55
	public function index() {
56
		return new DataResponse($this->notesService->getAll($this->userId));
57 1
	}
58 1
59
	/**
60
	 * @NoAdminRequired
61
	 *
62
	 * @param int $id
63
	 * @return DataResponse
64
	 */
65
	public function get($id) {
66
		// save the last viewed note
67
		$this->settings->setUserValue(
68 2
			$this->userId, $this->appName, 'notesLastViewedNote', $id
69
		);
70 2
71 2
		return $this->respond(function () use ($id) {
72 2
			return $this->notesService->get($id, $this->userId);
73
		});
74
	}
75 2
76 2
	/**
77
	 * @NoAdminRequired
78
	 *
79
	 * @param string $content
80
	 */
81
	public function create($content) {
82
		$note = $this->notesService->create($this->userId);
83
		$note = $this->notesService->update(
84
			$note->getId(), $content, $this->userId
85 1
		);
86 1
		return new DataResponse($note);
87 1
	}
88 1
89 1
	/**
90 1
	 * @NoAdminRequired
91
	 *
92
	 * @param int $id
93
	 * @param string $content
94
	 * @return DataResponse
95
	 */
96
	public function update($id, $content) {
97
		return $this->respond(function () use ($id, $content) {
98
			return $this->notesService->update($id, $content, $this->userId);
99
		});
100
	}
101 2
102
	/**
103 2
	 * @NoAdminRequired
104 2
	 *
105
	 * @param int $id
106
	 * @param boolean $favorite
107
	 * @return DataResponse
108
	 */
109
	public function favorite($id, $favorite) {
110
		return $this->respond(function () use ($id, $favorite) {
111
			return $this->notesService->favorite($id, $favorite, $this->userId);
112
		});
113
	}
114
115
	/**
116
	 * @NoAdminRequired
117
	 *
118
	 * @param int $id
119
	 * @return DataResponse
120
	 */
121
	public function destroy($id) {
122
		return $this->respond(function () use ($id) {
123
			$this->notesService->delete($id, $this->userId);
124
			return [];
125
		});
126
	}
127
}
128