Issues (8)

Security Analysis    no request data  

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/Schema/Grammars/PostgresGrammar.php (8 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 namespace Bosnadev\Database\Schema\Grammars;
2
3
use Illuminate\Support\Fluent;
4
use Bosnadev\Database\Schema\Blueprint;
5
6
/**
7
 * Class PostgresGrammar
8
 * @package Bosnadev\Database\Schema\Grammars
9
 */
10
class PostgresGrammar extends \Illuminate\Database\Schema\Grammars\PostgresGrammar
11
{
12
    /**
13
     * Create the column definition for a character type.
14
     *
15
     * @param Fluent $column
16
     * @return string
17
     */
18 3
    protected function typeCharacter(Fluent $column)
19
    {
20 3
        return "character({$column->length})";
21
    }
22
23
    /**
24
     * Create the column definition for a hstore type.
25
     *
26
     * @param Fluent $column
27
     * @return string
28
     */
29 3
    protected function typeHstore(Fluent $column)
0 ignored issues
show
The parameter $column is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
30
    {
31 3
        return "hstore";
32
    }
33
34
    /**
35
     * Create the column definition for a uuid type.
36
     *
37
     * @param Fluent $column
38
     * @return string
39
     */
40 3
    protected function typeUuid(Fluent $column)
41
    {
42 3
        return "uuid";
43
    }
44
45
    /**
46
     * Create the column definition for a jsonb type.
47
     *
48
     * @param Fluent $column
49
     * @return string
50
     */
51 3
    protected function typeJsonb(Fluent $column)
52
    {
53 3
        return "jsonb";
54
    }
55
56
    /**
57
     * Create the column definition for an int4range type.
58
     *
59
     * @param Fluent $column
60
     *
61
     * @return string
62
     */
63 3
    protected function typeInt4range(Fluent $column)
0 ignored issues
show
The parameter $column is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
64
    {
65 3
        return "int4range";
66
    }
67
68
    /**
69
     * Create the column definition for an int8range type.
70
     *
71
     * @param Fluent $column
72
     *
73
     * @return string
74
     */
75 3
    protected function typeInt8range(Fluent $column)
0 ignored issues
show
The parameter $column is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
76
    {
77 3
        return "int8range";
78
    }
79
80
    /**
81
     * Create the column definition for an numrange type.
82
     *
83
     * @param Fluent $column
84
     *
85
     * @return string
86
     */
87 3
    protected function typeNumrange(Fluent $column)
0 ignored issues
show
The parameter $column is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
88
    {
89 3
        return "numrange";
90
    }
91
92
    /**
93
     * Create the column definition for an tsrange type.
94
     *
95
     * @param Fluent $column
96
     *
97
     * @return string
98
     */
99 3
    protected function typeTsrange(Fluent $column)
0 ignored issues
show
The parameter $column is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
100
    {
101 3
        return "tsrange";
102
    }
103
104
    /**
105
     * Create the column definition for an tstzrange type.
106
     *
107
     * @param Fluent $column
108
     *
109
     * @return string
110
     */
111 3
    protected function typeTstzrange(Fluent $column)
0 ignored issues
show
The parameter $column is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
112
    {
113 3
        return "tstzrange";
114
    }
115
116
    /**
117
     * Create the column definition for an daterange type.
118
     *
119
     * @param Fluent $column
120
     *
121
     * @return string
122
     */
123 3
    protected function typeDaterange(Fluent $column)
0 ignored issues
show
The parameter $column is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
124
    {
125 3
        return "daterange";
126
    }
127
128
    /**
129
     * Create the column definition for an inet type.
130
     *
131
     * @param Fluent $column
132
     *
133
     * @return string
134
     */
135
    protected function typeInet(Fluent $column)
0 ignored issues
show
The parameter $column is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
136
    {
137
        return "inet";
138
    }
139
140
    /**
141
     * @param mixed $value
142
     * @return mixed|string
143
     */
144
    protected function getDefaultValue($value)
145
    {
146
        if($this->isUuid($value)) return strval($value);
147
148
        return parent::getDefaultValue($value);
149
    }
150
151
    /**
152
     * Check if string matches on of uuid_generate functions
153
     *
154
     * @param $value
155
     * @return int
156
     */
157
    protected function isUuid($value)
158
    {
159
        return preg_match('/^uuid_generate_v/', $value);
160
    }
161
162
    /**
163
     * Compile a gin index key command.
164
     *
165
     * @param  \Bosnadev\Database\Schema\Blueprint  $blueprint
166
     * @param  \Illuminate\Support\Fluent  $command
167
     * @return string
168
     */
169 3
    public function compileGin(Blueprint $blueprint, Fluent $command)
170
    {
171 3
        $columns = $this->columnize($command->columns);
172
173 3
        return sprintf('CREATE INDEX %s ON %s USING GIN(%s)', $command->index, $this->wrapTable($blueprint), $columns);
174
    }
175
}
176