GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (3)

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.

Controller/DefaultController.php (2 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
3
namespace Opensoft\RolloutBundle\Controller;
4
5
use Opensoft\RolloutBundle\Rollout\GroupDefinitionAwareRollout;
6
use Opensoft\RolloutBundle\Rollout\UserProviderInterface;
7
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
8
use Symfony\Component\HttpFoundation\RedirectResponse;
9
use Symfony\Component\HttpFoundation\Request;
10
use Symfony\Component\HttpFoundation\Response;
11
12
/**
13
 * @author Richard Fullmer <[email protected]>
14
 */
15
class DefaultController extends AbstractController
16
{
17
    /**
18
     * @var GroupDefinitionAwareRollout
19
     */
20
    private $rollout;
21
22
    /**
23
     * @var UserProviderInterface
24
     */
25
    private $userProvider;
26
27
    /**
28
     * @param GroupDefinitionAwareRollout $rollout
29
     * @param UserProviderInterface $userProvider
30
     */
31
    public function __construct(GroupDefinitionAwareRollout $rollout, UserProviderInterface $userProvider)
32
    {
33
        $this->rollout = $rollout;
34
        $this->userProvider = $userProvider;
35
    }
36
37
    /**
38
     * @return Response
39
     */
40
    public function indexAction()
41
    {
42
        return $this->render('@OpensoftRollout/Default/index.html.twig', array('rollout' => $this->rollout));
43
    }
44
45
    /**
46
     * @param string $feature
47
     *
48
     * @return RedirectResponse
49
     */
50
    public function activateAction($feature)
51
    {
52
        $this->rollout->activate($feature);
53
54
        $this->addFlash('success', sprintf("Feature '%s' is now globally activated", $feature));
55
56
        return $this->redirectToRoute('opensoft_rollout');
57
    }
58
59
    /**
60
     * @param string $feature
61
     *
62
     * @return RedirectResponse
63
     */
64
    public function deactivateAction($feature)
65
    {
66
        $this->rollout->deactivate($feature);
67
68
        $this->addFlash('danger', sprintf("Feature '%s' is now globally deactivated", $feature));
69
70
        return $this->redirectToRoute('opensoft_rollout');
71
    }
72
73
    /**
74
     * @param string $feature
75
     *
76
     * @return RedirectResponse
77
     */
78
    public function incrementPercentageAction($feature)
79
    {
80
        return $this->changePercentage($feature, 10);
81
    }
82
83
    /**
84
     * @param string $feature
85
     *
86
     * @return RedirectResponse
87
     */
88
    public function decrementPercentageAction($feature)
89
    {
90
        return $this->changePercentage($feature, -10);
91
    }
92
93
    /**
94
     * @param string $feature
95
     * @param string $group
96
     *
97
     * @return RedirectResponse
98
     */
99
    public function activateGroupAction($feature, $group)
100
    {
101
        $this->rollout->activateGroup($feature, $group);
102
103
        $this->addFlash('info', sprintf("Feature '%s' is now active in group '%s'", $feature, $group));
104
105
        return $this->redirectToRoute('opensoft_rollout');
106
    }
107
108
    /**
109
     * @param string $feature
110
     * @param string $group
111
     *
112
     * @return RedirectResponse
113
     */
114
    public function deactivateGroupAction($feature, $group)
115
    {
116
        $this->rollout->deactivateGroup($feature, $group);
117
118
        $this->addFlash('info', sprintf("Feature '%s' is no longer active in group '%s'", $feature, $group));
119
120
        return $this->redirectToRoute('opensoft_rollout');
121
    }
122
123
    /**
124
     * @param Request $request
125
     * @param string $feature
126
     *
127
     * @return RedirectResponse
128
     */
129 View Code Duplication
    public function activateUserAction(Request $request, $feature)
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...
130
    {
131
        $requestUser = $request->get('user');
132
        $user = $this->userProvider->findByRolloutIdentifier($requestUser);
133
134
        if ($user) {
135
            $this->rollout->activateUser($feature, $user);
136
137
            $this->addFlash(
138
                'info',
139
                sprintf(
140
                    "User '%s' was activated in feature '%s'",
141
                    $user->getRolloutIdentifier(),
142
                    $feature
143
                )
144
            );
145
        } else {
146
            $this->addFlash('danger', sprintf("User '%s' not found", $requestUser));
147
        }
148
149
        return $this->redirectToRoute('opensoft_rollout');
150
    }
151
152
    /**
153
     * @param string $feature
154
     * @param string $id
155
     *
156
     * @return RedirectResponse
157
     */
158 View Code Duplication
    public function deactivateUserAction($feature, $id)
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...
159
    {
160
        $user = $this->userProvider->findByRolloutIdentifier($id);
161
162
        if ($user) {
163
            $this->rollout->deactivateUser($feature, $user);
164
165
            $this->addFlash(
166
                'info',
167
                sprintf(
168
                    "User '%s' was deactivated from feature '%s'",
169
                    $user->getRolloutIdentifier(),
170
                    $feature
171
                )
172
            );
173
        } else {
174
            $this->addFlash('danger', sprintf("User '%s' not found", $id));
175
        }
176
177
        return $this->redirectToRoute('opensoft_rollout');
178
    }
179
180
    /**
181
     * @param string $feature
182
     *
183
     * @return RedirectResponse
184
     */
185
    public function removeAction($feature)
186
    {
187
        $this->rollout->remove($feature);
188
189
        $this->addFlash('info', sprintf("Feature '%s' was removed from rollout.", $feature));
190
191
        return $this->redirectToRoute('opensoft_rollout');
192
    }
193
194
    /**
195
     * @param Request $request
196
     * @param string $feature
197
     *
198
     * @return RedirectResponse
199
     */
200
    public function setRequestParamAction(Request $request, $feature)
201
    {
202
        $requestParam = $request->get('requestParam');
203
204
        if ($requestParam === null) {
205
            $this->addFlash('danger', 'Missing "requestParam" value');
206
207
            return $this->redirectToRoute('opensoft_rollout');
208
        }
209
210
        $this->rollout->activateRequestParam($feature, $requestParam);
211
212
        $this->addFlash('info', sprintf('Feature "%s" requestParam changed to "%s"', $feature, $requestParam));
213
214
        return $this->redirectToRoute('opensoft_rollout');
215
    }
216
217
    /**
218
     * Abstract out common functionality
219
     *
220
     * @param string $feature
221
     * @param int $increment
222
     *
223
     * @return RedirectResponse
224
     */
225
    private function changePercentage($feature, $increment)
226
    {
227
        $percentage = $this->rollout->get($feature)->getPercentage() + $increment;
228
        $this->rollout->activatePercentage($feature, $percentage);
229
230
        $this->addFlash('info', sprintf("Feature '%s' percentage changed to %d%% of all users", $feature, $percentage));
231
232
        return $this->redirectToRoute('opensoft_rollout');
233
    }
234
}
235