Issues (4069)

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.

modules/Import/views/ImportView.php (1 issue)

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
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3
/*********************************************************************************
4
 * SugarCRM Community Edition is a customer relationship management program developed by
5
 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
6
7
 * SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd.
8
 * Copyright (C) 2011 - 2014 Salesagility Ltd.
9
 *
10
 * This program is free software; you can redistribute it and/or modify it under
11
 * the terms of the GNU Affero General Public License version 3 as published by the
12
 * Free Software Foundation with the addition of the following permission added
13
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
14
 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
15
 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
16
 *
17
 * This program is distributed in the hope that it will be useful, but WITHOUT
18
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19
 * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
20
 * details.
21
 *
22
 * You should have received a copy of the GNU Affero General Public License along with
23
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
24
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25
 * 02110-1301 USA.
26
 *
27
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
28
 * SW2-130, Cupertino, CA 95014, USA. or at email address [email protected].
29
 *
30
 * The interactive user interfaces in modified source and object code versions
31
 * of this program must display Appropriate Legal Notices, as required under
32
 * Section 5 of the GNU Affero General Public License version 3.
33
 *
34
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
35
 * these Appropriate Legal Notices must retain the display of the "Powered by
36
 * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
37
 * reasonably feasible for  technical reasons, the Appropriate Legal Notices must
38
 * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
39
 ********************************************************************************/
40
41
require_once('include/MVC/View/SugarView.php');
42
43
44
class ImportView extends SugarView
45
{
46
    protected $currentStep;
47
    protected $pageTitleKey;
48
    protected $instruction;
49
50
    public function __construct($bean = null, $view_object_map = array())
51
    {
52
        global $mod_strings;
53
54
        parent::__construct($bean, $view_object_map);
55
56
        if (isset($_REQUEST['button']) && trim($_REQUEST['button']) == htmlentities($mod_strings['LBL_BACK'])) {
57
            // if the request comes from the "Back" button, decrease the step count
58
            $this->currentStep = isset($_REQUEST['current_step']) ? ($_REQUEST['current_step'] - 1) : 1;
59
        } else {
60
            $this->currentStep = isset($_REQUEST['current_step']) ? ($_REQUEST['current_step'] + 1) : 1;
61
        }
62
        $this->importModule = isset($_REQUEST['import_module']) ? $_REQUEST['import_module'] : '';
63
        
64
    }
65
66
    /**
67
     * @see SugarView::getMenu()
68
     */
69
    public function getMenu($module = null)
70
    {
71
        global $mod_strings, $current_language;
72
73
        if ( empty($module) )
74
            $module = $this->importModule;
75
76
        $old_mod_strings = $mod_strings;
77
        $mod_strings = return_module_language($current_language, $module);
78
        $returnMenu = parent::getMenu($module);
79
        $mod_strings = $old_mod_strings;
80
81
        return $returnMenu;
82
    }
83
84
 	/**
85
     * @see SugarView::_getModuleTab()
86
     */
87
 	protected function _getModuleTab()
88
    {
89
        global $app_list_strings, $moduleTabMap;
90
91
 		// Need to figure out what tab this module belongs to, most modules have their own tabs, but there are exceptions.
92
        if ( !empty($_REQUEST['module_tab']) )
93
            return $_REQUEST['module_tab'];
94
        elseif ( isset($moduleTabMap[$this->importModule]) )
95
            return $moduleTabMap[$this->importModule];
96
        // Default anonymous pages to be under Home
97
        elseif ( !isset($app_list_strings['moduleList'][$this->importModule]) )
98
            return 'Home';
99
        else
100
            return $this->importModule;
101
 	}
102
103
    /**
104
     * Send our output to the importer controller.
105
     * 
106
     * @param string $html
107
     * @param string $submitContent
108
     * @param string $script
109
     * @param bool $encode
110
     * @return void
111
     */
112
    protected function sendJsonOutput($html = "", $submitContent = "", $script = "", $encode = FALSE)
113
    {
114
        $title = $this->getModuleTitle(false);
115
        $out = array(
116
            'html'          => $html,
117
            'submitContent' => $submitContent,
118
            'title'         => $title,
119
            'script'        => $script);
120
121
        if($encode){
122
            array_walk($out, create_function('&$val', '$val = htmlspecialchars($val,ENT_NOQUOTES);'));
0 ignored issues
show
Security Best Practice introduced by
The use of create_function is highly discouraged, better use a closure.

create_function can pose a great security vulnerability as it is similar to eval, and could be used for arbitrary code execution. We highly recommend to use a closure instead.

// Instead of
$function = create_function('$a, $b', 'return $a + $b');

// Better use
$function = function($a, $b) { return $a + $b; }
Loading history...
123
        }
124
        echo json_encode($out);
125
    }
126
127
    /**
128
	 * @see SugarView::_getModuleTitleParams()
129
	 */
130
	protected function _getModuleTitleParams($browserTitle = false)
131
	{
132
	    global $mod_strings, $app_list_strings;
133
	    $returnArray = array(string_format($mod_strings[$this->pageTitleKey], array($this->currentStep)));
134
135
	    return $returnArray;
136
    }
137
138
    protected function getInstruction()
139
    {
140
        global $mod_strings;
141
142
        $ins = '';
143
        
144
        if ($this->instruction) {
145
            $ins_string = $mod_strings[$this->instruction];
146
            $ins = '<div class="import_instruction">' . $ins_string . '</div>';
147
        }
148
149
        return $ins;
150
    }
151
152
     /**
153
     * Displays the Smarty template for an error
154
     *
155
     * @param string $message error message to show
156
     * @param string $module what module we were importing into
157
     * @param string $action what page we should go back to
158
     */
159
    protected function _showImportError($message,$module,$action = 'Step1')
160
    {
161
        $ss = new Sugar_Smarty();
162
163
        $ss->assign("MESSAGE",$message);
164
        $ss->assign("ACTION",$action);
165
        $ss->assign("IMPORT_MODULE",$module);
166
        $ss->assign("MOD", $GLOBALS['mod_strings']);
167
        $ss->assign("SOURCE","");
168
        if ( isset($_REQUEST['source']) )
169
            $ss->assign("SOURCE", $_REQUEST['source']);
170
171
        echo $ss->fetch('modules/Import/tpls/error.tpl');
172
    }
173
}