This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
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 | /********************************************************************************* |
||
42 | |||
43 | * Description: |
||
44 | * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights |
||
45 | * Reserved. Contributor(s): ______________________________________.. |
||
46 | *********************************************************************************/ |
||
47 | |||
48 | require_once("include/entryPoint.php"); |
||
49 | |||
50 | if (!is_admin($GLOBALS['current_user'])) { |
||
51 | sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']); |
||
52 | } |
||
53 | |||
54 | $json = getJSONObj(); |
||
55 | $out = ""; |
||
56 | |||
57 | switch($_REQUEST['adminAction']) { |
||
58 | /////////////////////////////////////////////////////////////////////////// |
||
59 | //// REPAIRXSS |
||
60 | case "refreshEstimate": |
||
61 | include("include/modules.php"); // provide $moduleList |
||
62 | $target = ''; |
||
63 | if (!empty($_REQUEST['bean'])) { |
||
64 | $target = $_REQUEST['bean']; |
||
65 | } |
||
66 | |||
67 | $count = 0; |
||
68 | $toRepair = array(); |
||
69 | |||
70 | if($target == 'all') { |
||
71 | $hide = array('Activities', 'Home', 'iFrames', 'Calendar', 'Dashboard'); |
||
72 | |||
73 | sort($moduleList); |
||
74 | $options = array(); |
||
75 | |||
76 | foreach($moduleList as $module) { |
||
77 | if(!in_array($module, $hide)) { |
||
78 | $options[$module] = $module; |
||
79 | } |
||
80 | } |
||
81 | |||
82 | foreach($options as $module) { |
||
83 | if(!isset($beanFiles[$beanList[$module]])) |
||
84 | continue; |
||
85 | |||
86 | $file = $beanFiles[$beanList[$module]]; |
||
87 | |||
88 | if(!file_exists($file)) |
||
89 | continue; |
||
90 | |||
91 | require_once($file); |
||
92 | $bean = new $beanList[$module](); |
||
93 | |||
94 | $q = "SELECT count(*) as count FROM {$bean->table_name}"; |
||
95 | $r = $bean->db->query($q); |
||
96 | $a = $bean->db->fetchByAssoc($r); |
||
97 | |||
98 | $count += $a['count']; |
||
99 | |||
100 | // populate to_repair array |
||
101 | $q2 = "SELECT id FROM {$bean->table_name}"; |
||
102 | $r2 = $bean->db->query($q2); |
||
103 | $ids = ''; |
||
104 | while($a2 = $bean->db->fetchByAssoc($r2)) { |
||
105 | $ids[] = $a2['id']; |
||
106 | } |
||
107 | $toRepair[$module] = $ids; |
||
108 | } |
||
109 | } elseif(in_array($target, $moduleList)) { |
||
110 | require_once($beanFiles[$beanList[$target]]); |
||
111 | $bean = new $beanList[$target](); |
||
112 | $q = "SELECT count(*) as count FROM {$bean->table_name}"; |
||
113 | $r = $bean->db->query($q); |
||
114 | $a = $bean->db->fetchByAssoc($r); |
||
115 | |||
116 | $count += $a['count']; |
||
117 | |||
118 | // populate to_repair array |
||
119 | $q2 = "SELECT id FROM {$bean->table_name}"; |
||
120 | $r2 = $bean->db->query($q2); |
||
121 | $ids = ''; |
||
122 | while($a2 = $bean->db->fetchByAssoc($r2)) { |
||
123 | $ids[] = $a2['id']; |
||
124 | } |
||
125 | $toRepair[$target] = $ids; |
||
126 | } |
||
127 | |||
128 | $out = array('count' => $count, 'target' => $target, 'toRepair' => $toRepair); |
||
129 | break; |
||
130 | |||
131 | case "repairXssExecute": |
||
132 | if(isset($_REQUEST['bean']) && !empty($_REQUEST['bean']) && isset($_REQUEST['id']) && !empty($_REQUEST['id'])) { |
||
133 | include("include/modules.php"); // provide $moduleList |
||
134 | $target = $_REQUEST['bean']; |
||
135 | require_once($beanFiles[$beanList[$target]]); |
||
136 | |||
137 | $ids = $json->decode(from_html($_REQUEST['id'])); |
||
138 | $count = 0; |
||
139 | foreach($ids as $id) { |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
140 | if(!empty($id)) { |
||
141 | $bean = new $beanList[$target](); |
||
142 | $bean->retrieve($id,true,false); |
||
143 | $bean->new_with_id = false; |
||
144 | $bean->save(); // cleanBean() is called on save() |
||
145 | $count++; |
||
146 | } |
||
147 | } |
||
148 | |||
149 | $out = array('msg' => "success", 'count' => $count); |
||
150 | } else { |
||
151 | $out = array('msg' => "failure: bean or ID not defined"); |
||
152 | } |
||
153 | break; |
||
154 | //// END REPAIRXSS |
||
155 | /////////////////////////////////////////////////////////////////////////// |
||
156 | |||
157 | default: |
||
158 | die(); |
||
159 | break; |
||
160 | } |
||
161 | |||
162 | $ret = $json->encode($out, true); |
||
163 | echo $ret; |
||
164 |