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/controller.php (1 issue)

Severity

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
/*********************************************************************************
5
 * SugarCRM Community Edition is a customer relationship management program developed by
6
 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
7
8
 * SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd.
9
 * Copyright (C) 2011 - 2014 Salesagility Ltd.
10
 *
11
 * This program is free software; you can redistribute it and/or modify it under
12
 * the terms of the GNU Affero General Public License version 3 as published by the
13
 * Free Software Foundation with the addition of the following permission added
14
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
15
 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
16
 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
17
 *
18
 * This program is distributed in the hope that it will be useful, but WITHOUT
19
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20
 * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
21
 * details.
22
 *
23
 * You should have received a copy of the GNU Affero General Public License along with
24
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
25
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26
 * 02110-1301 USA.
27
 *
28
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
29
 * SW2-130, Cupertino, CA 95014, USA. or at email address [email protected].
30
 *
31
 * The interactive user interfaces in modified source and object code versions
32
 * of this program must display Appropriate Legal Notices, as required under
33
 * Section 5 of the GNU Affero General Public License version 3.
34
 *
35
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
36
 * these Appropriate Legal Notices must retain the display of the "Powered by
37
 * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
38
 * reasonably feasible for  technical reasons, the Appropriate Legal Notices must
39
 * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
40
 ********************************************************************************/
41
42
/*********************************************************************************
43
44
 * Description: Controller for the Import module
45
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
46
 * All Rights Reserved.
47
 ********************************************************************************/
