GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (4)

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.

src/Compilers/Base.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 declare(strict_types=1);
2
////////////////////////////////////////////////////////////////////////////////
3
// __________ __             ________                   __________
4
// \______   \  |__ ______  /  _____/  ____ _____ ______\______   \ _______  ___
5
//  |     ___/  |  \\____ \/   \  ____/ __ \\__  \\_  __ \    |  _//  _ \  \/  /
6
//  |    |   |   Y  \  |_> >    \_\  \  ___/ / __ \|  | \/    |   (  <_> >    <
7
//  |____|   |___|  /   __/ \______  /\___  >____  /__|  |______  /\____/__/\_ \
8
//                \/|__|           \/     \/     \/             \/            \/
9
// -----------------------------------------------------------------------------
10
//          Designed and Developed by Brad Jones <brad @="bjc.id.au" />
11
// -----------------------------------------------------------------------------
12
////////////////////////////////////////////////////////////////////////////////
13
14
namespace Gears\Asset\Compilers;
15
16
use SplFileInfo;
17
use RuntimeException;
18
use Gears\String\Str;
19
use Gears\Asset\Contracts\Compiler;
20
use Gears\Asset\Contracts\Minifier;
21
22
class Base implements Compiler
23
{
24
    /**
25
     * We represent the source file that needs to be compiled.
26
     *
27
     * @var SplFileInfo
28
     */
29
    protected $file;
30
31
    /**
32
     * We represent the final destination asset file that will be created.
33
     *
34
     * @var SplFileInfo
35
     */
36
    protected $destination;
37
38
    /**
39
     * If the $file is indeed a file we will read it's contents into this
40
     * property. Remember it's possible that we are given a folder...
41
     *
42
     * @var string
43
     */
44
    protected $source = '';
45
46
    /**
47
     * This basically tells us if we are allowed to minify the compiled source.
48
     *
49
     * @var bool
50
     */
51
    protected $debug;
52
53
    /**
54
     * Only applies when building css assets.
55
     * Used in conjuction with: ```vladkens/autoprefixer-php```.
56
     *
57
     * @var bool
58
     */
59
    protected $autoprefix;
60
61
    public function __construct(SplFileInfo $file, SplFileInfo $destination, bool $debug, bool $autoprefix)
62
    {
63
        $this->file = $file;
64
65
        if (!$this->file->isDir())
66
        {
67
            $this->source = file_get_contents($this->file->getPathname());
68
        }
69
70
        $this->destination = $destination;
71
72
        $this->debug = $debug;
73
74
        $this->autoprefix = $autoprefix;
75
    }
76
77
    /**
78
     * @inheritDoc
79
     *
80
     * This implementation caters for both standard native Css and Js files
81
     * that don't need any compiling as such. The less and sass compilers
82
     * extend the css compiler.
83
     */
84
    public function compile(): string
85
    {
86
        if ($this->doWeNeedToMinify($this->file))
87
        {
88
            $src = $this->getMinifier($this->file, $this->source)->minify();
89
90
            // Remove any source mappings, they cause 404 errors.
91
            // One of the benefits of using this Robo Task is that it is super
92
            // easy to switch between a minifed asset and a non minified asset.
93
            $src = preg_replace('/^\/\/# sourceMappingURL.*$/m', '', $src);
94
95
            // TODO: generate our own source maps... sounds like a challenge :)
0 ignored issues
show
Coding Style Best Practice introduced by
Comments for TODO tasks are often forgotten in the code; it might be better to use a dedicated issue tracker.
Loading history...
96
        }
97
        else
98
        {
99
            $src = $this->source;
100
        }
101
102
        return $src."\n\n";
103
    }
104
105
    /**
106
     * Creates the minfier object.
107
     *
108
     * @param  SplFileInfo $file   The original source file.
109
     * @param  string      $source The source code to minify.
110
     * @return Minifier            A minifier for the given destination type.
111
     */
112
    protected function getMinifier(SplFileInfo $file, string $source): Minifier
113
    {
114
        $minifier = '\Gears\Asset\Minifiers\\';
115
        $minifier .= ucfirst($this->destination->getExtension());
116
117
        if (!class_exists($minifier))
118
        {
119
            throw new RuntimeException
120
            (
121
                'Minification is not supported for type: '.
122
                $this->destination->getExtension()
123
            );
124
        }
125
126
        return new $minifier($file, $source);
127
    }
128
129
    /**
130
     * Based on if we are in debug mode and if the file is already minfied or
131
     * not, this tells us if we actually need to perform any minification.
132
     *
133
     * @param  SplFileInfo $file The original source file.
134
     * @return bool              If true we will run the minifier.
135
     */
136
    protected function doWeNeedToMinify(SplFileInfo $file): bool
137
    {
138
        return
139
        (
140
            !$this->debug &&
141
            !Str::s($file->getFilename())->contains('.min.')
142
        );
143
    }
144
}
145