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.

Helper/RemoteSlide/RemoteSlideHandler.php (1 issue)

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\MediaBundle\Helper\RemoteSlide;
4
5
use Kunstmaan\MediaBundle\Entity\Media;
6
use Kunstmaan\MediaBundle\Form\RemoteSlide\RemoteSlideType;
7
use Kunstmaan\MediaBundle\Helper\Media\AbstractMediaHandler;
8
9
/**
10
 * RemoteSlideStrategy
11
 */
12
class RemoteSlideHandler extends AbstractMediaHandler
13
{
14
    /**
15
     * @var string
16
     */
17
    const CONTENT_TYPE = 'remote/slide';
18
19
    const TYPE = 'slide';
20
21
    /**
22
     * @return string
23
     */
24
    public function getName()
25
    {
26
        return 'Remote Slide Handler';
27
    }
28
29
    /**
30
     * @return string
31
     */
32
    public function getType()
33
    {
34
        return RemoteSlideHandler::TYPE;
35
    }
36
37
    /**
38
     * @return string
39
     */
40
    public function getFormType()
41
    {
42
        return RemoteSlideType::class;
43
    }
44
45
    /**
46
     * @param mixed $object
47
     *
48
     * @return bool
49
     */
50 View Code Duplication
    public function canHandle($object)
51
    {
52
        if (
53
            (\is_string($object)) ||
54
            ($object instanceof Media && $object->getContentType() == RemoteSlideHandler::CONTENT_TYPE)
55
        ) {
56
            return true;
57
        }
58
59
        return false;
60
    }
61
62
    /**
63
     * @param Media $media
64
     *
65
     * @return RemoteSlideHelper
66
     */
67
    public function getFormHelper(Media $media)
68
    {
69
        return new RemoteSlideHelper($media);
70
    }
71
72
    /**
73
     * @param Media $media
74
     *
75
     * @throws \RuntimeException when the file does not exist
76
     */
77
    public function prepareMedia(Media $media)
78
    {
79
        if (null === $media->getUuid()) {
80
            $uuid = uniqid();
81
            $media->setUuid($uuid);
82
        }
83
        $slide = new RemoteSlideHelper($media);
84
        $code = $slide->getCode();
85
        // update thumbnail
86
        switch ($slide->getType()) {
87
            case 'slideshare':
88
                try {
89
                    $json = json_decode(
90
                        file_get_contents(
91
                            'https://www.slideshare.net/api/oembed/2?url=https://www.slideshare.net/slideshow/embed_code/key/' . $code . '&format=json'
92
                        )
93
                    );
94
                    $slide->setThumbnailUrl($json->thumbnail);
95
                } catch (\ErrorException $e) {
0 ignored issues
show
The class ErrorException does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
96
                    // Silent exception - should not bubble up since failure to create a thumbnail is not a fatal error
97
                }
98
99
                break;
100
        }
101
    }
102
103
    /**
104
     * @param Media $media
105
     */
106
    public function saveMedia(Media $media)
107
    {
108
    }
109
110
    /**
111
     * @param Media $media
112
     */
113
    public function removeMedia(Media $media)
114
    {
115
    }
116
117
    /**
118
     * {@inheritdoc}
119
     */
120
    public function updateMedia(Media $media)
121
    {
122
    }
123
124
    /**
125
     * @param array $params
126
     *
127
     * @return array
128
     */
129
    public function getAddUrlFor(array $params = array())
130
    {
131
        return array(
132
            'slide' => array(
133
                'path' => 'KunstmaanMediaBundle_folder_slidecreate',
134
                'params' => array(
135
                    'folderId' => $params['folderId'],
136
                ),
137
            ),
138
        );
139
    }
140
141
    /**
142
     * @param mixed $data
143
     *
144
     * @return Media
145
     */
146
    public function createNew($data)
147
    {
148
        $result = null;
149
        if (\is_string($data)) {
150
            if (strncmp($data, 'http', 4) !== 0) {
151
                $data = 'https://' . $data;
152
            }
153
            $parsedUrl = parse_url($data);
154
            switch ($parsedUrl['host']) {
155
                case 'www.slideshare.net':
156
                case 'slideshare.net':
157
                    $result = new Media();
158
                    $slide = new RemoteSlideHelper($result);
159
                    $slide->setType('slideshare');
160
                    $json = json_decode(
161
                        file_get_contents('https://www.slideshare.net/api/oembed/2?url=' . $data . '&format=json')
162
                    );
163
                    $slide->setCode($json->{'slideshow_id'});
164
                    $result = $slide->getMedia();
165
                    $result->setName('SlideShare ' . $data);
166
167
                    break;
168
            }
169
        }
170
171
        return $result;
172
    }
173
174
    /**
175
     * {@inheritdoc}
176
     */
177
    public function getShowTemplate(Media $media)
178
    {
179
        return '@KunstmaanMedia/Media/RemoteSlide/show.html.twig';
180
    }
181
182
    /**
183
     * @param Media  $media    The media entity
184
     * @param string $basepath The base path
185
     *
186
     * @return string
187
     */
188
    public function getImageUrl(Media $media, $basepath)
189
    {
190
        $helper = new RemoteSlideHelper($media);
191
192
        return $helper->getThumbnailUrl();
193
    }
194
195
    /**
196
     * @return array
197
     */
198
    public function getAddFolderActions()
199
    {
200
        return array(
201
            RemoteSlideHandler::TYPE => array(
202
                'type' => RemoteSlideHandler::TYPE,
203
                'name' => 'media.slide.add',
204
            ),
205
        );
206
    }
207
}
208