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/Command/ConfigCommand.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
/*
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
namespace Eccube\Command;
25
26
use Knp\Command\Command;
27
use Symfony\Component\Console\Application;
28
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
29
use Symfony\Component\Console\Helper\TableHelper;
30
use Symfony\Component\Console\Input\InputArgument;
31
use Symfony\Component\Console\Input\InputDefinition;
32
use Symfony\Component\Console\Input\InputInterface;
33
use Symfony\Component\Console\Input\InputOption;
34
use Symfony\Component\Console\Output\OutputInterface;
35
36
37
class ConfigCommand extends Command
0 ignored issues
show
Missing class doc comment
Loading history...
38
{
39
    protected function configure()
40
    {
41
        $this
42
            ->setName('debug:config')
43
            ->setDefinition(array(
44
                new InputArgument('filter', InputArgument::OPTIONAL, 'Show details for all config matching this filter'),
45
                new InputOption('configphp', null, InputOption::VALUE_NONE, 'Check if you are using Config PHP File'),
46
            ))
47
            ->setDescription('Shows a list of config file')
48
            ->setHelp(<<<EOF
49
The <info>%command.name%</info> command outputs a list of config file,
50
Output can be filtered with an optional argument.
51
52
  <info>php %command.full_name%</info>
53
54
The command lists all config.
55
56
  <info>php %command.full_name% database</info>
57
58
The command lists the database yml file.
59
For filter, yml file name or key name can be set.
60
61
  <info>php %command.full_name% --configphp</info>
62
63
The command checks whether Config PHP File is used.
64
65
EOF
66
            );
67
    }
68
69
70
    protected function execute(InputInterface $input, OutputInterface $output)
71
    {
72
73
        /** @var \Eccube\Application $app */
74
        $app = $this->getSilexApplication();
75
76
        $filter = $input->getArgument('filter');
77
78
        $optional = $input->getOption('configphp');
79
        if ($optional) {
80
            // ymlファイルではなく、phpファイルが有効になっているかチェック
81
            $ymlPath = $this->getProjectDirectory().'/app/config/eccube';
82
            $config_php = $ymlPath.'/config.php';
83
            if (file_exists($config_php)) {
84
                $output->writeln('Config PHP File : <info>used.</info>');
85
            } else {
86
                $output->writeln('Config PHP File : <info>not used.</info>');
87
            }
88
89
            if (!$filter) {
90
                return;
91
            }
92
        }
93
94
        $recursive = function ($config, $space = '    ') use (&$recursive, $output) {
95
            foreach ($config as $key => $item) {
96
                if (is_array($item)) {
97
                    $space = '    ';
98
                    $output->writeln($space."<comment>{$key}</comment> :");
99
                    $space .= '    ';
100
101
                    $recursive($item, $space);
102
                } else {
103
                    $output->writeln($space."<comment>{$key}</comment> : <info>{$item}</info>");
104
                }
105
            }
106
        };
107
108
109
        if ($filter) {
110
            // コマンド実行時にパラメータを指定
111
112
            $config = array();
113
            $app->parseConfig($filter, $config);
114
115 View Code Duplication
            if (!empty($config)) {
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...
116
                // ymlファイル名が指定された場合、ymlファイルの内容を出力
117
                $output->writeln("YML File Name : <info>{$filter}</info>");
118
                foreach ($config as $key => $item) {
119
                    if (is_array($item)) {
120
                        $output->writeln("<comment>{$key}</comment> :");
121
                        $recursive($item);
122
                    } else {
123
                        $output->writeln("<comment>{$key}</comment> : <info>{$item}</info>");
124
                    }
125
                }
126
127
                return;
128
            }
129
130
            if (!isset($app['config'][$filter])) {
131
                $output->writeln('Not Found filter : $app[\'config\'][\'<error>'.$filter.'</error>\']');
132
133
                return;
134
            }
135
136
            $config = $app['config'][$filter];
137
138
            $output->writeln('$app[\'config\'][\'<comment>'.$filter.'</comment>\']');
139 View Code Duplication
            if (is_array($config)) {
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...
140
                foreach ($config as $key => $item) {
141
                    if (is_array($item)) {
142
                        $output->writeln("<comment>{$key}</comment> :");
143
                        $recursive($item);
144
                    } else {
145
                        $output->writeln("<comment>{$key}</comment> : <info>{$item}</info>");
146
                    }
147
                }
148
            } else {
149
                $output->writeln("<comment>{$filter}</comment> : <info>{$config}</info>");
150
            }
151 View Code Duplication
        } else {
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...
152
            // $app['config']の内容を全て出力する
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
153
            $config = $app['config'];
154
155
            foreach ($config as $key => $item) {
156
                if (is_array($item)) {
157
                    $output->writeln("<comment>{$key}</comment> :");
158
                    $recursive($item);
159
                } else {
160
                    $output->writeln("<comment>{$key}</comment> : <info>{$item}</info>");
161
                }
162
            }
163
        }
164
    }
165
}
166