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 (4873)

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.

plugins/admindelegation/www/permissions.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
 * Copyright (c) STMicroelectronics, 2004-2009. All rights reserved
4
 *
5
 * This file is a part of Codendi.
6
 *
7
 * Codendi is free software; you can redistribute it and/or modify
8
 * it under the terms of the GNU General Public License as published by
9
 * the Free Software Foundation; either version 2 of the License, or
10
 * (at your option) any later version.
11
 *
12
 * Codendi is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License
18
 * along with Codendi. If not, see <http://www.gnu.org/licenses/>.
19
 */
20
21
require 'pre.php';
22
require_once dirname(__FILE__).'/../include/AdminDelegation_UserServiceManager.class.php';
23
24
// First, check plugin availability
25
$pluginManager = PluginManager::instance();
26
$p = $pluginManager->getPluginByName('admindelegation');
27
if (!$p || !$pluginManager->isPluginAvailable($p)) {
28
    header('Location: '.get_server_url());
29
}
30
31
// Grant access only to site admin
32
$um = UserManager::instance();
33
if (!$um->getCurrentUser()->isSuperUser()) {
34
    $GLOBALS['Response']->redirect($p->getPluginPath().'/permissions.php');
35
}
36
37
$usm = new AdminDelegation_UserServiceManager();
38
39
if ($request->isPost()) {
40
    $vFunc = new Valid_WhiteList('func', array('grant_user_service', 'revoke_user', 'revoke_user_service'));
41
    $vFunc->required();
42
    if ($request->valid($vFunc)) {
43
        $func = $request->get('func');
44
    } else {
45
        $func = '';
46
    }
47
48
    switch ($func) {
49
        case 'grant_user_service':
50
            $vUser = new Valid_String('user_to_grant');
51
            $vUser->required();
52
            if ($request->valid($vUser)) {
53
                $user = $um->findUser($request->get('user_to_grant'));
54
            } else {
55
                $user = false;
56
            }
57
58
            $vService = new Valid_WhiteList('service', AdminDelegation_Service::getAllServices());
59
            $vService->required();
60
            if ($request->valid($vService)) {
61
                $service = $request->get('service');
62
            } else {
63
                $service = false;
64
            }
65
66
            if ($user && $service) {
67
                if ($usm->addUserService($user, $service)) {
68
                    $GLOBALS['Response']->addFeedback('info', 'Permission granted to user');
69
                } else {
70
                    $GLOBALS['Response']->addFeedback('error', 'Fail to grant permission to user');
71
                }
72
            } else {
73
                $GLOBALS['Response']->addFeedback('error', 'Either bad user or bad service');
74
            }
75
            break;
76
77
        case 'revoke_user':
78
            $vUser = new Valid_UInt('users_to_revoke');
79
            $vUser->required();
80
            if ($request->validArray($vUser)) {
81
                foreach ($request->get('users_to_revoke') as $userId) {
82
                    $user = $um->getUserById($userId);
83
                    if ($user) {
84
                        $usm->removeUser($user);
85
                    } else {
86
                        $GLOBALS['Response']->addFeedback('error', 'Bad user');
87
                    }
88
                }
89
            } else {
90
                $GLOBALS['Response']->addFeedback('error', 'Bad user');
91
            }
92
            break;
93
            
94
        case 'revoke_user_service':
95
            $vService = new Valid_WhiteList('plugin_admindelegation_service', AdminDelegation_Service::getAllServices());
96
            $vService->required();
97
            if ($request->valid($vService)){
98
                $serviceId = $request->get('plugin_admindelegation_service');
99
            } 
100
            $vUser = new Valid_UInt('users_to_revoke');
101
            $vUser->required();
102
            if ($request->validArray($vUser)) {
103
                foreach ($request->get('users_to_revoke') as $userId) {
104
                    $user = $um->getUserById($userId);
105
                    if ($user) {
106
                        $usm->removeUserService($user, $serviceId);
107
                    } else {
108
                        $GLOBALS['Response']->addFeedback('error', 'Bad user');
109
                    }
110
                }
111
            } else {
112
                $GLOBALS['Response']->addFeedback('error', 'Bad user');
113
            }
114
            break;
115
116
        default:
117
            $GLOBALS['Response']->addFeedback('error', 'Bad action');
118
            break;
119
    }
120
    $GLOBALS['Response']->redirect($p->getPluginPath().'/permissions.php');
121
}
122
123
124
$GLOBALS['HTML']->header(array('title' => $GLOBALS['Language']->getText('plugin_admindelegation','permissions_page_title')));
125
echo '<h1>'.$GLOBALS['Language']->getText('plugin_admindelegation','permissions_page_title').'</h1>';
126
127
echo '<h2>'.$GLOBALS['Language']->getText('plugin_admindelegation','permissions_grant_user_title').'</h2>';
128
129
echo '<form method="post" action="?">';
130
echo $GLOBALS['Language']->getText('plugin_admindelegation','permissions_grant');
131
echo html_build_select_box_from_arrays(AdminDelegation_Service::getAllServices(), AdminDelegation_Service::getAllLabels(), 'service', 100, true);
0 ignored issues
show
Deprecated Code introduced by
The function html_build_select_box_from_arrays() has been deprecated with message: This function miss some purifications voluntary. Please, DO NOT USE it anymore !

