Issues (3099)

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.

AdminList/RulesAdminListConfigurator.php (3 issues)

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 Kunstmaan\LeadGenerationBundle\AdminList;
4
5
use Doctrine\ORM\EntityManager;
6
use Doctrine\ORM\QueryBuilder;
7
use Kunstmaan\AdminBundle\Helper\Security\Acl\AclHelper;
8
use Kunstmaan\AdminListBundle\AdminList\Configurator\AbstractDoctrineORMAdminListConfigurator;
9
use Kunstmaan\AdminListBundle\AdminList\FilterType\ORM;
10
use Kunstmaan\LeadGenerationBundle\Entity\Popup\AbstractPopup;
11
12
class RulesAdminListConfigurator extends AbstractDoctrineORMAdminListConfigurator
13
{
14
    /**
15
     * @var int
16
     */
17
    protected $popupId;
18
19
    /**
20
     * @param EntityManager $em        The entity manager
21
     * @param AclHelper     $aclHelper The acl helper
22
     * @param int           $id        The if of the popup
23
     */
24 View Code Duplication
    public function __construct(EntityManager $em, AclHelper $aclHelper = null, $id)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
25
    {
26
        parent::__construct($em, $aclHelper);
27
28
        $this->setPopupId($id);
29
        $this->setListTemplate('@KunstmaanLeadGeneration/AdminList/rules-list.html.twig');
30
        $this->setEditTemplate('@KunstmaanLeadGeneration/AdminList/rules-edit.html.twig');
31
        $this->setAddTemplate('@KunstmaanLeadGeneration/AdminList/rules-edit.html.twig');
32
    }
33
34
    /**
35
     * @param QueryBuilder $queryBuilder
36
     * @param array        $params
37
     */
38
    public function adaptQueryBuilder(QueryBuilder $queryBuilder, array $params = array())
39
    {
40
        $queryBuilder->where('b.popup = :id');
41
        $queryBuilder->setParameter('id', $this->getPopupId());
42
        $queryBuilder->orderBy('b.id', 'ASC');
43
    }
44
45
    /**
46
     * Return the url to list all the items
47
     *
48
     * @return array
49
     */
50
    public function getIndexUrl()
51
    {
52
        return array(
53
            'path' => 'kunstmaanleadgenerationbundle_admin_rule_abstractrule_detail',
54
            'params' => array('popup' => $this->getPopupId()),
55
        );
56
    }
57
58
    /**
59
     * Get the edit url for the given $item
60
     *
61
     * @param object $item
62
     *
63
     * @return array
64
     */
65 View Code Duplication
    public function getEditUrlFor($item)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
66
    {
67
        $params = array('id' => $item->getId(), 'popup' => $this->getPopupId());
68
        $params = array_merge($params, $this->getExtraParameters());
69
70
        return array(
71
            'path' => 'kunstmaanleadgenerationbundle_admin_rule_abstractrule_edit',
72
            'params' => $params,
73
        );
74
    }
75
76
    /**
77
     * Get the delete url for the given $item
78
     *
79
     * @param object $item
80
     *
81
     * @return array
82
     */
83 View Code Duplication
    public function getDeleteUrlFor($item)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
84
    {
85
        $params = array('id' => $item->getId(), 'popup' => $this->getPopupId());
86
        $params = array_merge($params, $this->getExtraParameters());
87
88
        return array(
89
            'path' => 'kunstmaanleadgenerationbundle_admin_rule_abstractrule_delete',
90
            'params' => $params,
91
        );
92
    }
93
94
    /**
95
     * Configure the visible columns
96
     */
97
    public function buildFields()
98
    {
99
        $this->addField('id', 'kuma_lead_generation.rules.list.header.id', true);
100
        $this->addField('classname', 'kuma_lead_generation.rules.list.header.type', false);
101
        $this->addField('jsProperties', 'kuma_lead_generation.rules.list.header.properties', false);
102
    }
103
104
    /**
105
     * Build filters for admin list
106
     */
107
    public function buildFilters()
108
    {
109
        $this->addFilter('id', new ORM\StringFilterType('id'), 'kuma_lead_generation.rules.list.filter.id');
110
    }
111
112
    public function getValue($item, $columnName)
113
    {
114
        if ($columnName == 'jsProperties') {
115
            return json_encode($item->getJsProperties());
116
        }
117
118
        return parent::getValue($item, $columnName);
119
    }
120
121
    /**
122
     * Get bundle name
123
     *
124
     * @return string
125
     */
126
    public function getBundleName()
127
    {
128
        return 'KunstmaanLeadGenerationBundle';
129
    }
130
131
    /**
132
     * Get entity name
133
     *
134
     * @return string
135
     */
136
    public function getEntityName()
137
    {
138
        return 'Rule\AbstractRule';
139
    }
140
141
    /**
142
     * @param object $entity
143
     *
144
     * @return object
145
     */
146
    public function decorateNewEntity($entity)
147
    {
148
        $entity->setPopup($this->getPopup());
149
150
        return $entity;
151
    }
152
153
    /**
154
     * @param object|array $item
155
     *
156
     * @return bool
157
     */
158
    public function canEdit($item)
159
    {
160
        return true;
161
    }
162
163
    /**
164
     * Configure if it's possible to delete the given $item
165
     *
166
     * @param object|array $item
167
     *
168
     * @return bool
169
     */
170
    public function canDelete($item)
171
    {
172
        return true;
173
    }
174
175
    /**
176
     * Configure if it's possible to add new items
177
     *
178
     * @return bool
179
     */
180
    public function canAdd()
181
    {
182
        return true;
183
    }
184
185
    /**
186
     * @return int
187
     */
188
    public function getPopupId()
189
    {
190
        return $this->popupId;
191
    }
192
193
    /**
194
     * @param int $popupId
195
     */
196
    public function setPopupId($popupId)
197
    {
198
        $this->popupId = $popupId;
199
    }
200
201
    /**
202
     * @return AbstractPopup
203
     */
204
    public function getPopup()
205
    {
206
        return $this->em->getRepository(AbstractPopup::class)->find($this->getPopupId());
207
    }
208
}
209