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.

src/common/include/CSRFSynchronizerToken.class.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) Enalean, 2011. All Rights Reserved.
4
 *
5
 * This file is a part of Tuleap.
6
 *
7
 * Tuleap 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
 * Tuleap 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 Tuleap. If not, see <http://www.gnu.org/licenses/>.
19
 */
20
21
require_once('common/include/Codendi_HTMLPurifier.class.php');
22
23
/**
24
 * Class CSRFSynchronizerToken
25
 * 
26
 * This class deals with a CSRF countermeasure. Usage:
27
 *
28
 * In a html form, add a token:
29
 * <pre>
30
 *   echo '<form ...>';
31
 *   $token = new CSRFSynchronizerToken('/path/of/my/page');
32
 *   echo $token->fetchHTMLInput();
33
 * </pre>
34
 *
35
 * Then in the target page, which deals with sensitive data, check that the token is valid
36
 * <pre>
37
 *   $request = HTTPRequest::instance();
38
 *   $token = new CSRFSynchronizerToken('/path/of/my/page');
39
 *   $token->check();
40
 *   // ... continue in a safe way
41
 * </pre>
42
 *
43
 * That's it!
44
 */
45
class CSRFSynchronizerToken {
46
    
47
    const PREF_NAME_PREFIX = 'synchronizer_token_';
48
    
49
    const DEFAULT_TOKEN_NAME = 'challenge';
50
    
51
    /**
52
     * @var string a pseudorandom generated token
53
     */
54
    protected $token;
55
    
56
    /**
57
     * @var string the url the token is refering to
58
     */
59
    protected $url;
60
    
61
    /**
62
     * @var string the name of the token (to retrieve in the request)
63
     */
64
    protected $token_name;
65
    
66
    /**
67
     * Generate a token for the $url
68
     *
69
     * Generate a challenge token to prevent CSRF attacks.
70
     *
71
     * The pseudorandom generated token must be put in an hidden field in a form.
72
     * If the form as method=POST it is better. Use this for sensitive server-side operations (admin, preferences, ...)
73
     *
74
     * /!\ using this method for anonymous user is just silly (although it doesn't raise any error)
75
     *
76
     * @see https://www.owasp.org/index.php/Cross-Site_Request_Forgery_%28CSRF%29
77
     *
78
     * @param string $url         The url of the page (take it as a 'salt'). The token is uniq for (url, user session)
79
     * @param string $token_name  The name of the token in the request. default is 'challenge'
80
     *
81
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
82
     */
83
    public function __construct($url, $token_name = self::DEFAULT_TOKEN_NAME) {
84
        $this->url        = $url;
85
        $this->token_name = $token_name;
86
        
87
        //generation of the token
88
        $salt = $this->url . $this->getUser()->getSessionHash();
89
        $this->token = $this->getUser()->getPreference(self::PREF_NAME_PREFIX . $salt);
90
        if (!$this->token) {
91
            $this->token = md5(uniqid(rand(), true) . $salt);
92
            $this->getUser()->setPreference(self::PREF_NAME_PREFIX . $salt, $this->token);
93
        }
94
    }
95
    
96
    /**
97
     * Check that a challenge token is valid.
98
     * @see Constructor
99
     *
100
     * @param string $token The token to check against what is stored in the user session
101
     *
102
     * @return bool true if token valid, false otherwise
103
     */
104
    public function isValid($token) {
105
        return $this->token === $token;
106
    }
107
    
108
    /**
109
     * Redirect to somewhere else if the token in request is not valid
110
     *
111
     * @param Codendi_Request $request     The request object, if null then use HTTPRequest
112
     * @param string          $redirect_to Url to be redirected to in case of error. if null then use $url instead. Default is null
113
     *
114
     * @return void
115
     */
116
    public function check($redirect_to = null, $request = null) {
117
        if (!$request) {
118
            $request = HTTPRequest::instance();
119
        }
120
        if (!$request->existAndNonEmpty($this->token_name) || !$this->isValid($request->get($this->token_name))) {
121
           $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('global', 'error_synchronizertoken'));
122
           $GLOBALS['Response']->redirect($redirect_to === null ? $this->url : $redirect_to);
123
       }
124
    }
125
    
126
    /**
127
     * Fetch HTML input (hidden) to be included in a form to protect the user against CSRF
128
     *
129
     * @return string html
130
     */
131
    public function fetchHTMLInput() {
132
        $hp = Codendi_HTMLPurifier::instance();
133
        return '<input type="hidden" name="'. $hp->purify($this->token_name, CODENDI_PURIFIER_CONVERT_HTML) .'" value="'. $hp->purify($this->token, CODENDI_PURIFIER_CONVERT_HTML) .'" />';
134
    }
135
    
136
    /**
137
     * @return string The token
138
     */
139
    public function getToken() {
140
        return $this->token;
141
    }
142
    
143
    /**
144
     * @return string The token name
145
     */
146
    public function getTokenName() {
147
        return $this->token_name;
148
    }
149
    
150
    /**
151
     * @return PFUser
152
     */
153
    protected function getUser() {
154
        return UserManager::instance()->getCurrentUser();
155
    }
156
}
157
?>
158