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.

BackofficeBundle/Controller/SiteControllerTest.php (5 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\BackofficeBundle\Controller;
4
5
use OpenOrchestra\FunctionalTests\Utils\AbstractFormTest;
6
use OpenOrchestra\ModelInterface\Model\NodeInterface;
7
use OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface;
8
use OpenOrchestra\ModelInterface\Repository\SiteRepositoryInterface;
9
10
/**
11
 * Class SiteControllerTest
12
 *
13
 * @group backofficeTest
14
 */
15
class SiteControllerTest extends AbstractFormTest
16
{
17
    /**
18
     * @var NodeRepositoryInterface
19
     */
20
    protected $nodeRepository;
21
22
    /**
23
     * @var SiteRepositoryInterface
24
     */
25
    protected $siteRepository;
26
27
    protected $siteId;
28
29
    /**
30
     * Set up the test
31
     */
32
    public function setUp()
33
    {
34
        parent::setUp();
35
36
        $this->siteId = uniqid();
37
        $this->nodeRepository = static::$kernel->getContainer()->get('open_orchestra_model.repository.node');
38
        $this->siteRepository = static::$kernel->getContainer()->get('open_orchestra_model.repository.site');
39
    }
40
41
    /**
42
     * Test when you create a site and update it
43
     */
44
    public function testCreateSite()
45
    {
46
        $this->assertNodeCount(0, 'fr');
47
        $this->assertNodeCount(0, 'en');
48
49
        $this->createSite();
50
51
        $this->assertNodeCount(1, 'fr');
52
        $this->assertNodeCount(0, 'en');
53
54
        $crawler = $this->client->request('GET', '/admin/site/form/' . $this->siteId);
55
        $form = $crawler->selectButton('Save')->form();
56
57
        $values = $form->getPhpValues();
58
59
        $values['oo_site']['aliases'][1]['domain'] = $this->siteId . 'name';
60
        $values['oo_site']['aliases'][1]['language'] = 'en';
61
        $values['oo_site']['aliases'][1]['main'] = false;
62
63
        $this->client->request($form->getMethod(), $form->getUri(), $values, $form->getPhpFiles());
64
65
        $this->assertNodeCount(1, 'fr');
66
        $this->assertNodeCount(1, 'en');
67
68
        $this->client->request('DELETE', '/api/site/' . $this->siteId . '/delete');
69
    }
70
71
    /**
72
     * Test create 2 site with the same siteId only one is save
73
     */
74
    public function testUniqueSiteId()
75
    {
76
        $this->assertSiteCount(0, $this->siteId);
77
78
        $this->createSite();
79
80
        $this->assertSiteCount(1, $this->siteId);
81
82
        $this->createSite();
83
84
        $this->assertSiteCount(1, $this->siteId);
85
86
        $this->client->request('DELETE', '/api/site/' . $this->siteId . '/delete');
87
    }
88
89
    /**
90
     * Create a site
91
     */
92
    protected function createSite()
93
    {
94
        $crawler =  $this->client->request('GET', '/admin/site/new');
95
96
        $form = $crawler->selectButton('Save')->form();
97
98
        $form['oo_site[siteId]'] = $this->siteId;
99
        $form['oo_site[name]'] = $this->siteId . 'domain';
100
        $form['oo_site[metaAuthor]'] = $this->siteId . ' Author';
101
102
        $values = $form->getPhpValues();
0 ignored issues
show
The method getPhpValues cannot be called on $form (of type array<string,string,{"oo...metaAuthor]":"string"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
103
104
        $values['oo_site']['aliases'][0]['domain'] = $this->siteId . 'name';
105
        $values['oo_site']['aliases'][0]['language'] = 'fr';
106
        $values['oo_site']['aliases'][0]['main'] = true;
107
108
        $this->client->request($form->getMethod(), $form->getUri(), $values, $form->getPhpFiles());
0 ignored issues
show
The method getMethod cannot be called on $form (of type array<string,string,{"oo...metaAuthor]":"string"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
The method getUri cannot be called on $form (of type array<string,string,{"oo...metaAuthor]":"string"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
The method getPhpFiles cannot be called on $form (of type array<string,string,{"oo...metaAuthor]":"string"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
109
    }
110
111
    /**
112
     * @param int    $count
113
     * @param string $language
114
     */
115
    protected function assertNodeCount($count, $language)
116
    {
117
         $nodes = $this->nodeRepository->findNotDeletedSortByUpdatedAt(NodeInterface::ROOT_NODE_ID, $language, $this->siteId);
118
119
         $this->assertCount($count, $nodes);
120
    }
121
122
    /**
123
     * @param int    $count
124
     * @param string $siteId
125
     */
126
    protected function assertSiteCount($count, $siteId)
127
    {
128
        $sites = $this->siteRepository->findBy(array('siteId' => $siteId));
0 ignored issues
show
The method findBy() does not exist on OpenOrchestra\ModelInter...SiteRepositoryInterface. Did you maybe mean findByAliasDomain()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
129
130
        $this->assertCount($count, $sites);
131
    }
132
}
133