Issues (114)

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/config/main.php (6 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
4
$common = [
5
    'id' => 'app',
6
    'language' => 'en',
7
    'basePath' => dirname(__DIR__),
8
    'vendorPath' => '@app/../vendor',
9
    'runtimePath' => '@app/../runtime',
10
    'bootstrap' => [
11
        'log',
12
    ],
13
    'aliases' => [
14
        '@admin-views' => '@app/modules/backend/views',
15
    ],
16
    'components' => [
17
        'assetManager' => [
18
            // Note: For using mounted volumes or shared folders
19
            'dirMode' => YII_ENV_PROD ? 0777 : null,
20
            'bundles' => getenv('APP_ASSET_USE_BUNDLED') ?
21
                require(__DIR__.'/assets-gen/prod.php') :
22
                [
23
                    // Note: if your asset bundle includes bootstrap, you can disable the default asset
24
                    #'yii\bootstrap\BootstrapAsset' => false,
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% 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...
25
                ],
26
            'basePath' => '@app/../web/assets',
27
        ],
28
        'authManager' => [
29
            'class' => 'yii\rbac\DbManager',
30
        ],
31
        'cache' => [
32
            'class' => 'yii\caching\FileCache',
33
        ],
34
        'db' => [
35
            'class' => 'yii\db\Connection',
36
            'dsn' => getenv('DATABASE_DSN'),
37
            'username' => getenv('DATABASE_USER'),
38
            'password' => getenv('DATABASE_PASSWORD'),
39
            'charset' => 'utf8',
40
            'tablePrefix' => getenv('DATABASE_TABLE_PREFIX'),
41
            'enableSchemaCache' => YII_ENV_PROD ? true : false,
42
        ],
43
        'i18n' => [
44
            'translations' => [
45
                '*' => [
46
                    'class' => 'yii\i18n\DbMessageSource',
47
                    'db' => 'db',
48
                    'sourceLanguage' => 'en',
49
                    'sourceMessageTable' => '{{%language_source}}',
50
                    'messageTable' => '{{%language_translate}}',
51
                    'cachingDuration' => 86400,
52
                    'enableCaching' => YII_DEBUG ? false : true,
53
                ],
54
            ],
55
        ],
56
        'mailer' => [
57
            'class' => 'yii\swiftmailer\Mailer',
58
            //'viewPath'         => '@common/mail',
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...
59
            // send all mails to a file by default. You have to set
60
            // 'useFileTransport' to false and configure a transport
61
            // for the mailer to send real emails.
62
            'useFileTransport' => YII_ENV_PROD ? false : true,
63
        ],
64
        // Note: enable db sessions, if multiple containers are running
65
        #'session' => [
66
        #    'class' => 'yii\web\DbSession'
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% 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...
67
        #],
68
        'settings' => [
69
            'class' => 'pheme\settings\components\Settings',
70
        ],
71
        'urlManager' => [
72
            'class' => 'codemix\localeurls\UrlManager',
73
            'enablePrettyUrl' => getenv('APP_PRETTY_URLS') ? true : false,
74
            'showScriptName' => getenv('YII_ENV_TEST') ? true : false,
75
            'enableDefaultLanguageUrlCode' => true,
76
            'baseUrl' => '/',
77
            'rules' => [
78
                'docs/<file:[a-zA-Z0-9_\-\./]+>' => 'docs',
79
                #'docs' => 'docs/default/index',
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...
80
            ],
81
            'languages' => explode(',',getenv('APP_LANGUAGES')),
82
        ],
83
        'user' => [
84
            'class' => 'app\components\User',
85
            'enableAutoLogin' => true,
86
            'loginUrl' => ['/user/security/login'],
87
            'identityClass' => 'dektrium\user\models\User',
88
        ],
89
        'view' => [
90
            'theme' => [
91
                'pathMap' => [
92
                    '@vendor/dektrium/yii2-user/views/admin' => '@app/views/user/admin',
93
                    '@yii/gii/views/layouts' => '@admin-views/layouts',
94
                ],
95
            ],
96
        ],
97
98
    ],
99
    'modules' => [
100
        'backend' => [
101
            'class' => 'app\modules\backend\Module',
102
            'layout' => '@admin-views/layouts/main',
103
        ],
104
        'pages' => [
105
            'class' => 'dmstr\modules\pages\Module',
106
            'layout' => '@admin-views/layouts/main',
107
            'availableRoutes' => [
108
                '/site/index' => '/site/index',
109
            ],
110
        ],
111
        'prototype'    => [
112
            'class'  => 'app\modules\prototype\Module',
113
            'layout' => '@admin-views/layouts/main',
114
        ],
115
        'user' => [
116
            'class' => 'dektrium\user\Module',
117
            'layout' => '@app/views/layouts/container',
118
            'defaultRoute' => 'profile',
119
            'admins' => ['admin'],
120
            'enableFlashMessages' => false,
121
        ],
122
        'rbac' => [
123
            'class' => 'dektrium\rbac\Module',
124
            'layout' => '@admin-views/layouts/box',
125
            'enableFlashMessages' => false,
126
        ],
127
        'settings' => [
128
            'class' => 'pheme\settings\Module',
129
            'layout' => '@admin-views/layouts/box',
130
            'accessRoles' => ['Admin'],
131
        ],
132
        'translatemanager' => [
133
            'class' => 'lajax\translatemanager\Module',
134
            'root' => '@app/views',
135
            'layout' => '@admin-views/layouts/box',
136
            'allowedIPs' => ['*'],
137
            'roles' => ['admin', 'translate-manager'],
138
        ],
139
        'treemanager' => [
140
            'class' => '\kartik\tree\Module',
141
            'layout' => '@admin-views/layouts/main',
142
            'treeViewSettings' => [
143
                'nodeView' => '@vendor/dmstr/yii2-pages-module/views/treeview/_form',
144
                'fontAwesome' => true,
145
            ],
146
        ],
147
    ],
148
    'params' => [
149
        'appName' => getenv('APP_NAME'),
150
        'adminEmail' => getenv('APP_ADMIN_EMAIL'),
151
        'supportEmail' => getenv('APP_SUPPORT_EMAIL'),
152
        'yii.migrations' => [
153
            '@yii/rbac/migrations',
154
            '@dektrium/user/migrations',
155
            '@vendor/lajax/yii2-translate-manager/migrations',
156
            '@vendor/pheme/yii2-settings/migrations',
157
            '@app/modules/prototype/migrations'
158
        ],
159
    ],
160
161
];
162
163
$web = [
164
    'components' => [
165
        'errorHandler' => [
166
            'errorAction' => 'site/error',
167
        ],
168
        // Logging
169
        'log' => [
170
            'targets' => [
171
                // writes to php-fpm output stream
172
                [
173
                    'class' => 'codemix\streamlog\Target',
174
                    'url' => 'php://stdout',
175
                    'levels' => ['info', 'trace'],
176
                    'logVars' => [],
177
                    'enabled' => YII_DEBUG,
178
                ],
179
                [
180
                    'class' => 'codemix\streamlog\Target',
181
                    'url' => 'php://stderr',
182
                    'levels' => ['error', 'warning'],
183
                    'logVars' => [],
184
                ],
185
            ],
186
        ],
187
        'request' => [
188
            // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
189
            'cookieValidationKey' => getenv('APP_COOKIE_VALIDATION_KEY'),
190
        ],
191
        'user' => [
192
            'identityClass' => 'dektrium\user\models\User',
193
        ],
194
    ],
195
];
196
197
$console = [
198
    'controllerNamespace' => 'app\commands',
199
    'controllerMap' => [
200
        'db' => 'dmstr\console\controllers\MysqlController',
201
        'migrate' => 'dmstr\console\controllers\MigrateController',
202
        'translate' => '\lajax\translatemanager\commands\TranslatemanagerController',
203
    ],
204
    'components' => [
205
206
    ],
207
];
208
209
$allowedIPs = [
210
    '127.0.0.1',
211
    '::1',
212
    '192.168.*',
213
    '172.17.*',
214
];
215
216
// detecting current application type based on `php_sapi_name()` since we've no application ready yet.
217
if (php_sapi_name() == 'cli') {
218
    // Console application
219
    $config = \yii\helpers\ArrayHelper::merge($common, $console);
220
} else {
221
    // Web application
222
    if (YII_ENV_DEV) {
223
        // configuration adjustments for web 'dev' environment
224
        $common['bootstrap'][] = 'debug';
225
        $common['modules']['debug'] = [
226
            'class' => 'yii\debug\Module',
227
            'allowedIPs' => $allowedIPs,
228
        ];
229
    }
230
    $config = \yii\helpers\ArrayHelper::merge($common, $web);
231
}
232
233
if (YII_ENV_DEV || YII_ENV_TEST) {
234
    // configuration adjustments for 'dev' environment
235
    $config['bootstrap'][] = 'gii';
236
    $config['modules']['gii'] = [
237
        'class' => 'yii\gii\Module',
238
        'allowedIPs' => $allowedIPs,
239
    ];
240
241 View Code Duplication
    if (file_exists(__DIR__.'/giiant.php')) {
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...
242
        // Local configuration, if available
243
        $giiant = require __DIR__.'/giiant.php';
244
        $config = \yii\helpers\ArrayHelper::merge($config, $giiant);
245
    }
246
}
247
248 View Code Duplication
if (file_exists(__DIR__.'/local.php')) {
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...
249
    // Local configuration, if available
250
    $local = require __DIR__.'/local.php';
251
    $config = \yii\helpers\ArrayHelper::merge($config, $local);
252
}
253
254
return $config;
255