This function has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.

Loading history...
132
echo '&nbsp;'.$GLOBALS['Language']->getText('plugin_admindelegation','permissions_to_user').'&nbsp;';
133
echo '<input type="hidden" name="func" value="grant_user_service" />';
134
echo '<input type="text" name="user_to_grant" value="'.$GLOBALS['Language']->getText('plugin_admindelegation','permissions_autocomplete').'" id="granted_user" />';
135
echo '&nbsp;';
136
echo '<input type="submit" value="'.$GLOBALS['Language']->getText('global', 'btn_apply').'"/>';
137
echo '</form>';
138
$js = "new UserAutoCompleter('granted_user', '".util_get_dir_image_theme()."', false);";
139
$GLOBALS['HTML']->includeFooterJavascriptSnippet($js);
140
141
$uh = UserHelper::instance();
142
$hp = Codendi_HTMLPurifier::instance();
143
144
echo '<h2>'.$GLOBALS['Language']->getText('plugin_admindelegation','permissions_granted_users_title').'</h2>';
145
echo '<form method="post" action="?">';
146
echo '<input type="hidden" name="func" value="revoke_user" />';
147
echo '<table border="1">';
148
echo '<thead>';
149
echo '<tr>';
150
echo '<th>&nbsp;</th>';
151
echo '<th>'.$GLOBALS['Language']->getText('plugin_admindelegation','permissions_user_col').'</th>';
152
echo '<th>'.$GLOBALS['Language']->getText('plugin_admindelegation','permissions_service_col').'</th>';
153
echo '</tr>';
154
echo '</thead>';
155
echo '<tbody>';
156
$prev = -1;
157
foreach ($usm->getGrantedUsers() as $row) {
158
    if ($row['user_id'] != $prev) {
159
        if ($prev != -1) {
160
            echo '</td></tr>';
161
        }
162
        echo '<tr>';
163
        echo '<td><input type="checkbox" name="users_to_revoke[]" value="'.$row['user_id'].'" /></td>';
164
        echo '<td>'.$hp->purify($uh->getDisplayNameFromUserId($row['user_id'])).'</td>';
165
        echo '<td>'.AdminDelegation_Service::getLabel($row['service_id']);
166
    } else {
167
        echo ', '.AdminDelegation_Service::getLabel($row['service_id']);
168
    }
169
    $prev = $row['user_id'];
170
}
171
echo '</tbody>';
172
echo '</table>';
173
echo '<input type="submit" value="'.$GLOBALS['Language']->getText('global', 'btn_delete').'"/>';
174
echo '</form>';
175
176
foreach (AdminDelegation_Service::getAllServices() as $serviceId) {
177
    displayDeleteUserPerService($usm, $uh, $serviceId);
178
}
179
180
$GLOBALS['HTML']->footer(array());
181
182
/*
183
 * 
184
 */
185
function displayDeleteUserPerService($usm, $uh, $serviceId) {
186
187
    $hp = Codendi_HTMLPurifier::instance();
188
189
    $userDar = $usm->getGrantedUsersForService($serviceId);
190
191
    echo '<h2>'.$GLOBALS['Language']->getText('plugin_admindelegation','permissions_granted_users_service_title',array(AdminDelegation_Service::getLabel($serviceId))).'</h2>';
192
    if ($userDar && !$userDar->isError() && ($userDar->rowCount() > 0)) {
193
194
        echo '<form method="post" action="?">';
195
        echo '<input type="hidden" name="func" value="revoke_user_service" />';
196
        echo '<input type="hidden" name="plugin_admindelegation_service" value="'.$serviceId.'"/>';
197
        echo '<table border="1">';
198
        echo '<thead>';
199
        echo '<tr>';
200
        echo '<th>&nbsp;</th>';
201
        echo '<th>'.$GLOBALS['Language']->getText('plugin_admindelegation','permissions_user_col').'</th>';
202
        echo '</tr>';
203
        echo '</thead>';
204
        echo '<tbody>';
205
206
        foreach ($userDar as $row) {
207
            echo '<tr><td><input type="checkbox" name="users_to_revoke[]" value="'.$row['user_id'].'" /></td>';
208
            echo '<td>'.$hp->purify($uh->getDisplayNameFromUserId($row['user_id'])).'</td></tr>';
209
        }
210
        echo '</tbody>';
211
        echo '</table>';
212
        echo '<input type="submit" value="'.$GLOBALS['Language']->getText('global', 'btn_delete').'"/>';
213
        echo '</form>';
214
    }
215
216
}
217
218
?>