Issues (52)

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.

Setup/InstallSchema.php (2 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
namespace Stockbase\Integration\Setup;
5
6
use Magento\Framework\DB\Adapter\AdapterInterface;
7
use Magento\Framework\Setup\InstallSchemaInterface;
8
use Magento\Framework\Setup\ModuleContextInterface;
9
use Magento\Framework\Setup\SchemaSetupInterface;
10
use Magento\Framework\DB\Ddl\Table;
11
12
/**
13
 * @author Vitaly Zilnik <[email protected]>
14
 */
15
class InstallSchema implements InstallSchemaInterface
16
{
17
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
22
    {
23
        $setup->startSetup();
24
25
        $tableName = $setup->getTable('stockbase_stock');
26
        if (!$setup->getConnection()->isTableExists($tableName)) {
27
            $table = $setup->getConnection()
28
                ->newTable($tableName)
29
                ->setComment('Stockbase stock index')
30
                ->addColumn(
31
                    'ean',
32
                    Table::TYPE_BIGINT,
33
                    null,
34
                    ['identity' => false, 'unsigned' => true, 'nullable' => false, 'primary' => true],
35
                    'International/European Article Number'
36
                )
37
                ->addColumn(
38
                    'brand',
39
                    Table::TYPE_TEXT,
40
                    255,
41
                    ['nullable' => false],
42
                    'Brand of the supplier'
43
                )
44
                ->addColumn(
45
                    'code',
46
                    Table::TYPE_TEXT,
47
                    255,
48
                    ['nullable' => false],
49
                    'Unique Stockbase code set for a brand'
50
                )
51
                ->addColumn(
52
                    'supplier_code',
53
                    Table::TYPE_TEXT,
54
                    255,
55
                    ['nullable' => true],
56
                    'Unique supplier code set for a supplier'
57
                )
58
                ->addColumn(
59
                    'supplier_gln',
60
                    Table::TYPE_TEXT,
61
                    255,
62
                    ['nullable' => true],
63
                    'GLN of the supplier'
64
                )
65
                ->addColumn(
66
                    'amount',
67
                    Table::TYPE_FLOAT,
68
                    null,
69
                    ['nullable' => false, 'default' => '0'],
70
                    'Available stock amount for sale'
71
                )
72
                ->addColumn(
73
                    'noos',
74
                    Table::TYPE_BOOLEAN,
75
                    null,
76
                    ['nullable' => false, 'default' => '0'],
77
                    'Never Out Of Stock'
78
                )
79
                ->addColumn(
80
                    'timestamp',
81
                    Table::TYPE_DATETIME,
82
                    null,
83
                    ['nullable' => false],
84
                    'Latest mutation timestamp'
85
                )
86
                ->addIndex(
87
                    $setup->getIdxName($tableName, ['amount']),
88
                    ['amount'],
89
                    ['type' => AdapterInterface::INDEX_TYPE_INDEX]
90
                )
91
                ->addIndex(
92
                    $setup->getIdxName($tableName, ['noos']),
93
                    ['noos'],
94
                    ['type' => AdapterInterface::INDEX_TYPE_INDEX]
95
                )
96
                ->addIndex(
97
                    $setup->getIdxName($tableName, ['timestamp']),
98
                    ['timestamp'],
99
                    ['type' => AdapterInterface::INDEX_TYPE_INDEX]
100
                );
101
102
            $setup->getConnection()->createTable($table);
103
        }
104
105
        $tableName = $setup->getTable('stockbase_stock_reserve');
106 View Code Duplication
        if (!$setup->getConnection()->isTableExists($tableName)) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
107
            $table = $setup->getConnection()
108
                ->newTable($tableName)
109
                ->setComment('Stockbase stock reserve')
110
                ->addColumn(
111
                    'id',
112
                    Table::TYPE_INTEGER,
113
                    null,
114
                    ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true],
115
                    'ID'
116
                )
117
                ->addColumn(
118
                    'ean',
119
                    Table::TYPE_BIGINT,
120
                    null,
121
                    ['unsigned' => true, 'nullable' => false],
122
                    'International/European Article Number'
123
                )
124
                ->addColumn(
125
                    'amount',
126
                    Table::TYPE_FLOAT,
127
                    null,
128
                    ['nullable' => false, 'default' => '0'],
129
                    'Reserved amount'
130
                )
131
                ->addColumn(
132
                    'magento_stock_amount',
133
                    Table::TYPE_FLOAT,
134
                    null,
135
                    ['nullable' => false, 'default' => '0'],
136
                    'Amount to subtract from Magento stock'
137
                )
138
                ->addColumn(
139
                    'quote_item_id',
140
                    Table::TYPE_INTEGER,
141
                    null,
142
                    ['unsigned' => true, 'nullable' => false],
143
                    'Quote Item ID'
144
                )
145
                ->addColumn(
146
                    'product_id',
147
                    Table::TYPE_INTEGER,
148
                    null,
149
                    ['unsigned' => true, 'nullable' => false],
150
                    'Product ID'
151
                )
152
                ->addColumn(
153
                    'order_item_id',
154
                    Table::TYPE_INTEGER,
155
                    null,
156
                    ['unsigned' => true, 'nullable' => true],
157
                    'Order Item ID'
158
                )
159
                ->addColumn(
160
                    'created_at',
161
                    Table::TYPE_DATETIME,
162
                    null,
163
                    ['nullable' => false],
164
                    'Created at'
165
                )
166
                ->addIndex(
167
                    $setup->getIdxName($tableName, ['ean']),
168
                    ['ean'],
169
                    ['type' => AdapterInterface::INDEX_TYPE_INDEX]
170
                )
171
                ->addIndex(
172
                    $setup->getIdxName($tableName, ['amount']),
173
                    ['amount'],
174
                    ['type' => AdapterInterface::INDEX_TYPE_INDEX]
175
                )
176
                ->addIndex(
177
                    $setup->getIdxName($tableName, ['quote_item_id']),
178
                    ['quote_item_id'],
179
                    ['type' => AdapterInterface::INDEX_TYPE_UNIQUE]
180
                )
181
                ->addIndex(
182
                    $setup->getIdxName($tableName, ['product_id']),
183
                    ['product_id'],
184
                    ['type' => AdapterInterface::INDEX_TYPE_INDEX]
185
                )
186
                ->addIndex(
187
                    $setup->getIdxName($tableName, ['order_item_id']),
188
                    ['order_item_id'],
189
                    ['type' => AdapterInterface::INDEX_TYPE_INDEX]
190
                );
191
192
            $setup->getConnection()->createTable($table);
193
        }
194
195
        $tableName = $setup->getTable('stockbase_ordered_item');
196 View Code Duplication
        if (!$setup->getConnection()->isTableExists($tableName)) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
197
            $table = $setup->getConnection()
198
                ->newTable($tableName)
199
                ->setComment('Stockbase orders')
200
                ->addColumn(
201
                    'id',
202
                    Table::TYPE_INTEGER,
203
                    null,
204
                    ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true],
205
                    'ID'
206
                )
