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/ModuleBuilder/MB/MBRelationship.php (1 issue)

Labels
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
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
require_once 'modules/ModuleBuilder/parsers/relationships/UndeployedRelationships.php' ;
43
require_once 'modules/ModuleBuilder/parsers/relationships/AbstractRelationships.php' ;
44
require_once 'modules/ModuleBuilder/parsers/relationships/AbstractRelationship.php' ;
45
require_once 'modules/ModuleBuilder/parsers/relationships/ManyToManyRelationship.php' ;
46
47
/*
48
 * This is an Adapter for the new UndeployedRelationships Class to allow ModuleBuilder to use the new class without change
49
 * As ModuleBuilder is updated, references to this MBRelationship class should be replaced by direct references to UndeployedRelationships
50
 */
51
52
class MBRelationship
53
{
54
55
    public $relatableModules = array ( ) ; // required by MBModule
56
    public $relationships = array ( ) ; // required by view.relationships.php; must be kept in sync with the implementation
57
58
59
    /*
60
     * Constructor
61
     * @param string $name      The name of this module (not used)
62
     * @param string $path      The base path of the module directory within the ModuleBuilder package directory
63
     * @param string $key_name  The Fully Qualified Name for this module - that is, $packageName_$name
64
     */
65
    function __construct ($name , $path , $key_name)
66
    {
67
        $this->implementation = new UndeployedRelationships ( $path ) ;
68
        $this->moduleName = $key_name ;
69
        $this->path = $path ;
70
        $this->updateRelationshipVariable();
71
    }
72
73
    function findRelatableModules ()
74
    {
75
        // do not call findRelatableModules in the constructor as it leads to an infinite loop if the implementation calls getPackage() which loads the packages which loads the module which findsRelatableModules which...
76
        $this->relatableModules = $this->implementation->findRelatableModules () ;
77
    }
78
79
    /*
80
     * Originally in 5.0 this method expected $_POST variables keyed in the "old" format - lhs_module, relate, msub, rsub etc
81
     * At 5.1 this has been changed to the "new" format of lhs_module, rhs_module, lhs_subpanel, rhs_subpanel, label
82
     * @return AbstractRelationship
83
     */
84
    function addFromPost ()
85
    {
86
        return $this->implementation->addFromPost () ;
87
    }
88
89
    /*
90
     * New function to replace the old MBModule subpanel property - now we obtain the 'subpanels' (actually related modules) from the relationships object
91
     */
92
    function getRelationshipList ()
93
    {
94
        return $this->implementation->getRelationshipList () ;
95
    }
96
97
    function get ($relationshipName)
98
    {
99
        return $this->implementation->get ( $relationshipName ) ;
100
    }
101
102
    /*
103
     * Deprecated
104
     * Add a relationship to this set
105
     * Original MBRelationships could only support one relationship between this module and any other
106
     */
107
    /*
108
    function addRelationship ($name , $relatedTo , $relatedSubpanel = 'default' , $mysubpanel = 'default' , $type)
109
    {
110
        $this->implementation->add ( new ManyToManyRelationship ( $name, $this->moduleName, $relatedTo, $mysubpanel, $relatedSubpanel ) ) ;
111
        $this->updateRelationshipVariable () ;
112
    }
113
*/
114
115
    /* Add a relationship to this set
116
     * Original MBRelationships could only support one relationship between this module and any other
117
     * @param array $rel    Relationship definition in the old format (defined by self::oldFormatKeys)
118
     */
119
    function add ($rel)
120
    {
121
        // convert old format definition to new format
122
        if (! isset ( $rel [ 'lhs_module' ] ))
123
            $rel [ 'lhs_module' ] = $this->moduleName ;
124
        $definition = AbstractRelationships::convertFromOldFormat ( $rel ) ;
0 ignored issues
show
The method convertFromOldFormat() does not seem to exist on object<AbstractRelationships>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
125
        if (! isset ( $definition ['relationship_type']))
126
            $definition ['relationship_type'] = 'many-to-many';
127
        // get relationship object from RelationshipFactory
128
        $relationship = RelationshipFactory::newRelationship ( $definition ) ;
129
        // add relationship to the set of relationships
130
        $this->implementation->add ( $relationship ) ;
131
        $this->updateRelationshipVariable () ;
132
        return $relationship;
133
    }
134
135
    function delete ($name)
136
    {
137
        $this->implementation->delete ( $name ) ;
138
        $this->updateRelationshipVariable () ;
139
    }
140
141
    function save ()
142
    {
143
        $this->implementation->save () ;
144
    }
145
146
    function build ($path)
147
    {
148
        $this->implementation->build () ;
149
    }
150
151
    function addInstallDefs (&$installDef)
152
    {
153
        $this->implementation->addInstallDefs ( $installDef ) ;
154
    }
155
156
    /*
157
    function load ()
158
    {
159
        $this->implementation->load () ;
160
        $this->updateRelationshipVariable () ;
161
    }
162
*/
163
    /*
164
     * Transitional function to keep the public relationship variable in sync with the implementation master copy
165
     * We have to do this as various things refer directly to MBRelationship->relationships...
166
     */
167
168
    private function updateRelationshipVariable ()
169
    {
170
        foreach ( $this->implementation->getRelationshipList () as $relationshipName )
171
        {
172
            $rel = $this->implementation->getOldFormat ( $relationshipName ) ;
173
            $this->relationships [ $relationshipName ] = $rel ;
174
        }
175
    }
176
177
}
178
179
?>