Issues (6)

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.

Command/DumpCommand.php (6 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 Symfony\Bundle\AsseticBundle\Command;
4
5
use Symfony\Component\Console\Output\OutputInterface;
6
7
/**
8
 * Class GzipProperties for wrapping variables to file_put_contents
9
 *
10
 * @author KonstantinKuklin <[email protected]>
11
 */
12
class GzipProperties
13
{
14
    /**
15
     * Is compression enabled
16
     *
17
     * @var bool
18
     */
19
    public static $use = false;
20
21
    /**
22
     * Level of compression
23
     *
24
     * @var int
25
     */
26
    public static $level = 9;
27
28
    /**
29
     * Output flow interface
30
     *
31
     * @var OutputInterface
32
     */
33
    public static $output = null;
34
}
35
36
/**
37
 * Override standard function file_put_contents for
38
 * Symfony\Bundle\AsseticBundle\Command namespace
39
 *
40
 * @param string $filePath Assetic file path
41
 * @param string $content  Assetic file content
42
 */
43
function file_put_contents($filePath, $content)
44
{
45
    // save assetic file
46
    @\file_put_contents($filePath, $content);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
47
48
    // check gzipping
49
    if (GzipProperties::$use) {
50
51
        // check gzip extension
52
        if (!function_exists("gzencode")) {
53
            throw new \RuntimeException('Unable to find Zlib library');
54
        }
55
56
        $filePath .= '.gz';
57
        GzipProperties::$output->writeln(
58
            sprintf(
59
                '<comment>%s</comment> <info>[gzipped file+]</info> %s',
60
                date('H:i:s'),
61
                $filePath
62
            )
63
        );
64
65
        if (false === @\file_put_contents($filePath, gzencode($content, GzipProperties::$level))) {
66
            throw new \RuntimeException('Unable to write file ' . $filePath);
67
        }
68
    }
69
}
70
71
namespace KonstantinKuklin\AsseticStaticGzipBundle\Command;
72
73
use Symfony\Bundle\AsseticBundle\Command\DumpCommand as BaseCommand;
0 ignored issues
show
USE declarations must go after the first namespace declaration
Loading history...
74
use Symfony\Bundle\AsseticBundle\Command\GzipProperties;
0 ignored issues
show
USE declarations must go after the first namespace declaration
Loading history...
75
use Symfony\Component\Console\Input\InputInterface;
0 ignored issues
show
USE declarations must go after the first namespace declaration
Loading history...
76
use Symfony\Component\Console\Output\OutputInterface;
0 ignored issues
show
USE declarations must go after the first namespace declaration
Loading history...
77
78
/**
79
 * Override assetic bundle command for gzip purposes.
80
 *
81
 * @author Konstantin Kuklin <[email protected]>
82
 */
83
class DumpCommand extends BaseCommand
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
84
{
85
    /**
86
     * {@inheritdoc}
87
     */
88
    protected function initialize(InputInterface $input, OutputInterface $output)
89
    {
90
        // save properties
91
        GzipProperties::$use = $this->getContainer()->getParameter('assetic_static_gzip.use');
92
        GzipProperties::$level = $this->getContainer()->getParameter('assetic_static_gzip.level');
93
        GzipProperties::$output = $output;
94
95
        parent::initialize($input, $output);
96
    }
97
}
98