48
49
require_once("modules/Import/Forms.php");
50
require_once("include/MVC/Controller/SugarController.php");
51
require_once('modules/Import/sources/ImportFile.php');
52
require_once('modules/Import/views/ImportListView.php');
53
54
class ImportController extends SugarController
55
{
56
    /**
57
     * @see SugarController::loadBean()
58
     */
59
    public function loadBean()
60
    {
61
        global $mod_strings;
62
63
        if (!isset($_REQUEST['import_module'])) {
64
            $_REQUEST['message'] = $mod_strings['LBL_ERROR_IMPORTS_NOT_SET_UP'];
65
            $this->view = 'error';
66
            $this->_processed = true;
67
            return; // there is no module to load
68
        }
69
70
        $this->importModule = $_REQUEST['import_module'];
71
72
        $this->bean = loadBean($this->importModule);
0 ignored issues
show
Deprecated Code introduced by
The function loadBean() has been deprecated with message: use SugarModule::loadBean() instead

This function has been deprecated. The supplier of the file has supplied an explanatory message.

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

Loading history...
73
        if ( $this->bean ) {
74
            if ( !$this->bean->importable )
75
                $this->bean = false;
76
            elseif ( $_REQUEST['import_module'] == 'Users' && !is_admin($GLOBALS['current_user']) )
77
                $this->bean = false;
78
            elseif ( $this->bean->bean_implements('ACL')){
79
                if(!ACLController::checkAccess($this->bean->module_dir, 'import', true)){
80
                    ACLController::displayNoAccess();
81
                    sugar_die('');
82
                }
83
            }
84
        }
85
86
        if ( !$this->bean && $this->importModule != "Administration") {
87
            $_REQUEST['message'] = $mod_strings['LBL_ERROR_IMPORTS_NOT_SET_UP'];
88
            $this->view = 'error';
89
            $this->_processed = true;
90
        }
91
        else
92
            $GLOBALS['FOCUS'] = $this->bean;
93
    }
94
    
95
    function action_index()
96
    {
97
        $this->action_Step1();
98
    }
99
100
    function action_mapping()
101
    {
102
        global $mod_strings, $current_user;
103
        $results = array('message' => '');
104
        // handle publishing and deleting import maps
105
        if(isset($_REQUEST['delete_map_id']))
106
        {
107
            $import_map = new ImportMap();
108
            $import_map->mark_deleted($_REQUEST['delete_map_id']);
109
        }
110
111
        if(isset($_REQUEST['publish']) )
112
        {
113
            $import_map = new ImportMap();
114
115
            $import_map = $import_map->retrieve($_REQUEST['import_map_id'], false);
116
117
            if($_REQUEST['publish'] == 'yes')
118
            {
119
                $result = $import_map->mark_published($current_user->id,true);
120
                if (!$result)
121
                    $results['message'] = $mod_strings['LBL_ERROR_UNABLE_TO_PUBLISH'];
122
            }
123
            elseif( $_REQUEST['publish'] == 'no')
124
            {
125
                // if you don't own this importmap, you do now, unless you have a map by the same name
126
                $result = $import_map->mark_published($current_user->id,false);
127
                if (!$result)
128
                    $results['message'] = $mod_strings['LBL_ERROR_UNABLE_TO_UNPUBLISH'];
129
            }
130
        }
131
        
132
        echo json_encode($results);
133
        sugar_cleanup(TRUE);
134
    }
135
    function action_RefreshMapping()
136
    {
137
        global $mod_strings;
138
        require_once('modules/Import/sources/ImportFile.php');
139
        require_once('modules/Import/views/view.confirm.php');
140
        $v = new ImportViewConfirm();
141
        $fileName = $_REQUEST['importFile'];
142
        $delim = $_REQUEST['delim'];
143
        if ($delim == '\t') {
144
            $delim = "\t";
145
        }
146
        $enclosure = $_REQUEST['qualif'];
147
        $enclosure = html_entity_decode($enclosure, ENT_QUOTES);
148
        $hasHeader = isset($_REQUEST['header']) && !empty($_REQUEST['header']) ? TRUE : FALSE;
149
150
        $importFile = new ImportFile( $fileName, $delim, $enclosure, FALSE);
151
        $importFile->setHeaderRow($hasHeader);
152
        $rows = $v->getSampleSet($importFile);
153
154
        $ss = new Sugar_Smarty();
155
        $ss->assign("SAMPLE_ROWS",$rows);
156
        $ss->assign("HAS_HEADER",$hasHeader);
157
        $ss->assign("column_count",$v->getMaxColumnsInSampleSet($rows));
158
        $ss->assign("MOD",$mod_strings);
159
        $ss->display('modules/Import/tpls/confirm_table.tpl');
160
        sugar_cleanup(TRUE);
161
162
    }
163
164
    function action_RefreshTable()
165
    {
166
        $offset = isset($_REQUEST['offset']) ? $_REQUEST['offset'] : 0;
167
        $tableID = isset($_REQUEST['tableID']) ? $_REQUEST['tableID'] : 'errors';
168
        $has_header = $_REQUEST['has_header'] == 'on' ? TRUE : FALSE;
169
        if($tableID == 'dup')
170
            $tableFilename = ImportCacheFiles::getDuplicateFileName();
171
        else
172
            $tableFilename = ImportCacheFiles::getErrorRecordsFileName();
173
174
        $if = new ImportFile($tableFilename, ",", '"', FALSE, FALSE);
175
        $if->setHeaderRow($has_header);
176
        $lv = new ImportListView($if,array('offset'=> $offset), $tableID);
177
        $lv->display(FALSE);
178
        
179
        sugar_cleanup(TRUE);
180
    }
181
    
182
	function action_Step1()
183
    {
184
        $fromAdminView = isset($_REQUEST['from_admin_wizard']) ? $_REQUEST['from_admin_wizard'] : FALSE;
185
        if( $this->importModule == 'Administration' || $fromAdminView
186
        )
187
        {
188
    		$this->view = 'step1';
189
        }
190
        else
191
            $this->view = 'step2';
192
    }
193
    
194
    function action_Step2()
195
    {
196
		$this->view = 'step2';
197
    }
198
199
    function action_Confirm()
200
    {
201
		$this->view = 'confirm';
202
    }
203
204
    function action_Step3()
205
    {
206
		$this->view = 'step3';
207
    }
208
209
    function action_DupCheck()
210
    {
211
		$this->view = 'dupcheck';
212
    }
213
214
    function action_Step4()
215
    {
216
		$this->view = 'step4';
217
    }
218
    
219
    function action_Last()
220
    {
221
		$this->view = 'last';
222
    }
223
    
224
    function action_Undo()
225
    {
226
		$this->view = 'undo';
227
    }
228
    
229
    function action_Error()
230
    {
231
		$this->view = 'error';
232
    }
233
234
    function action_ExtStep1()
235
    {
236
        $this->view = 'extStep1';
237
    }
238
239
    function action_Extdupcheck()
240
    {
241
        $this->view = 'extdupcheck';
242
    }
243
244
    function action_Extimport()
245
    {
246
        $this->view = 'extimport';
247
    }
248
    
249
    function action_GetControl()
250
    {
251
        echo getControl($_REQUEST['import_module'],$_REQUEST['field_name']);
252
        exit;
253
    }
254
255
    public function action_AuthenticatedSources()
256
    {
257
        $this->view = 'authenticatedsources';
258
    }
259
260
    public function action_RevokeAccess()
261
    {
262
        $this->view = 'revokeaccess';
263
    }
264
}
265
?>