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.

AbstractArticlePageAdminListConfigurator.php (4 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\ArticleBundle\AdminList;
4
5
use Doctrine\ORM\EntityManager;
6
use Doctrine\ORM\QueryBuilder;
7
use Kunstmaan\AdminBundle\Helper\Security\Acl\AclHelper;
8
use Kunstmaan\AdminBundle\Helper\Security\Acl\Permission\PermissionDefinition;
9
use Kunstmaan\AdminListBundle\AdminList\Configurator\AbstractDoctrineORMAdminListConfigurator;
10
use Kunstmaan\AdminListBundle\AdminList\FilterType\ORM\BooleanFilterType;
11
use Kunstmaan\AdminListBundle\AdminList\FilterType\ORM\DateFilterType;
12
use Kunstmaan\AdminListBundle\AdminList\FilterType\ORM\StringFilterType;
13
use Kunstmaan\ArticleBundle\Entity\AbstractArticleOverviewPage;
14
use Kunstmaan\NodeBundle\Entity\Node;
15
use Kunstmaan\NodeBundle\Entity\NodeTranslation;
16
17
/**
18
 * The AdminList configurator for the AbstractArticlePage
19
 */
20
abstract class AbstractArticlePageAdminListConfigurator extends AbstractDoctrineORMAdminListConfigurator
21
{
22
    /**
23
     * @var string
24
     */
25
    protected $locale;
26
27
    /**
28
     * @var string
29
     */
30
    protected $permission;
31
32
    /**
33
     * @param EntityManager $em         The entity manager
34
     * @param AclHelper     $aclHelper  The ACL helper
35
     * @param string        $locale     The current locale
36
     * @param string        $permission The permission
37
     */
38 6 View Code Duplication
    public function __construct(EntityManager $em, AclHelper $aclHelper, $locale, $permission)
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...
39
    {
40 6
        parent::__construct($em, $aclHelper);
41 6
        $this->locale = $locale;
42 6
        $this->setPermissionDefinition(
43 6
            new PermissionDefinition(array($permission), 'Kunstmaan\NodeBundle\Entity\Node', 'n')
44
        );
45 6
    }
46
47
    /**
48
     * Return current bundle name.
49
     *
50
     * @return string
51
     */
52 2
    public function getBundleName()
53
    {
54 2
        return 'KunstmaanArticleBundle';
55
    }
56
57
    /**
58
     * Return current entity name.
59
     *
60
     * @return string
61
     */
62 2
    public function getEntityName()
63
    {
64 2
        return 'AbstractArticlePage';
65
    }
66
67
    /**
68
     * Configure filters
69
     */
70 1 View Code Duplication
    public function buildFilters()
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...
71
    {
72 1
        $this->addFilter('title', new StringFilterType('title'), 'article.page.list.filter.title')
73 1
            ->addFilter('online', new BooleanFilterType('online'), 'article.page.list.filter.online')
74 1
            ->addFilter('created', new DateFilterType('created', 'nv'), 'article.page.list.filter.created_at')
75 1
            ->addFilter('updated', new DateFilterType('updated', 'nv'), 'article.page.list.filter.updated_at');
76 1
    }
77
78
    /**
79
     * Configure the visible columns
80
     */
81 1
    public function buildFields()
82
    {
83 1
        $this->addField('title', 'article.page.list.header.title', true, '@KunstmaanNode/Admin/title.html.twig')
84 1
            ->addField('created', 'article.page.list.header.created_at', true)
85 1
            ->addField('updated', 'article.page.list.header.updated_at', true)
86 1
            ->addField('online', 'article.page.list.header.online', true, '@KunstmaanNode/Admin/online.html.twig');
87 1
    }
88
89
    /**
90
     * @return QueryBuilder
91
     */
92 1
    protected function getQueryBuilder()
93
    {
94 1
        $queryBuilder = $this->em
95 1
            ->getRepository(NodeTranslation::class)
96 1
            ->createQueryBuilder('b');
97
98 1
        return $queryBuilder;
99
    }
100
101
    /**
102
     * @param QueryBuilder $queryBuilder The query builder
103
     */
104 1
    public function adaptQueryBuilder(QueryBuilder $queryBuilder)
105
    {
106 1
        parent::adaptQueryBuilder($queryBuilder);
107
108 1
        $queryBuilder->innerJoin('b.node', 'n', 'WITH', 'b.node = n.id');
109 1
        $queryBuilder->innerJoin('b.nodeVersions', 'nv', 'WITH', 'b.publicNodeVersion = nv.id');
110 1
        $queryBuilder->andWhere('b.lang = :lang');
111 1
        $queryBuilder->andWhere('n.deleted = 0');
112 1
        $queryBuilder->andWhere('n.refEntityName = :class');
113 1
        $queryBuilder->addOrderBy('b.updated', 'DESC');
114 1
        $queryBuilder->setParameter('lang', $this->locale);
115 1
    }
116
117
    /**
118
     * @param mixed $item
119
     *
120
     * @return array
121
     */
122 1 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...
123
    {
124
        /* @var Node $node */
125 1
        $node = $item->getNode();
126
127
        return array(
128 1
            'path' => 'KunstmaanNodeBundle_nodes_edit',
129 1
            'params' => array('id' => $node->getId()),
130
        );
131
    }
132
133
    /**
134
     * Get the delete url for the given $item
135
     *
136
     * @param object $item
137
     *
138
     * @return array
0 ignored issues
show
Consider making the return type a bit more specific; maybe use array<string,string|array<string,integer>>.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
139
     */
140 1
    public function getDeleteUrlFor($item)
141
    {
142
        /* @var Node $node */
143 1
        $node = $item->getNode();
144
145
        return array(
146 1
            'path' => 'KunstmaanNodeBundle_nodes_delete',
147 1
            'params' => array('id' => $node->getId()),
148
        );
149
    }
150
151
    /**
152
     * Returns the OverviewPage of these articles
153
     *
154
     * @return AbstractArticleOverviewPage
155
     */
156 1
    public function getOverviewPage()
157
    {
158 1
        $repository = $this->getOverviewPageRepository();
159 1
        $pages = $repository->findActiveOverviewPages();
160
161 1
        if (isset($pages) && \count($pages) > 0) {
162 1
            return $pages[0];
163
        }
164
165 1
        return null;
166
    }
167
168
    /**
169
     * Returns all overview pages
170
     *
171
     * @return mixed
172
     */
173 1
    public function getOverviewPages()
174
    {
175 1
        return $this->getOverviewPageRepository()->findActiveOverviewPages();
176
    }
177
178
    /**
179
     * @return string
180
     */
181 1
    public function getListTemplate()
182
    {
183 1
        return '@KunstmaanArticle/AbstractArticlePageAdminList/list.html.twig';
184
    }
185
186
    /**
187
     * Returns the full entity class name
188
     *
189
     * @return string
190
     */
191 1
    public function getEntityClassName()
192
    {
193 1
        return $this->em->getRepository($this->getRepositoryName())->getClassName();
194
    }
195
196
    /**
197
     * @return \Doctrine\ORM\EntityRepository
198
     */
199
    abstract public function getOverviewPageRepository();
200
}
201