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/ldap/www/admin.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
/**
3
 * Copyright (c) STMicroelectronics, 2008. All Rights Reserved.
4
 *
5
 * Originally written by Manuel Vacelet, 2008
6
 *
7
 * This file is a part of Codendi.
8
 *
9
 * Codendi is free software; you can redistribute it and/or modify
10
 * it under the terms of the GNU General Public License as published by
11
 * the Free Software Foundation; either version 2 of the License, or
12
 * (at your option) any later version.
13
 *
14
 * Codendi is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with Codendi; if not, write to the Free Software
21
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22
 */
23
24
require_once 'pre.php';
25
require_once dirname(__FILE__).'/../include/LDAP_ProjectGroupManager.class.php';
26
require_once 'www/project/admin/project_admin_utils.php';
27
28
// Import very long user group may takes very long time.
29
ini_set('max_execution_time', 0);
30
31
$request = HTTPRequest::instance();
32
33
// Get group id
34
$vGroupId = new Valid_GroupId();
35
$vGroupId->required();
36
if(!$request->valid($vGroupId)) {
37
    exit_error($Language->getText('global','error'), 'No group_id');
38
}
39
$groupId = $request->get('group_id');
40
41
// Must be a project admin
42
session_require(array('group' => $groupId, 'admin_flags' => 'A'));
43
44
// Ensure LDAP plugin is active
45
$pluginManager = PluginManager::instance();
46
$ldapPlugin    = $pluginManager->getPluginByName('ldap');
47
if (!$ldapPlugin || !$pluginManager->isPluginAvailable($ldapPlugin)) {
48
    $GLOBALS['Response']->redirect('/project/admin/index.php?group_id='.$groupId);
49
}
50
51
// Check if user have choosen the preserve members option.
52
$bindOption = LDAP_GroupManager::BIND_OPTION;
53
if($request->exist('preserve_members') && $request->get('preserve_members') == 'on') {
54
    $bindOption = LDAP_GroupManager::PRESERVE_MEMBERS_OPTION;
55
}
56
57
// Check if user has checked the Synchronization option.
58
$synchro = LDAP_GroupManager::NO_SYNCHRONIZATION;
59
if($request->exist('synchronize') && $request->get('synchronize') == 'on') {
60
    $synchro = LDAP_GroupManager::AUTO_SYNCHRONIZATION;
61
}
62
63
// Get LDAP group name
64
$vLdapGroup = new Valid_String('ldap_group');
65
$vLdapGroup->required();
66
if($request->isPost() && $request->valid($vLdapGroup)) {
67
    $ldapGroupManager = new LDAP_ProjectGroupManager($ldapPlugin->getLdap());
68
    $ldapGroupManager->setId($groupId);
69
    $ldapGroupManager->setGroupName($request->get('ldap_group'));
70
71
    if($request->existAndNonEmpty('delete')) {
72
        //
73
        // Remove link between Project Members and LDAP Group
74
        //
75
        $ldapGroupManager->unbindFromBindLdap();
76
        $GLOBALS['Response']->redirect('/project/admin/index.php?group_id='.$groupId);
77
78
    } elseif($request->existAndNonEmpty('update')) {
79
        //
80
        // Perform Project Members <-> LDAP Group synchro
81
        //
82
        $ldapGroupManager->bindWithLdap($bindOption, $synchro);
83
        $GLOBALS['Response']->redirect('/project/admin/index.php?group_id='.$groupId);
84
85
    } elseif($request->exist('cancel')) {
86
        //
87
        // Cancel operations
88
        //        
89
        $GLOBALS['Response']->redirect('/project/admin/index.php?group_id='.$groupId);
90
91
    } else {
92
        //
93
        // Display to user what will be done with project members.
94
        //
95
        $toRemove    = $ldapGroupManager->getUsersToBeRemoved($bindOption);
96
        $toAdd       = $ldapGroupManager->getUsersToBeAdded($bindOption);
97
        $notImpacted = $ldapGroupManager->getUsersNotImpacted($bindOption);
98
99
        
100
        if(is_array($toAdd)) {
101
            // Display
102
            $um = UserManager::instance();
103
            $hp = Codendi_HTMLPurifier::instance();
104
            
105
            project_admin_header(array('title' => $GLOBALS['Language']->getText('plugin_ldap','project_members_synchro_title'), 'group' => $groupId));
106
            echo '<h1>'.$GLOBALS['Language']->getText('plugin_ldap','project_members_synchro_title').'</h1>';
107
108
            echo '<p>'.$GLOBALS['Language']->getText('plugin_ldap', 'project_members_synchro_warning').'</p>';
109
            echo '<p>'.$GLOBALS['Language']->getText('plugin_ldap', 'group_members_synchro_sumup', array(count($toRemove), count($toAdd), count($notImpacted))).'</p>';
110
111
            echo '<table width="100%">';
112
            echo '<tr><td width="50%" valign="top">';
113
114
            $GLOBALS['HTML']->box1_top($GLOBALS['Language']->getText('plugin_ldap', 'group_members_synchro_to_remove', array(count($toRemove))));
115
            echo '<ul>';
116
            foreach ($toRemove as $userId) {
0 ignored issues
show
The expression $toRemove of type null|array is not guaranteed to be traversable. How about adding an additional type check?

There are different options of fixing this problem.

  1. If you want to be on the safe side, you can add an additional type-check:

    $collection = json_decode($data, true);
    if ( ! is_array($collection)) {
        throw new \RuntimeException('$collection must be an array.');
    }
    
    foreach ($collection as $item) { /** ... */ }
    
  2. If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:

    /** @var array $collection */
    $collection = json_decode($data, true);
    
    foreach ($collection as $item) { /** .. */ }
    
  3. Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.

Loading history...
117
                if (($user = $um->getUserById($userId))) {
118
                    echo '<li>'.$user->getRealName().' ('.$user->getUserName().')</li>';
119
                }
120
            }
121
            echo '</ul>';
122
            $GLOBALS['HTML']->box1_bottom();
123
124
            echo '</td><td width="50%"  valign="top">';
125
126
            $GLOBALS['HTML']->box1_top($GLOBALS['Language']->getText('plugin_ldap', 'group_members_synchro_to_add', array(count($toAdd))));
127
            echo '<ul>';
128
            foreach ($toAdd as $userId) {
129
                if (($user = $um->getUserById($userId))) {
130
                    echo '<li>'.$user->getRealName().' ('.$user->getUserName().')</li>';
131
                }
132
            }
133
            echo '</ul>';
134
            $GLOBALS['HTML']->box1_bottom();
135
136
            echo '</tr></td>';
137
            echo '<tr><td colspan="2" align="center">';
138
            echo '<form method="post" action="?group_id='.$groupId.'">';
139
            echo '<input type="hidden" name="ldap_group" value="'.$hp->purify($request->get('ldap_group')).'" />';
140
            echo '<input type="hidden" name="confirm" value="yes" />';
141
            if($bindOption == 'preserve_members') {
142
                echo '<input type="hidden" name="preserve_members" value="on" />';
143
            }
144
            echo '<input type="submit" name="cancel" value="'.$GLOBALS['Language']->getText('global', 'btn_cancel').'" />';
145
            echo '<input type="submit" name="update" value="'.$GLOBALS['Language']->getText('global', 'btn_update').'" />';
146
            echo '</form>';
147
            echo '</td></tr>';
148
            echo '</table>';
149
150
            project_admin_footer(array());
151
        } else {
152
            $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_ldap', 'invalid_ldap_group_name'));
153
            $GLOBALS['Response']->redirect('/project/admin/index.php?group_id='.$groupId);
154
        }
155
    }
156
} else {
157
    $GLOBALS['Response']->redirect('/project/admin/index.php?group_id='.$groupId);
158
}
159
?>