207
                ->addColumn(
208
                    'order_id',
209
                    Table::TYPE_INTEGER,
210
                    null,
211
                    ['unsigned' => true, 'nullable' => true],
212
                    'Order Item ID'
213
                )
214
                ->addColumn(
215
                    'order_item_id',
216
                    Table::TYPE_INTEGER,
217
                    null,
218
                    ['unsigned' => true, 'nullable' => true],
219
                    'Order Item ID'
220
                )
221
                ->addColumn(
222
                    'product_id',
223
                    Table::TYPE_INTEGER,
224
                    null,
225
                    ['unsigned' => true, 'nullable' => false],
226
                    'Product ID'
227
                )
228
                ->addColumn(
229
                    'ean',
230
                    Table::TYPE_BIGINT,
231
                    null,
232
                    ['unsigned' => true, 'nullable' => false],
233
                    'International/European Article Number'
234
                )
235
                ->addColumn(
236
                    'amount',
237
                    Table::TYPE_FLOAT,
238
                    null,
239
                    ['nullable' => false, 'default' => '0'],
240
                    'Reserved amount'
241
                )
242
                ->addColumn(
243
                    'stockbase_guid',
244
                    Table::TYPE_TEXT,
245
                    36,
246
                    ['nullable' => true],
247
                    'Stockbase GUID'
248
                )
249
                ->addColumn(
250
                    'created_at',
251
                    Table::TYPE_DATETIME,
252
                    null,
253
                    ['nullable' => false],
254
                    'Created at'
255
                )
256
                ->addIndex(
257
                    $setup->getIdxName($tableName, ['order_id']),
258
                    ['order_id'],
259
                    ['type' => AdapterInterface::INDEX_TYPE_INDEX]
260
                )
261
                ->addIndex(
262
                    $setup->getIdxName($tableName, ['order_item_id']),
263
                    ['order_item_id'],
264
                    ['type' => AdapterInterface::INDEX_TYPE_INDEX]
265
                )
266
                ->addIndex(
267
                    $setup->getIdxName($tableName, ['product_id']),
268
                    ['product_id'],
269
                    ['type' => AdapterInterface::INDEX_TYPE_INDEX]
270
                )
271
                ->addIndex(
272
                    $setup->getIdxName($tableName, ['ean']),
273
                    ['ean'],
274
                    ['type' => AdapterInterface::INDEX_TYPE_INDEX]
275
                )
276
                ->addIndex(
277
                    $setup->getIdxName($tableName, ['amount']),
278
                    ['amount'],
279
                    ['type' => AdapterInterface::INDEX_TYPE_INDEX]
280
                );
281
282
            $setup->getConnection()->createTable($table);
283
        }
284
285
        $setup->endSetup();
286
    }
287
}
288