Issues (108)

Security Analysis    no request data  

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.

ModelBundle/Repository/SiteRepositoryTest.php (2 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 OpenOrchestra\FunctionalTests\ModelBundle\Repository;
4
5
use OpenOrchestra\BaseBundle\Tests\AbstractTest\AbstractKernelTestCase;
6
use OpenOrchestra\ModelBundle\Repository\SiteRepository;
7
use OpenOrchestra\Pagination\Configuration\PaginateFinderConfiguration;
8
9
/**
10
 * Class SiteRepositoryTest
11
 *
12
 * @group integrationTest
13
 */
14
class SiteRepositoryTest extends AbstractKernelTestCase
15
{
16
    /**
17
     * @var SiteRepository
18
     */
19
    protected $repository;
20
21
    /**
22
     * Set up test
23
     */
24
    protected function setUp()
25
    {
26
        parent::setUp();
27
28
        static::bootKernel();
29
        $this->repository = static::$kernel->getContainer()->get('open_orchestra_model.repository.site');
30
    }
31
32
    /**
33
     * @param string        $domain
34
     * @param array<string> $expectedSiteIds
35
     *
36
     * @dataProvider provideAliasDomain
37
     */
38
    public function testFindByAliasDomain($domain, $expectedSiteIds)
39
    {
40
        $sites = $this->repository->findByAliasDomain($domain);
41
42
        $this->assertIdsMatches($expectedSiteIds, $sites);
43
    }
44
45
46
    /**
47
     * @param PaginateFinderConfiguration  $configuration
48
     * @param array|null                   $siteIds
49
     * @param int                          $count
50
     *
51
     * @dataProvider providePaginateAndSearch
52
     */
53
    public function testFindForPaginate(PaginateFinderConfiguration $configuration, $siteIds, $count)
54
    {
55
        $sites = $this->repository->findForPaginateFilterBySiteIds($configuration, $siteIds);
56
        $this->assertCount($count, $sites);
57
    }
58
59
    /**
60
     * @return array
61
     */
62 View Code Duplication
    public function providePaginateAndSearch()
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...
63
    {
64
        $configurationAll = PaginateFinderConfiguration::generateFromVariable(array(), 0, 100, array());
65
        $configurationLimit = PaginateFinderConfiguration::generateFromVariable(array(), 0, 1, array());
66
        $configurationSearch = PaginateFinderConfiguration::generateFromVariable(array(), 0, 100, array(), array('name' => 'demo'));
67
        $configurationAllOrder = PaginateFinderConfiguration::generateFromVariable(array('name' => 'desc'), 0, 100, array());
68
69
        return array(
70
            'all' => array($configurationAll, null, 1),
71
            'all with site' => array($configurationAll, array('2'), 1),
72
            'all with deleted site' => array($configurationAll, array('3'), 0),
73
            'all without site' => array($configurationAll, array(), 0),
74
            'limit' => array($configurationLimit, null, 1),
75
            'search' => array($configurationSearch, null, 1),
76
            'search without site' => array($configurationSearch, array(), 0),
77
            'order' => array($configurationAllOrder, null, 1),
78
        );
79
    }
80
81
    /**
82
     * test count all site
83
     */
84
    public function testCount()
85
    {
86
        $sites = $this->repository->countFilterBySiteIds();
87
        $this->assertEquals(1, $sites);
88
    }
89
90
    /**
91
     * test count all site with site ids
92
     */
93
    public function testCountWithIds()
94
    {
95
        $sites = $this->repository->countFilterBySiteIds(array('2'));
96
        $this->assertEquals(1, $sites);
97
    }
98
99
    /**
100
     * @param PaginateFinderConfiguration $configuration
101
     * @param array|null                  $siteIds
102
     * @param int                         $count
103
     *
104
     * @dataProvider provideCountWithFilter
105
     */
106
    public function testCountWithFilter($configuration, $siteIds, $count)
107
    {
108
        $sites = $this->repository->countWithFilterAndSiteIds($configuration, $siteIds);
109
        $this->assertEquals($count, $sites);
110
    }
111
112
    /**
113
     * @return array
114
     */
115 View Code Duplication
    public function provideCountWithFilter()
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...
116
    {
117
        $configurationAll = PaginateFinderConfiguration::generateFromVariable(array(), 0, 100, array());
118
        $configurationLimit = PaginateFinderConfiguration::generateFromVariable(array(), 0, 1, array());
119
        $configurationSearch = PaginateFinderConfiguration::generateFromVariable(array(), 0, 100, array(), array('name' => 'demo'));
120
        $configurationAllOrder = PaginateFinderConfiguration::generateFromVariable(array('name' => 'desc'), 0, 100, array());
121
122
        return array(
123
            'all' => array($configurationAll, null, 1),
124
            'all with site' => array($configurationAll, array('2'), 1),
125
            'all with deleted site' => array($configurationAll, array('3'), 0),
126
            'all without site' => array($configurationAll, array(), 0),
127
            'limit' => array($configurationLimit, null, 1),
128
            'search' => array($configurationSearch, null, 1),
129
            'search without site' => array($configurationSearch, array(), 0),
130
            'order' => array($configurationAllOrder, null, 1),
131
        );
132
    }
133
134
    /**
135
     * Check if the $sites ids matches $expectedIds
136
     *
137
     * @param array $expectedIds
138
     * @param array $sites
139
     *
140
     * @return boolean
141
     */
142
    protected function assertIdsMatches($expectedIds, $sites)
143
    {
144
        if (count($expectedIds) != count($sites)) {
145
146
            return false;
147
        }
148
149
        foreach ($sites as $site) {
150
            if (!in_array($site->getSiteId(), $expectedIds)) {
151
152
                return false;
153
            }
154
        }
155
156
        return true;
157
    }
158
159
    /**
160
     * @return array
161
     */
162
    public function provideAliasDomain()
163
    {
164
        return array(
165
            array('front.pddv-openorchestra-master.eolas-services.com', array('2')),
166
            array('fakeDomain', array())
167
        );
168
    }
169
170
    /**
171
     * Test find by site ids
172
     */
173
    public function testFindBySiteIds()
174
    {
175
        $sites = $this->repository->findBySiteIds(array('3', '2'));
176
        $this->assertCount(1, $sites);
177
    }
178
}
179