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.

include/FullTextSearchWikiActions.class.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) Enalean, 2014. 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
/**
22
 * Class responsible to send requests to an indexation server
23
 */
24
class FullTextSearchWikiActions {
25
26
    /**
27
     * @var FullTextSearch_IIndexDocuments
28
     */
29
    private $client;
30
31
    /** @var ElasticSearch_1_2_RequestWikiDataFactory */
32
    private $request_data_factory;
33
34
    /** @var TruncateLevelLogger */
35
    private $logger;
36
37
    public function __construct(
38
        FullTextSearch_IIndexDocuments $client,
39
        ElasticSearch_1_2_RequestWikiDataFactory $request_data_factory,
40
        TruncateLevelLogger $logger
41
    ) {
42
        $this->client               = $client;
43
        $this->request_data_factory = $request_data_factory;
44
        $this->logger               = $logger;
45
    }
46
47
    private function indexOrUpdate($project_id, $wiki_page_id, $data) {
48
        try {
49
            $this->client->getIndexedElement($project_id, $wiki_page_id);
50
            $this->client->update($project_id, $wiki_page_id, $data);
51
52
        } catch (ElasticSearch_ElementNotIndexed $exception) {
53
            $this->client->index($project_id, $wiki_page_id, $data);
54
            return;
55
        }
56
    }
57
58
    public function checkProjectMappingExists($project_id) {
59
        $this->logger->debug('[Wiki] ElasticSearch: get the mapping for project #' . $project_id);
60
61
        return count($this->client->getMapping($project_id)) > 0;
62
    }
63
64
    public function initializeProjetMapping($project_id) {
65
        $this->logger->debug('[Wiki] ElasticSearch: initialize the mapping for project #' . $project_id);
66
67
        $this->client->setMapping(
68
            $project_id,
69
            $this->request_data_factory->getPUTMappingData($project_id)
70
        );
71
    }
72
73
    /**
74
     * Index a new wiki page
75
     *
76
     * @param WikiPage $wiki_page The wiki page
77
     */
78
    public function indexNewEmptyWikiPage(WikiPage $wiki_page) {
79
        $this->logger->debug('[Wiki] ElasticSearch: index new empty wiki page ' . $wiki_page->getPagename() . ' #' . $wiki_page->getId());
80
81
        $indexed_data = $this->request_data_factory->getIndexedWikiPageData($wiki_page);
82
83
        $this->client->index($wiki_page->getGid(), $wiki_page->getId(), $indexed_data);
84
    }
85
86
    /**
87
     * Index a new wiki page
88
     *
89
     * @param WikiPage $wiki_page The wiki page
90
     */
91
    public function indexWikiPage(WikiPage $wiki_page) {
92
        $this->logger->debug('[Wiki] ElasticSearch: index wiki page ' . $wiki_page->getPagename() . ' #' . $wiki_page->getId());
93
94
        $indexed_data = $this->request_data_factory->getIndexedWikiPageData($wiki_page);
95
96
        $this->client->index($wiki_page->getGid(), $wiki_page->getId(), $indexed_data);
97
    }
98
99
    /**
100
     * Remove an indexed wiki page
101
     *
102
     * @param WikiPage $wiki_page The item to delete
103
     */
104
    public function delete(WikiPage $wiki_page) {
105
        $this->logger->debug('[Wiki] ElasticSearch: delete wiki page ' . $wiki_page->getPagename() . ' #' . $wiki_page->getId());
106
107
        try{
108
            $this->client->getIndexedElement($wiki_page->getGid(), $wiki_page->getId());
109
            $this->client->delete($wiki_page->getGid(), $wiki_page->getId());
110
        } catch (ElasticSearch_ElementNotIndexed $exception) {
111
            $this->logger->debug('[Wiki] ElasticSearch: wiki page ' . $wiki_page->getPagename() . ' #' . $wiki_page->getId() . ' not indexed, nothing to delete');
112
            return;
113
        }
114
    }
115
116
    private function deleteForProject($project_id) {
117
        $this->logger->debug('[Wiki] ElasticSearch: deleting all project wiki pages #' . $project_id);
118
119
        try{
120
            $this->client->getIndexedType($project_id);
121
            $this->client->deleteType($project_id);
0 ignored issues
show
The method deleteType() does not exist on FullTextSearch_IIndexDocuments. Did you maybe mean delete()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
122
123
        } catch (ElasticSearch_TypeNotIndexed $exception) {
124
            $this->logger->debug('[Wiki] ElasticSearch: project #' . $project_id . ' not indexed, nothing to delete');
125
            return;
126
        }
127
    }
128
129
    /**
130
     *
131
     * @param WikiPage $wiki_page
132
     */
133
    public function updatePermissions(WikiPage $wiki_page) {
134
        $this->logger->debug('[Wiki] ElasticSearch: update permissions of wiki page ' . $wiki_page->getPagename() . ' #' . $wiki_page->getId());
135
136
        $update_data = array();
137
        $this->request_data_factory->setUpdatedData(
138
            $update_data,
139
            'permissions',
140
            $this->request_data_factory->getCurrentPermissions($wiki_page)
141
        );
142
143
        $this->indexOrUpdate($wiki_page->getGid(), $wiki_page->getId(), $update_data);
144
    }
145
146
    private function indexAllProjectWikiPages($project_id) {
147
        $indexable_pages = $this->getAllIndexablePagesForProject($project_id);
148
149
        foreach($indexable_pages as $indexable_page) {
150
            $this->indexWikiPage($indexable_page);
151
        }
152
    }
153
154
    protected function getAllIndexablePagesForProject($project_id) {
155
        $wiki_page = new WikiPage();
156
        return $wiki_page->getAllIndexablePages($project_id);
157
    }
158
159
    /**
160
     *
161
     * @param int $project_id
162
     */
163
    public function reIndexProjectWikiPages($project_id) {
164
        $this->deleteForProject($project_id);
165
        $this->initializeProjetMapping($project_id);
166
        $this->indexAllProjectWikiPages($project_id);
167
    }
168
}
169