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.

UpdateMediaReferenceSubscriberTest.php (1 issue)

Labels
Severity

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\MediaAdminBundle\EventSubscriber;
4
5
use OpenOrchestra\FunctionalTests\Utils\AbstractAuthenticatedTest;
6
use OpenOrchestra\Media\Model\MediaInterface;
7
use OpenOrchestra\MediaModelBundle\Document\Media;
8
use OpenOrchestra\ModelBundle\Document\Block;
9
use OpenOrchestra\ModelBundle\Document\Node;
10
use Symfony\Component\EventDispatcher\EventDispatcher;
11
use OpenOrchestra\ModelInterface\Event\BlockEvent;
12
use OpenOrchestra\ModelInterface\BlockEvents;
13
14
/**
15
 * Class UpdateMediaReferenceSubscriberTest
16
 *
17
 * @group media
18
 */
19
class UpdateMediaReferenceSubscriberTest extends AbstractAuthenticatedTest
20
{
21
    const ATTRIBUTE_ID_SUFFIX = "Id";
22
    const METHOD_SUFFIX = "BlockConfiguration";
23
24
    /**
25
     * @var Node node
26
     */
27
    protected $node;
28
29
    /**
30
     * @var array medias
31
     */
32
    protected $medias;
33
34
    /**
35
     * @var EventDispatcher eventDispatcher
36
     */
37
    protected $eventDispatcher;
38
39
    /**
40
     * Set up the test
41
     */
42
    public function setUp()
43
    {
44
        parent::setUp();
45
46
        $mediaRepository = static::$kernel->getContainer()->get('open_orchestra_media.repository.media');
47
        $this->medias = array(
48
            $mediaRepository->findOneByName("Image 03"),
49
            $mediaRepository->findOneByName("Image 04")
50
        );
51
        $this->eventDispatcher = static::$kernel->getContainer()->get('event_dispatcher');
52
    }
53
54
    /**
55
     * @param array  $blockType
56
     * @param int    $mediaIndex
57
     *
58
     * @dataProvider provideMediaBlocks
59
     */
60
    public function testAddMediaBlocks(array $blockType, $mediaIndex)
61
    {
62
        /** @var Media $media */
63
        $media = $this->medias[$mediaIndex];
64
        $this->checkMediaReference($media, array());
65
66
        $block = $this->generateBlock($blockType['component']);
67
        $attributes = $block->getAttributes();
68
        $attributes['pictures'] = array(array('id' => $media->getId(), 'format' => ''));
69
        $attributes['id'] = $blockType["component"] . self::ATTRIBUTE_ID_SUFFIX;
70
        $method = $blockType["component"] . self::METHOD_SUFFIX;
71
        $attributes = $this->$method($attributes);
72
        $block->setAttributes($attributes);
73
74
        $event = new BlockEvent($block);
75
76
        $this->eventDispatcher->dispatch(BlockEvents::POST_BLOCK_UPDATE, $event);
77
78
        $expectedReference = array('block' => array($block->getId() => $block->getId()));
79
        $this->checkMediaReference($media, $expectedReference);
80
    }
81
82
    /**
83
     * @return array
84
     */
85
    public function provideMediaBlocks()
86
    {
87
        return array(
88
            array(array("component" => "gallery"), 0),
89
            array(array("component" => "slideshow"), 1),
90
        );
91
    }
92
93
    /**
94
     * @param MediaInterface $media
95
     * @param array          $expectedReference
96
     */
97
    protected function checkMediaReference($media, $expectedReference)
98
    {
99
        $references = $media->getUseReferences();
100
        $this->assertEquals($references, $expectedReference);
101
    }
102
103
    /**
104
     * @param array $attributes
105
     *
106
     * @return array
107
     */
108
    protected function slideshowBlockConfiguration($attributes)
109
    {
110
        $attributes['height'] = 200;
111
        $attributes['width'] = 250;
112
113
        return $attributes;
114
    }
115
116
    /**
117
     * @param array $attributes
118
     *
119
     * @return array
120
     */
121
    protected function galleryBlockConfiguration($attributes)
122
    {
123
        $attributes['imageFormat'] = MediaInterface::MEDIA_ORIGINAL;
124
        $attributes['thumbnailFormat'] = MediaInterface::MEDIA_ORIGINAL;
125
        $attributes['width'] = '';
126
127
        return $attributes;
128
    }
129
130
    /**
131
     * @param string $blockType
132
     * @param string $id
0 ignored issues
show
There is no parameter named $id. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
133
     *
134
     * @return Block
135
     */
136
    protected function generateBlock($blockType)
137
    {
138
        $block = new Block();
139
        $block->setComponent($blockType);
140
141
        static::$kernel->getContainer()->get('object_manager')->persist($block);
142
        static::$kernel->getContainer()->get('object_manager')->flush();
143
144
        return $block;
145
    }
146
}
147