Issues (20)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  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.
  Header Injection
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/ImageHelper.php (2 issues)

1
<?php
2
3
namespace Devmachine\Bundle\OntheioBundle\Helper;
4
5
use Devmachine\Bundle\OntheioBundle\Client\Image\Signer;
6
7
class ImageHelper
8
{
9
    private $signer;
10
    private $baseUrl;
11
12
    public function __construct(Signer $signer, $baseUrl)
13
    {
14
        $this->signer = $signer;
15
        $this->baseUrl = $baseUrl;
16
    }
17
18
    /**
19
     * @param string $key
20
     *
21
     * @return string
22
     */
23
    public function url($key)
24
    {
25
        return sprintf('%s/%s.%s.jpg', $this->baseUrl, $key, $this->signer->signSimple($key));
26
    }
27
28
    /**
29
     * @param string $key
30
     * @param int    $width
31
     * @param int    $height
32
     *
33
     * @return string
34
     *
35
     * @throws \InvalidArgumentException
36
     */
37
    public function resizeUrl($key, $width = null, $height = null)
38
    {
39
        if (!$width && !$height) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $width of type null|integer is loosely compared to false; this is ambiguous if the integer can be 0. You might want to explicitly use === null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For integer values, zero is a special case, in particular the following results might be unexpected:

0   == false // true
0   == null  // true
123 == false // false
123 == null  // false

// It is often better to use strict comparison
0 === false // false
0 === null  // false
Loading history...
Bug Best Practice introduced by
The expression $height of type null|integer is loosely compared to false; this is ambiguous if the integer can be 0. You might want to explicitly use === null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For integer values, zero is a special case, in particular the following results might be unexpected:

0   == false // true
0   == null  // true
123 == false // false
123 == null  // false

// It is often better to use strict comparison
0 === false // false
0 === null  // false
Loading history...
40
            throw new \InvalidArgumentException('Either width or height must be set for the key.');
41
        }
42
43
        return $this->url($key.'.r'.$width.'x'.$height);
44
    }
45
46
    /**
47
     * @param string $key
48
     * @param int    $width
49
     * @param int    $height
50
     * @param int    $left
51
     * @param int    $top
52
     *
53
     * @return string
54
     */
55
    public function cropUrl($key, $width, $height, $left, $top)
56
    {
57
        return $this->url($key.'.c'.$width.'x'.$height.'x'.$left.'x'.$top);
58
    }
59
}
60