Issues (62)

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.

code/DataIntegrityTestInnoDB.php (4 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
4
class DataIntegrityTestInnoDB extends BuildTask
5
{
6
7
    /**
8
     * standard SS variable
9
     * @var String
10
     */
11
    protected $title = "Convert all tables to InnoDB.";
12
13
    /**
14
     * standard SS variable
15
     * @var String
16
     */
17
    protected $description = "Converts table to innoDB. CAREFUL: replaces all tables in Database to innoDB - not just the Silverstripe ones.";
18
19
    public function run($request)
20
    {
21
        ini_set('max_execution_time', 3000);
22
        $tables = DB::query('SHOW TABLE STATUS WHERE ENGINE <>  \'InnoDB\'');
23
        foreach ($tables as $table) {
24
            $table = $table["Name"];
25
            DB::alteration_message("Updating $table to innoDB", "created");
26
            $this->flushNow();
27
            $indexRows = DB::query("SHOW INDEX FROM \"$table\" WHERE Index_type = 'FULLTEXT'");
28
            unset($done);
29
            $done = array();
30
            foreach ($indexRows as $indexRow) {
31
                $key = $indexRow["Key_name"];
32
                if (!isset($done[$key])) {
33
                    DB::alteration_message("Deleting INDEX $key in $table (FullText Index)", "deleted");
34
                    $this->flushNow();
35
                    DB::query("ALTER TABLE \"$table\" DROP INDEX $key;");
36
                    $done[$key] = $key;
37
                }
38
            }
39
            $sql = "ALTER TABLE \"$table\" ENGINE=INNODB";
40
            DB::query($sql);
41
        }
42
        //$rows = DB::query("SHOW GLOBAL STATUS LIKE  'Innodb_page_size'");
43
        $currentInnoDBSetting = DB::query("SELECT @@innodb_buffer_pool_size as V;")->Value();
44
        $innoDBBufferUsed = DB::query("
45
46
SELECT (PagesData*PageSize)/POWER(1024,3) DataGB FROM
47
(SELECT variable_value PagesData
48
FROM information_schema.global_status
49
WHERE variable_name='Innodb_buffer_pool_pages_data') A,
50
(SELECT variable_value PageSize
51
FROM information_schema.global_status
52
WHERE variable_name='Innodb_page_size') B;
53
54
		")->value();
55
        $innoBDBufferRecommended = DB::query(
56
            "
57
SELECT CEILING(Total_InnoDB_Bytes*1.6/POWER(1024,3)) RIBPS FROM
58
 (SELECT SUM(data_length+index_length) Total_InnoDB_Bytes
59
 FROM information_schema.tables WHERE engine='InnoDB') A;
60
"
61
        )->value();
62
        DB::alteration_message("<hr /><hr /><hr /><hr /><hr /><hr /><hr />COMPLETED
63
		<br />
64
		Please check your MYSQL innodb_buffer_pool_size setting.
65
		It is currently using ".round($innoDBBufferUsed, 3)."G,
66
		but it should be set to ".round($innoBDBufferRecommended, 3)."G.
67
		The current setting is: ".round($currentInnoDBSetting / (1042 * 1024* 1024))."G
68
		<hr /><hr /><hr /><hr /><hr /><hr /><hr />");
69
    }
70
71
    private function flushNow()
72
    {
73
        // check that buffer is actually set before flushing
74
        if (ob_get_length()) {
75
            @ob_flush();
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
76
            @flush();
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
77
            @ob_end_flush();
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
78
        }
79
        @ob_start();
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
80
    }
81
}
82