Issues (83)

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.

lib/GitHub/Receiver/Issues.php (5 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
<?php
2
namespace FlexyProject\GitHub\Receiver;
3
4
use DateTime;
5
use FlexyProject\GitHub\AbstractApi;
6
use Symfony\Component\HttpFoundation\Request;
7
8
/**
9
 * This class provides access to Issues API.
10
 *
11
 * @link    https://developer.github.com/v3/issues/
12
 * @package FlexyProject\GitHub\Receiver
13
 */
14
class Issues extends AbstractReceiver
15
{
16
17
    /** Available sub-Receiver */
18
    const ASSIGNEES  = 'Assignees';
19
    const COMMENTS   = 'Comments';
20
    const EVENTS     = 'Events';
21
    const LABELS     = 'Labels';
22
    const MILESTONES = 'Milestones';
23
24
    /**
25
     * List issues
26
     *
27
     * @link https://developer.github.com/v3/issues/#list-issues
28
     *
29
     * @param string $filter
30
     * @param string $state
31
     * @param string $labels
32
     * @param string $sort
33
     * @param string $direction
34
     * @param string $since
35
     *
36
     * @return array
37
     */
38 View Code Duplication
    public function listIssues(string $filter = AbstractApi::FILTER_ASSIGNED, string $state = AbstractApi::STATE_OPEN,
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...
39
                               string $labels = '', string $sort = AbstractApi::SORT_CREATED,
40
                               string $direction = AbstractApi::DIRECTION_DESC, string $since = '1970-01-01'): array
41
    {
42
        return $this->getApi()->request($this->getApi()->sprintf('/issues?:args', http_build_query([
43
                'filter'    => $filter,
44
                'state'     => $state,
45
                'labels'    => $labels,
46
                'sort'      => $sort,
47
                'direction' => $direction,
48
                'since'     => (new DateTime($since))->format(DateTime::ATOM)
49
            ])));
50
    }
51
52
    /**
53
     * List all issues across owned and member repositories for the authenticated user
54
     *
55
     * @link https://developer.github.com/v3/issues/#list-issues
56
     *
57
     * @param string $filter
58
     * @param string $state
59
     * @param string $labels
60
     * @param string $sort
61
     * @param string $direction
62
     * @param string $since
63
     *
64
     * @return array
65
     */
66 View Code Duplication
    public function listUserIssues(string $filter = AbstractApi::FILTER_ASSIGNED,
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...
67
                                   string $state = AbstractApi::STATE_OPEN, string $labels = '',
68
                                   string $sort = AbstractApi::SORT_CREATED,
69
                                   string $direction = AbstractApi::DIRECTION_DESC, string $since = '1970-01-01'): array
70
    {
71
        return $this->getApi()->request($this->getApi()->sprintf('/user/issues?:args', http_build_query([
72
                'filter'    => $filter,
73
                'state'     => $state,
74
                'labels'    => $labels,
75
                'sort'      => $sort,
76
                'direction' => $direction,
77
                'since'     => (new DateTime($since))->format(DateTime::ATOM)
78
            ])));
79
    }
80
81
    /**
82
     * List all issues for a given organization for the authenticated user
83
     *
84
     * @link https://developer.github.com/v3/issues/#list-issues
85
     *
86
     * @param string $organization
87
     * @param string $filter
88
     * @param string $state
89
     * @param string $labels
90
     * @param string $sort
91
     * @param string $direction
92
     * @param string $since
93
     *
94
     * @return array
95
     */
96 View Code Duplication
    public function listOrganizationIssues(string $organization, string $filter = AbstractApi::FILTER_ASSIGNED,
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...
97
                                           string $state = AbstractApi::STATE_OPEN, string $labels = '',
98
                                           string $sort = AbstractApi::SORT_CREATED,
99
                                           string $direction = AbstractApi::DIRECTION_DESC,
100
                                           string $since = '1970-01-01'): array
101
    {
102
        return $this->getApi()->request($this->getApi()
103
                                             ->sprintf('/orgs/:org/issues?:args', $organization, http_build_query([
104
                                                     'filter'    => $filter,
105
                                                     'state'     => $state,
106
                                                     'labels'    => $labels,
107
                                                     'sort'      => $sort,
108
                                                     'direction' => $direction,
109
                                                     'since'     => (new DateTime($since))->format(DateTime::ATOM)
110
                                                 ])));
111
    }
112
113
    /**
114
     * List issues for a repository
115
     *
116
     * @link https://developer.github.com/v3/issues/#list-issues-for-a-repository
117
     *
118
     * @param string $milestone
119
     * @param string $state
120
     * @param string $assignee
121
     * @param string $creator
122
     * @param string $mentioned
123
     * @param string $labels
124
     * @param string $sort
125
     * @param string $direction
126
     * @param string $since
127
     *
128
     * @return array
129
     */
130
    public function listRepositoryIssues(string $milestone = '*', string $state = AbstractApi::STATE_OPEN,
131
                                         string $assignee = '*', string $creator = '', string $mentioned = '',
132
                                         string $labels = '', string $sort = AbstractApi::SORT_CREATED,
133
                                         string $direction = AbstractApi::DIRECTION_DESC,
134
                                         string $since = '1970-01-01'): array
135
    {
136
        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues?:args', $this->getOwner(),
137
            $this->getRepo(), http_build_query([
138
                'milestone' => $milestone,
139
                'state'     => $state,
140
                'assignee'  => $assignee,
141
                'creator'   => $creator,
142
                'mentioned' => $mentioned,
143
                'labels'    => $labels,
144
                'sort'      => $sort,
145
                'direction' => $direction,
146
                'since'     => (new DateTime($since))->format(DateTime::ATOM)
147
            ])));
148
    }
