Issues (82)

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.

integration/ComplexStructure/ComplexTreeTest.php (1 issue)

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
namespace Maketok\DataMigration\IntegrationTest\ComplexStructure;
4
5
use Maketok\DataMigration\Action\ConfigInterface;
6
use Maketok\DataMigration\Action\Type\AssembleInput;
7
use Maketok\DataMigration\Action\Type\Dump;
8
use Maketok\DataMigration\Action\Type\ReverseMove;
9
use Maketok\DataMigration\ArrayMap;
10
use Maketok\DataMigration\Expression\HelperExpressionsProvider;
11
use Maketok\DataMigration\Expression\LanguageAdapter;
12
use Maketok\DataMigration\Input\ArrayInput;
13
use Maketok\DataMigration\QueueWorkflow;
14
use Maketok\DataMigration\Storage\Db\DBALMysqlResource;
15
use Maketok\DataMigration\Unit\SimpleBag;
16
use Maketok\DataMigration\Unit\Type\Unit;
17
use Maketok\DataMigration\Workflow\Result;
18
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
19
20
class ComplexTreeTest extends \PHPUnit_Extensions_Database_TestCase
0 ignored issues
show
The class ComplexTreeTest has a coupling between objects value of 20. Consider to reduce the number of dependencies under 13.
Loading history...
21
{
22
    /**
23
     * @var ConfigInterface
24
     */
25
    private $config;
26
    /**
27
     * @var DBALMysqlResource
28
     */
29
    private $resource;
30
    /**
31
     * @var \PDO
32
     */
33
    private $pdo;
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    protected function setUp()
39
    {
40
        $config = include dirname(__DIR__) . '/Storage/Db/assets/config.php';
41
        if (isset($config) && $config instanceof ConfigInterface) {
42
            $this->config = $config;
43
            $this->config['tmp_folder'] = __DIR__ . '/assets';
44
            $this->config['tmp_file_mask'] = 'tmp%2$s/%1$s.csv';
45
            $this->config['tmp_table_mask'] = 'tmp_%1$s_%2$s';
46
            $this->config['local_infile'] = true;
47
            $this->resource = new DBALMysqlResource($this->config);
48
            $ref1 = new \ReflectionProperty(get_class($this->resource->getConnection()), '_conn');
49
            $ref1->setAccessible(true);
50
            $this->pdo = $ref1->getValue($this->resource->getConnection());
51
        } else {
52
            throw new \Exception("Can't find config file.");
53
        }
54
55
        parent::setUp();
56
57
        // assert that 2 pdo's are same
58
        $pdo1 = $this->getConnection()->getConnection();
59
        $pdo2 = $ref1->getValue($this->resource->getConnection());
60
61
        $this->assertSame($pdo1, $pdo2);
62
    }
63
64
    public function tearDown()
65
    {
66
        parent::tearDown();
67
        $this->resource->close();
68
    }
69
70
    /**
71
     * @return LanguageAdapter
72
     */
73
    public function getLanguageAdapter()
74
    {
75
        $language = new ExpressionLanguage();
76
        $language->registerProvider(new HelperExpressionsProvider());
77
        return new LanguageAdapter($language);
78
    }
79
80
    /**
81
     * Set Up Schema
82
     */
83
    public static function setUpBeforeClass()
84
    {
85
        require_once __DIR__ . '/bootstrap.php';
86
    }
87
88
    /**
89
     * {@inheritdoc}
90
     */
91
    protected function getConnection()
92
    {
93
        if (isset($this->pdo)) {
94
            return $this->createDefaultDBConnection($this->pdo);
95
        }
96
        throw new \Exception("Can't find pdo in config.");
97
    }
98
99
    /**
100
     * {@inheritdoc}
101
     */
102
    protected function getDataSet()
103
    {
104
        return $this->createXMLDataSet(__DIR__ . '/assets/initialStructure.xml');
105
    }
106
107
    /**
108
     *           ===========order=========
109
     *          /      /      |          \
110
     *      invoice   item   shipment    address
111
     *         |    //    \\   |
112
     *         item        item
113
     *
114
     * | == parent-child
115
     * || == sibling
116
     */
117
    public function testExport1()
118
    {
119
        // SET THESE TO TRUE TO DEBUG
120
        $this->config['db_debug'] = false;
121
        $this->config['file_debug'] = false;
122
        //===========================
123
        $order = new Unit('order');
124
        $order->setMapping([]);
125
        $order->setReversedMapping([]);
126
        $invoice = new Unit('invoice');
127
        $invoice->setMapping([]);
128
        $shipment = new Unit('shipment');
129
        $shipment->setMapping([]);
130
        $address = new Unit('address');
131
        $address->setMapping([]);
132
        $orderItem = new Unit('order_item');
133
        $orderItem->setMapping([]);
134
        $invoiceItem = new Unit('invoice_item');
135
        $invoiceItem->setMapping([]);
136
        $shipmentItem = new Unit('shipment_item');
137
        $shipmentItem->setMapping([]);
138
139
        $invoiceItem->setParent($invoice);
140
        $invoice->setParent($order);
141
        $shipmentItem->setParent($shipment);
142
        $shipment->setParent($invoice);
143
        $address->setParent($order);
144
        $orderItem->setParent($order);
145
        $orderItem->addSibling($invoiceItem);
146
        $orderItem->addSibling($shipmentItem);
147
148
        $bag = new SimpleBag();
149
        $bag->addSet([$order, $invoice, $shipment, $address, $orderItem, $invoiceItem, $shipmentItem]);
150
151
        $input = new ArrayInput();
152
153
        $reverseMove = new ReverseMove($bag, $this->config, $this->resource);
154
        $dump = new Dump($bag, $this->config, $this->resource);
155
        $assemble = new AssembleInput($bag, $this->config, $this->getLanguageAdapter(), $input, new ArrayMap());
156
157
        $result = new Result();
158
        $workflow = new QueueWorkflow($this->config, $result);
159
        $workflow->add($reverseMove);
160
        $workflow->add($dump);
161
        $workflow->add($assemble);
162
163
//        $workflow->execute();
164
        //=====================================================================
165
        // assert that customers are in the file
166
167
        // TODO assertions
168
    }
169
}
170