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.

src/Eccube/Form/Type/Install/Step3Type.php (4 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
 * This file is part of EC-CUBE
4
 *
5
 * Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved.
6
 *
7
 * http://www.lockon.co.jp/
8
 *
9
 * This program is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU General Public License
11
 * as published by the Free Software Foundation; either version 2
12
 * of the License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
 */
23
24
25
namespace Eccube\Form\Type\Install;
26
27
use Symfony\Component\Form\AbstractType;
28
use Symfony\Component\Form\Extension\Core\Type;
29
use Symfony\Component\Form\FormBuilderInterface;
30
use Symfony\Component\Form\FormError;
31
use Symfony\Component\Form\FormEvents;
32
use Symfony\Component\Validator\Constraints as Assert;
33
34
class Step3Type extends AbstractType
35
{
36
    public $app;
37
38 36
    public function __construct(\Silex\Application $app)
39
    {
40 36
        $this->app = $app;
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46 28
    public function buildForm(FormBuilderInterface $builder, array $options)
47
    {
48 28
        $app = $this->app;
49
        $builder
50 28
            ->add('shop_name', 'text', array(
51 28
                'label' => 'あなたの店名',
52
                'constraints' => array(
53 28
                    new Assert\NotBlank(),
54 28
                    new Assert\Length(array(
55 28
                        'max' => $this->app['config']['stext_len'],
56
                    )),
57
                ),
58
            ))
59 28
            ->add('email', 'email', array(
60 28
                'label' => 'メールアドレス(受注メールなどの宛先になります)',
61
                'constraints' => array(
62 28
                    new Assert\NotBlank(),
63 28
                    new Assert\Email(array('strict' => true)),
64
                ),
65
            ))
66 28
            ->add('login_id', 'text', array(
67 28
                'label' => '管理画面ログインID(半角英数字'.$this->app['config']['id_min_len'].'~'.$this->app['config']['id_max_len'].'文字)',
68
                'constraints' => array(
69 28
                    new Assert\NotBlank(),
70 28
                    new Assert\Length(array(
71 28
                        'min' => $this->app['config']['id_min_len'],
72 28
                        'max' => $this->app['config']['id_max_len'],
73
                    )),
74 28
                    new Assert\Regex(array(
75 28
                        'pattern' => '/^[[:graph:][:space:]]+$/i',
76
                        'message' => 'form.type.graph.invalid',
77
                    )),
78
                ),
79
            ))
80 28
            ->add('login_pass', 'password', array(
81 28
                'label' => '管理画面パスワード(半角英数字'.$this->app['config']['password_min_len'].'~'.$this->app['config']['password_max_len'].'文字)',
82
                'constraints' => array(
83 28
                    new Assert\NotBlank(),
84 28
                    new Assert\Length(array(
85 28
                        'min' => $this->app['config']['password_min_len'],
86 28
                        'max' => $this->app['config']['password_max_len'],
87
                    )),
88 28
                    new Assert\Regex(array(
89 28
                        'pattern' => '/^[[:graph:][:space:]]+$/i',
90
                        'message' => 'form.type.graph.invalid',
91
                    )),
92
                ),
93
            ))
94 28
            ->add('admin_dir', 'text', array(
95 28
                'label' => '管理画面のディレクトリ名(半角英数字'.$this->app['config']['id_min_len'].'~'.$this->app['config']['id_max_len'].'文字)',
96
                'constraints' => array(
97 28
                    new Assert\NotBlank(),
98 28
                    new Assert\Length(array(
99 28
                        'min' => $this->app['config']['id_min_len'],
100 28
                        'max' => $this->app['config']['id_max_len'],
101
                    )),
102 28
                    new Assert\Regex(array('pattern' => '/\A\w+\z/')),
103
                ),
104
            ))
105 28
            ->add('admin_force_ssl', 'checkbox', array(
106 28
                'label' => 'サイトへのアクセスを、SSL(https)経由に制限します',
107
                'required' => false,
108
            ))
109 28
            ->add('admin_allow_hosts', 'textarea', array(
110 28
                'label' => '管理画面へのアクセスを、以下のIPに制限します',
111
                'help' => '複数入力する場合は、IPとIPの間に改行をいれてください',
112
                'required' => false,
113
            ))
114 28
            ->add('trusted_proxies_connection_only', 'checkbox', array(
115 28
                'label' => 'サイトが信頼されたロードバランサー、プロキシサーバからのみアクセスされる',
116
                'required' => false,
117
            ))
118
            ->add('trusted_proxies', 'textarea', array(
119
                'label' => 'ロードバランサー、プロキシサーバのIP',
120
                'help' => '複数入力する場合は、IPとIPの間に改行をいれてください(X-Forwarded-Proto、X-Forwarded-Host、X-Forwarded-Portヘッダーに対応してる必要があります)',
121
                'required' => false,
122
            ))
123
            ->add('mail_backend', 'choice', array(
124 28
                'label' => 'メーラーバックエンド',
125 28
                'choices' => array(
126
                    'mail' => 'mail(PHPの組み込み関数 mail() を使用してメールを送信)',
127
                    'smtp' => 'SMTP(SMTPサーバに直接接続してメールを送信)',
128
                    'sendmail' => 'sendmail(sendmailプログラムによりメールを送信)',
129 28
                ),
130 28
                'expanded' => true,
131
                'multiple' => false,
132
            ))
133
            ->add('smtp_host', 'text', array(
134 28
                'label' => 'SMTPホスト',
135 28
                'help' => 'メーラーバックエンドがSMTPの場合のみ指定',
136
                'required' => false,
137
            ))
138
            ->add('smtp_port', 'text', array(
139 28
                'label' => 'SMTPポート',
140 28
                'help' => 'メーラーバックエンドがSMTPの場合のみ指定',
141
                'required' => false,
142
            ))
143
            ->add('smtp_username', 'text', array(
144 28
                'label' => 'SMTPユーザー',
145 27
                'help' => 'メーラーバックエンドがSMTPかつSMTP-AUTH使用時のみ指定',
146 27
                'required' => false,
147
            ))
148 27
            ->add('smtp_password', 'password', array(
149
                'label' => 'SMTPパスワード',
150 27
                'help' => 'メーラーバックエンドがSMTPかつSMTP-AUTH使用時のみ指定',
151 26
                'required' => false,
152 26
            ))
153 View Code Duplication
            ->addEventListener(FormEvents::POST_SUBMIT, function ($event) use($app)  {
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...
Expected 1 space after USE keyword; found 0
Loading history...
Expected 1 space after closing parenthesis; found 2
Loading history...
154
                $form = $event->getForm();
155 26
                $data = $form->getData();
156 27
157
                $ips = preg_split("/\R/", $data['admin_allow_hosts'], null, PREG_SPLIT_NO_EMPTY);
158
159 28
                foreach($ips as $ip) {
160
                    $errors = $app['validator']->validateValue($ip, array(
161
                            new Assert\Ip(),
162
                        )
163
                    );
164
                    if ($errors->count() != 0) {
165
                        $form['admin_allow_hosts']->addError(new FormError($ip . 'はIPv4アドレスではありません。'));
0 ignored issues
show
Concat operator must not be surrounded by spaces
Loading history...
166 37
                    }
167
                }
168 37
            })
169
        ;
170
    }
171
172
    /**
173
     * {@inheritdoc}
174
     */
175
    public function getName()
176
    {
177
        return 'install_step3';
178
    }
179
}
180