Issues (2687)

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.

doctrine/migration/Version20160114142234.php (5 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
namespace DoctrineMigrations;
3
4
use Doctrine\DBAL\Migrations\AbstractMigration;
5
use Doctrine\DBAL\Schema\Schema;
6
use Doctrine\ORM\EntityManager;
7
use Eccube\Application;
8
use Eccube\Common\Constant;
9
use Eccube\Entity\Csv;
10
use Eccube\Entity\Master\CsvType;
11
use Eccube\Entity\Master\Tag;
12
13
/**
14
 * Auto-generated Migration: Please modify to your needs!
15
 */
16
class Version20160114142234 extends AbstractMigration
17
{
18
    private $tag_datas = array(
19
        array(
20
            'id' => 1,
21
            'name' => '新商品',
22
            'rank' => 1,
23
        ),
24
        array(
25
            'id' => 2,
26
            'name' => 'おすすめ商品',
27
            'rank' => 2,
28
        ),
29
        array(
30
            'id' => 3,
31
            'name' => '限定品',
32
            'rank' => 3,
33
        ),
34
    );
35
36
    private $csv_datas = array(
37
        array(
38
            'entity_name' => 'Eccube\\\\Entity\\\\Product',
39
            'field_name' => 'ProductTag',
40
            'reference_field_name' => 'tag_id',
41
            'disp_name' => 'タグ(ID)',
42
        ),
43
        array(
44
            'entity_name' => 'Eccube\\\\Entity\\\\Product',
45
            'field_name' => 'ProductTag',
46
            'reference_field_name' => 'Tag',
47
            'disp_name' => 'タグ(名称)',
48
        ),
49
    );
50
51
    /**
52
     * @param Schema $schema
53
     */
54
    public function up(Schema $schema)
55
    {
56
        $app = \Eccube\Application::getInstance();
57
        $em = $app['orm.em'];
58
59
        $this->mtb_tag($em);
60
        $this->dtb_csv($em);
61
62
        $em->flush();
63
    }
64
65
    /**
66
     * @param Schema $schema
67
     */
68
    public function down(Schema $schema)
69
    {
70
        $app = \Eccube\Application::getInstance();
71
        $em = $app['orm.em'];
72
73
        $this->delete_dtb_csv($em);
74
75
        $em->flush();
76
    }
77
78
    /**
79
     * insert mtb_tag
80
     *
81
     * @param EntityManager $em
82
     */
83
    private function mtb_tag(EntityManager $em)
0 ignored issues
show
Method name "Version20160114142234::mtb_tag" is not in camel caps format
Loading history...
84
    {
85
        $Tags = $em->getRepository('\Eccube\Entity\Master\Tag')->findAll();
86
        if (0 < count($Tags)) {
87
            // すでに使用している場合は登録しない。
88
            return;
89
        }
90
91
        foreach ($this->tag_datas as $data) {
92
            $Tag = new Tag();
93
            $Tag
94
                ->setId($data['id'])
95
                ->setName($data['name'])
96
                ->setRank($data['rank']);
97
98
            $em->persist($Tag);
99
        }
100
    }
101
102
    /**
103
     * insert dtb_csv
104
     *
105
     * @param EntityManager $em
106
     */
107
    private function dtb_csv(EntityManager $em)
0 ignored issues
show
Method name "Version20160114142234::dtb_csv" is not in camel caps format
Loading history...
108
    {
109
        $filter = $em->getFilters()->getFilter('soft_delete');
110
        $filter->setExcludes(array(
0 ignored issues
show
Add a comma after each item in a multi-line array
Loading history...
111
            'Eccube\Entity\Member'
112
        ));
113
        $CsvType = $em->getRepository('Eccube\Entity\Master\CsvType')->find(CsvType::CSV_TYPE_PRODUCT);
114
        $Member = $em->getRepository('Eccube\Entity\Member')->find(1);
115
        $Csv = $em->getRepository('Eccube\Entity\Csv')->findOneBy(
116
            array('CsvType' => $CsvType),
117
            array('rank' => 'DESC')
118
        );
119
        $rank = $Csv->getRank();
120
121
        foreach ($this->csv_datas as $data) {
122
            $rank++;
123
124
            $Csv = new Csv();
125
            $Csv
126
                ->setCsvType($CsvType)
127
                ->setCreator($Member)
128
                ->setEntityName($data['entity_name'])
129
                ->setFieldName($data['field_name'])
130
                ->setReferenceFieldName($data['reference_field_name'])
131
                ->setDispName($data['disp_name'])
132
                ->setRank($rank)
133
                ->setEnableFlg(Constant::ENABLED);
134
135
            $em->persist($Csv);
136
        }
137
    }
138
139
    /**
140
     * delete dtb_csv
141
     *
142
     * @param EntityManager $em
143
     */
144
    private function delete_dtb_csv(EntityManager $em)
0 ignored issues
show
Method name "Version20160114142234::delete_dtb_csv" is not in camel caps format
Loading history...
145
    {
146
        $repository = $em->getRepository('Eccube\Entity\Csv');
147
        foreach ($this->csv_datas as $data) {
148
            $Csv = $repository->findOneBy(array(
0 ignored issues
show
Are you sure the assignment to $Csv is correct as $repository->findOneBy(a...eference_field_name'])) (which targets Doctrine\ORM\EntityRepository::findOneBy()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
149
                'entity_name' => $data['entity_name'],
150
                'field_name' => $data['field_name'],
151
                'reference_field_name' => $data['reference_field_name'],
152
            ));
153
154
            if ($Csv) {
155
                $em->remove($Csv);
156
            }
157
        }
158
    }
159
}
160