149
150
    /**
151
     * Get a single issue
152
     *
153
     * @link https://developer.github.com/v3/issues/#get-a-single-issue
154
     *
155
     * @param int $number
156
     *
157
     * @return array
158
     */
159
    public function getIssue(int $number): array
160
    {
161
        return $this->getApi()->request($this->getApi()
162
                                             ->sprintf('/repos/:owner/:repo/issues/:number', $this->getOwner(),
163
                                                 $this->getRepo(), $number));
164
    }
165
166
    /**
167
     * Create an issue
168
     *
169
     * @link https://developer.github.com/v3/issues/#create-an-issue
170
     *
171
     * @param string $title
172
     * @param string $body
173
     * @param string $assignee
174
     * @param int    $milestone
175
     * @param array  $labels
176
     *
177
     * @return array
178
     */
179 View Code Duplication
    public function createIssue(string $title, string $body = '', string $assignee = '', int $milestone = 0,
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...
180
                                array $labels = []): array
181
    {
182
        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues', $this->getOwner(),
183
            $this->getRepo()), Request::METHOD_POST, [
184
                'title'     => $title,
185
                'body'      => $body,
186
                'assignee'  => $assignee,
187
                'milestone' => $milestone,
188
                'labels'    => $labels
189
            ]);
190
    }
191
192
    /**
193
     * Edit an issue
194
     *
195
     * @link https://developer.github.com/v3/issues/#edit-an-issue
196
     *
197
     * @param int    $number
198
     * @param string $title
199
     * @param string $body
200
     * @param string $assignee
201
     * @param int    $milestone
202
     * @param array  $labels
203
     *
204
     * @return array
205
     */
206 View Code Duplication
    public function editIssue(int $number, string $title = '', string $body = '', string $assignee = '',
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...
207
                              int $milestone = 0, array $labels = []): array
208
    {
209
        return $this->getApi()->request($this->getApi()
210
                                             ->sprintf('/repos/:owner/:repo/issues/:number', $this->getOwner(),
211
                                                 $this->getRepo(), $number), Request::METHOD_PATCH, [
212
                'title'     => $title,
213
                'body'      => $body,
214
                'assignee'  => $assignee,
215
                'milestone' => $milestone,
216
                'labels'    => $labels
217
            ]);
218
    }
219
}