Issues (174)

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.

migrations/M170304140437CreateUserTable.php (1 issue)

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
/**
4
 *  _   __ __ _____ _____ ___  ____  _____
5
 * | | / // // ___//_  _//   ||  __||_   _|
6
 * | |/ // /(__  )  / / / /| || |     | |
7
 * |___//_//____/  /_/ /_/ |_||_|     |_|
8
 * @link https://vistart.me/
9
 * @copyright Copyright (c) 2016 - 2017 vistart
10
 * @license https://vistart.me/license/
11
 */
12
13
namespace rhosocial\user\migrations;
14
15
use rhosocial\user\User;
16
17
/**
18
 * Create User Table.
19
 *
20
 * This migration is equivalent to:
21
 ```SQL 
22
CREATE TABLE `user` (
23
    `guid` varbinary(16) NOT NULL COMMENT 'User GUID',
24
    `id` varchar(16) COLLATE utf8_unicode_ci NOT NULL COMMENT 'User ID No.',
25
    `pass_hash` varchar(80) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Password Hash',
26
    `ip` varbinary(16) NOT NULL DEFAULT '0' COMMENT 'IP Address',
27
    `ip_type` tinyint(3) NOT NULL DEFAULT '4' COMMENT 'IP Address Type',
28
    `created_at` datetime NOT NULL DEFAULT '1970-01-01 00:00:00' COMMENT 'Created At',
29
    `updated_at` datetime NOT NULL DEFAULT '1970-01-01 00:00:00' COMMENT 'Updated At',
30
    `auth_key` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'Authentication Key',
31
    `access_token` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'Access Token',
32
    `password_reset_token` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'Password Reset Token',
33
    `status` tinyint(3) NOT NULL DEFAULT '1' COMMENT 'Status',
34
    `type` tinyint(3) NOT NULL DEFAULT '0' COMMENT 'Type',
35
    `source` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'Source',
36
    PRIMARY KEY (`guid`),
37
    UNIQUE KEY `user_id_unique` (`id`),
38
    KEY `user_auth_key_normal` (`auth_key`),
39
    KEY `user_access_token_normal` (`access_token`),
40
    KEY `user_password_reset_token_normal` (`password_reset_token`),
41
    KEY `user_created_at_normal` (`created_at`),
42
    KEY `user_status_normal` (`status`) USING BTREE,
43
    KEY `user_type_normal` (`type`) USING BTREE,
44
    KEY `user_source_normal` (`source`) USING BTREE
45
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='User';
46
```
47
 *
48
 * If you want to go back, please execute `yii migrate/to rhosocial\user\migrations\M170304140437CreateUserTable`,
49
 * instead of droping user table yourself.
50
 * Note: this execution will reverse all the migrations after this migration.
51
 * 
52
 * @version 1.0
53
 * @author vistart <[email protected]>
54
 */
55
class M170304140437CreateUserTable extends Migration
56
{
57
    public function up()
58
    {
59
        $tableOptions = null;
0 ignored issues
show
$tableOptions is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
60
        if ($this->db->driverName === 'mysql') {
61
            // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
62
            $tableOptions = "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='User'";
63
            $this->createTable(User::tableName(), [
64
                'guid' => $this->varbinary(16)->notNull()->comment('User GUID'),
65
                'id' => $this->varchar(16)->notNull()->collate('utf8_unicode_ci')->comment('User ID No.'),
66
                'pass_hash' => $this->varchar(80)->notNull()->collate('utf8_unicode_ci')->comment('Password Hash'),
67
                'ip' => $this->varbinary(16)->notNull()->defaultValue(0)->comment('IP Address'),
68
                'ip_type' => $this->tinyInteger(3)->unsigned()->notNull()->defaultValue(4)->comment('IP Address Type'),
69
                'created_at' => $this->dateTime()->notNull()->defaultValue('1970-01-01 00:00:00')->comment('Created At'),
70
                'updated_at' => $this->dateTime()->notNull()->defaultValue('1970-01-01 00:00:00')->comment('Updated At'),
71
                'auth_key' => $this->varchar(255)->notNull()->defaultValue('')->collate('utf8_unicode_ci')->comment('Authentication Key'),
72
                'access_token' => $this->varchar(255)->notNull()->defaultValue('')->collate('utf8_unicode_ci')->comment('Access Token'),
73
                'password_reset_token' => $this->varchar(255)->notNull()->defaultValue('')->collate('utf8_unicode_ci')->comment('Password Reset Token'),
74
                'status' => $this->tinyInteger(3)->unsigned()->notNull()->defaultValue(1)->comment('Status'),
75
                'type' => $this->tinyInteger(3)->unsigned()->notNull()->defaultValue(0)->comment('Type'),
76
                'source' => $this->varchar(255)->notNull()->defaultValue('')->collate('utf8_unicode_ci')->comment('Source'),
77
            ], $tableOptions);
78
        }
79
        $this->addPrimaryKey('user_guid_pk', User::tableName(), 'guid');
80
        $this->createIndex('user_id_unique', User::tableName(), 'id', true);
81
        $this->createIndex('user_auth_key_normal', User::tableName(), 'auth_key');
82
        $this->createIndex('user_access_token_normal', User::tableName(), 'access_token');
83
        $this->createIndex('user_password_reset_token_normal', User::tableName(), 'password_reset_token');
84
        $this->createIndex('user_created_at_normal', User::tableName(), 'created_at');
85
        $this->createIndex('user_status_normal', User::tableName(), 'status');
86
        $this->createIndex('user_type_normal', User::tableName(), 'type');
87
        $this->createIndex('user_source_normal', User::tableName(), 'source');
88
    }
89
90
    public function down()
91
    {
92
        $this->dropTable(User::tableName());
93
    }
94
95
    /*
96
    // Use safeUp/safeDown to run migration code within a transaction
97
    public function safeUp()
98
    {
99
    }
100
101
    public function safeDown()
102
    {
103
    }
104
    */
105
}
106