Issues (10)

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.

src/collections/Responses.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
namespace gossi\swagger\collections;
3
4
use gossi\swagger\parts\ExtensionPart;
5
use gossi\swagger\Response;
6
use phootwork\collection\CollectionUtils;
7
use phootwork\collection\Map;
8
use phootwork\lang\Arrayable;
9
use phootwork\lang\Text;
10
use gossi\swagger\AbstractModel;
11
12
class Responses extends AbstractModel implements Arrayable, \Iterator {
13
14
	use ExtensionPart;
15
16
	/** @var Map */
17
	private $responses;
18
19 13
	public function __construct($contents = []) {
20 13
		$this->parse($contents === null ? [] : $contents);
21 13
	}
22
23 13
	private function parse($contents) {
24 13
		$data = CollectionUtils::toMap($contents);
25
26
		// responses
27 13
		$this->responses = new Map();
28 13
		foreach ($data as $r => $response) {
29 7
			if (!Text::create($r)->startsWith('x-')) {
30 7
				$this->responses->set($r, new Response($r, $response));
31 7
			}
32 13
		}
33
34
		// extensions
35 13
		$this->parseExtensions($data);
36 13
	}
37
38 9
	public function toArray() {
39 9
		$responses = clone $this->responses;
40 9
		$responses->setAll($this->getExtensions());
41
42 9
		return CollectionUtils::toArrayRecursive($responses);
43
	}
44
45 1
	public function size() {
46 1
		return $this->responses->size();
47
	}
48
49
	/**
50
	 * Returns whether the given response exists
51
	 *
52
	 * @param string $code
53
	 * @return bool
54
	 */
55 1
	public function has($code) {
56 1
		return $this->responses->has($code);
57
	}
58
59
	/**
60
	 * Returns whether the given response exists
61
	 *
62
	 * @param Response $response
63
	 * @return bool
64
	 */
65 1
	public function contains(Response $response) {
66 1
		return $this->responses->contains($response);
67
	}
68
69
	/**
70
	 * Returns the reponse info for the given code
71
	 *
72
	 * @param string $code
73
	 * @return Response
74
	 */
75 2
	public function get($code) {
76 2
		if (!$this->responses->has($code)) {
77
			$this->responses->set($code, new Response($code));
78
		}
79
80 2
		return $this->responses->get($code);
81
	}
82
83
	/**
84
	 * Sets the response
85
	 *
86
	 * @param Response $code
0 ignored issues
show
There is no parameter named $code. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
87
	 */
88 9
	public function add(Response $response) {
89 9
		$this->responses->set($response->getCode(), $response);
90 1
	}
91
92
	/**
93
	 * Adds all responses from another responses collection. Will overwrite existing ones.
94
	 *
95
	 * @param Responses $responses
96
	 */
97
	public function addAll(Responses $responses) {
98
		foreach ($responses as $response) {
99
			$this->add($response);
100
		}
101
	}
102
103
	/**
104
	 * Removes the given repsonse
105
	 *
106
	 * @param string $code
107
	 */
108 1
	public function remove($code) {
109 1
		$this->responses->remove($code);
110 1
	}
111
112
	public function current() {
113
		return $this->responses->current();
114
	}
115
116
	public function key() {
117
		return $this->responses->key();
118
	}
119
120
	public function next() {
121
		return $this->responses->next();
122
	}
123
124
	public function rewind() {
125
		return $this->responses->rewind();
126
	}
127
128
	public function valid() {
129
		return $this->responses->valid();
130
	}
131
}
132