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.

Eccube/Controller/Mypage/DeliveryController.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\Controller\Mypage;
26
27
use Eccube\Application;
28
use Eccube\Controller\AbstractController;
29
use Eccube\Event\EccubeEvents;
30
use Eccube\Event\EventArgs;
31
use Symfony\Component\HttpFoundation\Request;
32
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
33
34
class DeliveryController extends AbstractController
35
{
36
    /**
37
     * お届け先一覧画面.
38
     *
39
     * @param Application $app
40
     * @param Request $request
0 ignored issues
show
Expected 5 spaces after parameter type; 1 found
Loading history...
41
     * @return \Symfony\Component\HttpFoundation\Response
42
     */
43 1
    public function index(Application $app, Request $request)
44
    {
45 1
        $Customer = $app['user'];
46
47 1
        return $app->render('Mypage/delivery.twig', array(
48 1
            'Customer' => $Customer,
49
        ));
50
    }
51
52
    /**
53
     * お届け先編集画面.
54
     *
55
     * @param Application $app
56
     * @param Request $request
0 ignored issues
show
Expected 5 spaces after parameter type; 1 found
Loading history...
57
     * @return \Symfony\Component\HttpFoundation\Response
58
     */
59 8
    public function edit(Application $app, Request $request, $id = null)
60
    {
61 8
        $Customer = $app['user'];
62
63
        // 配送先住所最大値判定
64
        // $idが存在する際は、追加処理ではなく、編集の処理ため本ロジックスキップ
65 8 View Code Duplication
        if (is_null($id)) {
66 4
            $addressCurrNum = count($Customer->getCustomerAddresses());
67 4
            $addressMax = $app['config']['deliv_addr_max'];
68 4
            if ($addressCurrNum >= $addressMax) {
69
                throw new NotFoundHttpException('お届け先の登録数の上限を超えています');
70
            }
71
        }
72
73 8
        $CustomerAddress = $app['eccube.repository.customer_address']->findOrCreateByCustomerAndId($Customer, $id);
74
75 8
        $parentPage = $request->get('parent_page', null);
76
77
        // 正しい遷移かをチェック
78
        $allowdParents = array(
79 8
            $app->url('mypage_delivery'),
80 8
            $app->url('shopping_delivery'),
81
        );
82
83
        // 遷移が正しくない場合、デフォルトであるマイページの配送先追加の画面を設定する
84 8
        if (!in_array($parentPage, $allowdParents)) {
85
            // @deprecated 使用されていないコード
86 8
            $parentPage  = $app->url('mypage_delivery');
87
        }
88
89 8
        $builder = $app['form.factory']
90 8
            ->createBuilder('customer_address', $CustomerAddress);
91
92 8
        $event = new EventArgs(
93
            array(
94 8
                'builder' => $builder,
95 8
                'Customer' => $Customer,
96 8
                'CustomerAddress' => $CustomerAddress,
97
            ),
98
            $request
99
        );
100 8
        $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_MYPAGE_DELIVERY_EDIT_INITIALIZE, $event);
101
102 8
        $form = $builder->getForm();
103 8
        $form->handleRequest($request);
104
105 8
        if ($form->isSubmitted() && $form->isValid()) {
106 4
            log_info('お届け先登録開始', array($id));
107
108 4
            $app['orm.em']->persist($CustomerAddress);
109 4
            $app['orm.em']->flush();
110
111 4
            log_info('お届け先登録完了', array($id));
112
113 4
            $event = new EventArgs(
114
                array(
115 4
                    'form' => $form,
116 4
                    'Customer' => $Customer,
117 4
                    'CustomerAddress' => $CustomerAddress,
118
                ),
119
                $request
120
            );
121 4
            $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_MYPAGE_DELIVERY_EDIT_COMPLETE, $event);
122
123 4
            $app->addSuccess('mypage.delivery.add.complete');
124
125 4
            return $app->redirect($app->url('mypage_delivery'));
126
        }
127
128 4
        $BaseInfo = $app['eccube.repository.base_info']->get();
129
130 4
        return $app->render('Mypage/delivery_edit.twig', array(
131 4
            'form' => $form->createView(),
132 4
            'parentPage' => $parentPage,
133 4
            'BaseInfo' => $BaseInfo,
134
        ));
135
    }
136
137
    /**
0 ignored issues
show
Doc comment for parameter "$id" missing
Loading history...
Doc comment for parameter "$request" missing
Loading history...
138
     * お届け先を削除する.
139
     *
140
     * @param Application $app
141
     * @param $id
142
     * @return \Symfony\Component\HttpFoundation\RedirectResponse
143
     */
144 4
    public function delete(Application $app, Request $request, $id)
145
    {
146 4
        $this->isTokenValid($app);
147
148 4
        log_info('お届け先削除開始', array($id));
149
150 4
        $Customer = $app['user'];
151
152 4
        $status = $app['eccube.repository.customer_address']->deleteByCustomerAndId($Customer, $id);
153
154 4 View Code Duplication
        if ($status) {
155 2
            $event = new EventArgs(
156
                array(
157 2
                    'id' => $id,
158 2
                    'Customer' => $Customer,
159
                ), $request
160
            );
161 2
            $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_MYPAGE_DELIVERY_DELETE_COMPLETE, $event);
162
163 2
            $app->addSuccess('mypage.address.delete.complete');
164
165 2
            log_info('お届け先削除完了', array($id));
166
167
        } else {
168 2
            $app->addError('mypage.address.delete.failed');
169
170 2
            log_info('お届け先削除失敗', array($id));
171
        }
172
173 4
        return $app->redirect($app->url('mypage_delivery'));
174
    }
175
}
176