Issues (3887)

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.

Migration/Extension/ActivityExtension.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
3
namespace Oro\Bundle\ActivityBundle\Migration\Extension;
4
5
use Doctrine\DBAL\Schema\Schema;
6
7
use Oro\Bundle\ActivityBundle\EntityConfig\ActivityScope;
8
use Oro\Bundle\EntityExtendBundle\Migration\Extension\ExtendExtension;
9
use Oro\Bundle\EntityExtendBundle\Migration\Extension\ExtendExtensionAwareInterface;
10
use Oro\Bundle\EntityExtendBundle\Migration\OroOptions;
11
use Oro\Bundle\EntityExtendBundle\Tools\ExtendHelper;
12
use Oro\Bundle\EntityExtendBundle\Tools\ExtendDbIdentifierNameGenerator;
13
use Oro\Bundle\MigrationBundle\Migration\Extension\NameGeneratorAwareInterface;
14
use Oro\Bundle\MigrationBundle\Tools\DbIdentifierNameGenerator;
15
16
class ActivityExtension implements ExtendExtensionAwareInterface, NameGeneratorAwareInterface
17
{
18
    /** @var ExtendExtension */
19
    protected $extendExtension;
20
21
    /** @var ExtendDbIdentifierNameGenerator */
22
    protected $nameGenerator;
23
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function setExtendExtension(ExtendExtension $extendExtension)
28
    {
29
        $this->extendExtension = $extendExtension;
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function setNameGenerator(DbIdentifierNameGenerator $nameGenerator)
36
    {
37
        $this->nameGenerator = $nameGenerator;
38
    }
39
40
    /**
41
     * Adds the association between the given table and the table contains activity records
42
     *
43
     * The activity entity must be included in 'activity' group ('groups' attribute of 'grouping' scope)
44
     *
45
     * @param Schema $schema
46
     * @param string $activityTableName Activity entity table name. It is owning side of the association
47
     * @param string $targetTableName   Target entity table name
48
     * @param bool   $immutable         Set TRUE to prohibit disabling the activity association from UI
49
     */
50
    public function addActivityAssociation(
51
        Schema $schema,
52
        $activityTableName,
53
        $targetTableName,
54
        $immutable = false
55
    ) {
56
        $targetTable = $schema->getTable($targetTableName);
57
58
        // Column names are used to show a title of target entity
59
        $targetTitleColumnNames = $targetTable->getPrimaryKeyColumns();
60
        // Column names are used to show detailed info about target entity
61
        $targetDetailedColumnNames = $targetTable->getPrimaryKeyColumns();
62
        // Column names are used to show target entity in a grid
63
        $targetGridColumnNames = $targetTable->getPrimaryKeyColumns();
64
65
        $activityClassName = $this->extendExtension->getEntityClassByTableName($activityTableName);
66
67
        $options = new OroOptions();
68
        $options->append(
69
            'activity',
70
            'activities',
71
            $activityClassName
72
        );
73
        if ($immutable) {
74
            $options->append(
75
                'activity',
76
                'immutable',
77
                $activityClassName
78
            );
79
        }
80
81
        $targetTable->addOption(OroOptions::KEY, $options);
0 ignored issues
show
$options is of type object<Oro\Bundle\Entity...e\Migration\OroOptions>, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
82
83
        $associationName = ExtendHelper::buildAssociationName(
84
            $this->extendExtension->getEntityClassByTableName($targetTableName),
85
            ActivityScope::ASSOCIATION_KIND
86
        );
87
88
        $this->extendExtension->addManyToManyRelation(
89
            $schema,
90
            $activityTableName,
91
            $associationName,
92
            $targetTable,
93
            $targetTitleColumnNames,
94
            $targetDetailedColumnNames,
95
            $targetGridColumnNames,
96
            [
97
                'extend' => [
98
                    'without_default' => true
99
                ]
100
            ]
101
        );
102
    }
103
104
    /**
105
     * Gets a table name for many-to-many relation
106
     *
107
     * @param string $activityTableName Activity entity table name. It is owning side of the association.
108
     * @param string $targetTableName   Target entity table name.
109
     *
110
     * @return string
111
     */
112
    public function getAssociationTableName($activityTableName, $targetTableName)
113
    {
114
        $sourceClassName = $this->extendExtension->getEntityClassByTableName($activityTableName);
115
        $targetClassName = $this->extendExtension->getEntityClassByTableName($targetTableName);
116
117
        $associationName = ExtendHelper::buildAssociationName(
118
            $targetClassName,
119
            ActivityScope::ASSOCIATION_KIND
120
        );
121
122
        return $this->nameGenerator->generateManyToManyJoinTableName(
123
            $sourceClassName,
124
            $associationName,
125
            $targetClassName
126
        );
127
    }
128
}
129