Issues (2366)

Branch: master

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/Admin/PaymentRegisterType.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
 * 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\Admin;
26
27
use Symfony\Component\Form\AbstractType;
28
use Symfony\Component\Form\FormBuilderInterface;
29
use Symfony\Component\Form\FormError;
30
use Symfony\Component\Form\FormEvent;
31
use Symfony\Component\Form\FormEvents;
32
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
33
use Symfony\Component\Validator\Constraints as Assert;
34
35
class PaymentRegisterType extends AbstractType
36
{
37
    protected $app;
38
39 8
    public function __construct($app)
40
    {
41
        $this->app = $app;
42
    }
43 8
44 8
    /**
45
     * {@inheritdoc}
46
     */
47 8
    public function buildForm(FormBuilderInterface $builder, array $options)
48
    {
49
        $app = $this->app;
50 8
51 8
        $builder
52 8
            ->add('method', 'text', array(
53
                'label' => '支払方法',
54
                'required' => true,
55
                'constraints' => array(
56
                    new Assert\NotBlank(),
57
                ),
58
            ))
59 8
            ->add('rule_min', 'money', array(
60
                'label' => false,
61
                'currency' => 'JPY',
62 8
                'precision' => 0,
63 8
                'scale' => 0,
64 8
                'grouping' => true,
65
                'constraints' => array(
66
                    new Assert\Length(array(
67
                        'max' => $app['config']['int_len'],
68
                    )),
69
                    new Assert\Regex(array(
70 8
                        'pattern' => "/^\d+$/u",
71
                        'message' => 'form.type.numeric.invalid'
72
                    )),
73 8
                ),
74 8
            ))
75 8
            ->add('rule_max', 'money', array(
76 8
                'label' => false,
77
                'currency' => 'JPY',
78
                'precision' => 0,
79
                'scale' => 0,
80
                'grouping' => true,
81
                'required' => false,
82 8
                'constraints' => array(
83
                    new Assert\Length(array(
84
                        'max' => $app['config']['int_len'],
85
                    )),
86
                    new Assert\Regex(array(
87
                        'pattern' => "/^\d+$/u",
88
                        'message' => 'form.type.numeric.invalid'
89
                    )),
90
                ),
91
            ))
92 8
            ->add('payment_image_file', 'file', array(
93 8
                'label' => 'ロゴ画像',
94 8
                'mapped' => false,
95
                'required' => false,
96
            ))
97
            ->add('payment_image', 'hidden', array(
98 8
                'required' => false,
99
            ))
100
            ->add('charge_flg', 'hidden')
101
            ->add('fix_flg', 'hidden')
102
            ->addEventListener(FormEvents::POST_BIND, function($event) {
0 ignored issues
show
Deprecated Code introduced by
The constant Symfony\Component\Form\FormEvents::POST_BIND has been deprecated with message: since version 2.3, to be removed in 3.0. Use {@link POST_SUBMIT} instead.

This class constant has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the constant will be removed from the class and what other constant to use instead.

Loading history...
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
103 8
                $form = $event->getForm();
104
                $ruleMax = $form['rule_max']->getData();
105
                $ruleMin = $form['rule_min']->getData();
106
                if (!empty($ruleMin) && !empty($ruleMax) && $ruleMax < $ruleMin) {
107
                    $form['rule_min']->addError(new FormError('利用条件(下限)は'.$ruleMax.'円以下にしてください。'));
108
                }
109
            })
110
            ->addEventListener(FormEvents::POST_SET_DATA, function(FormEvent $event) use ($app) {
111
                $form = $event->getForm();
112
                /** @var \Eccube\Entity\Payment $Payment */
113
                $Payment = $event->getData();
114
                if (is_null($Payment) || $Payment->getChargeFlg() == 1) {
115
                    $form->add('charge', 'money', array(
116
                        'label' => '手数料',
117
                        'currency' => 'JPY',
118
                        'precision' => 0,
119 278
                        'scale' => 0,
120
                        'grouping' => true,
121 278
                        'constraints' => array(
122
                            new Assert\NotBlank(),
123
                            new Assert\Length(array(
124
                                'max' => $app['config']['int_len'],
125
                            )),
126
                            new Assert\Regex(array(
127
                                'pattern' => "/^\d+$/u",
128
                                'message' => 'form.type.numeric.invalid'
129
                            )),
130
                        ),
131
                    ));
132
                } else {
133
                    $form->add('charge', 'hidden');
134
                }
135
            })
136
        ;
137
    }
138
139
    /**
140
     * {@inheritdoc}
141
     */
142
    public function setDefaultOptions(OptionsResolverInterface $resolver)
143
    {
144
        $resolver->setDefaults(array(
145
            'data_class' => 'Eccube\Entity\Payment',
146
        ));
147
    }
148
149
    /**
150
     * {@inheritdoc}
151
     */
152
    public function getName()
153
    {
154
        return 'payment_register';
155
    }
156
}
157