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/Blade.php (1 issue)

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 Arrilot\BitrixBlade;
4
5
use Illuminate\Container\Container;
6
use Illuminate\Events\Dispatcher;
7
use Illuminate\Filesystem\Filesystem;
8
use Illuminate\View\Engines\CompilerEngine;
9
use Illuminate\View\Engines\EngineResolver;
10
use Illuminate\View\Engines\PhpEngine;
11
use Illuminate\View\Factory;
12
13
class Blade
14
{
15
    /**
16
     * Array of view base directories.
17
     *
18
     * @var array
19
     */
20
    protected $viewPaths;
21
22
    /**
23
     * Local path to blade cache storage.
24
     *
25
     * @var string
26
     */
27
    protected $cachePath;
28
29
    /**
30
     * Service container instance.
31
     *
32
     * @var Container
33
     */
34
    protected $container;
35
36
    /**
37
     * View factory instance.
38
     *
39
     * @var Factory
40
     */
41
    protected $viewFactory;
42
43
    /**
44
     * Constructor.
45
     *
46
     * @param array     $viewPaths
47
     * @param string    $cachePath
48
     * @param Container $container
49
     */
50
    public function __construct($viewPaths = [], $cachePath, $container)
51
    {
52
        $this->viewPaths = $viewPaths;
53
        $this->cachePath = $cachePath;
54
        $this->container = $container;
55
56
        $this->registerFilesystem();
57
        $this->registerEvents();
58
        $this->registerEngineResolver();
59
        $this->registerViewFinder();
60
        $this->registerFactory();
61
    }
62
63
    /**
64
     * Getter for view factory.
65
     *
66
     * @return Factory
67
     */
68
    public function view()
69
    {
70
        return $this->viewFactory;
71
    }
72
73
    /**
74
     * Register filesystem in container.
75
     *
76
     * @return void
77
     */
78
    public function registerFilesystem()
79
    {
80
        $this->container->singleton('files', function () {
81
            return new Filesystem();
82
        });
83
    }
84
85
    /**
86
     * Register events in container.
87
     *
88
     * @return void
89
     */
90
    public function registerEvents()
91
    {
92
        $this->container->singleton('events', function () {
93
            return new Dispatcher();
94
        });
95
    }
96
97
    /**
98
     * Register the engine resolver instance.
99
     *
100
     * @return void
101
     */
102
    public function registerEngineResolver()
103
    {
104
        $me = $this;
105
106
        $this->container->singleton('view.engine.resolver', function () use ($me) {
107
            $resolver = new EngineResolver();
108
109
            $me->registerPhpEngine($resolver);
110
            $me->registerBladeEngine($resolver);
111
112
            return $resolver;
113
        });
114
    }
115
116
    /**
117
     * Register the PHP engine implementation.
118
     *
119
     * @param EngineResolver $resolver
120
     *
121
     * @return void
122
     */
123
    public function registerPhpEngine($resolver)
124
    {
125
        $resolver->register('php', function () {
126
            return new PhpEngine();
127
        });
128
    }
129
130
    /**
131
     * Register the Blade engine implementation.
132
     *
133
     * @param EngineResolver $resolver
134
     *
135
     * @return void
136
     */
137
    public function registerBladeEngine($resolver)
138
    {
139
        $me = $this;
140
        $app = $this->container;
141
142
        $this->container->singleton('blade.compiler', function ($app) use ($me) {
143
            $cache = $me->cachePath;
144
145
            return new BladeCompiler($app['files'], $cache);
146
        });
147
148
        $resolver->register('blade', function () use ($app) {
149
            return new CompilerEngine($app['blade.compiler'], $app['files']);
0 ignored issues
show
The call to CompilerEngine::__construct() has too many arguments starting with $app['files'].

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
150
        });
151
    }
152
153
    /**
154
     * Register the view factory.
155
     */
156
    public function registerFactory()
157
    {
158
        $resolver = $this->container['view.engine.resolver'];
159
160
        $finder = $this->container['view.finder'];
161
162
        $factory = new Factory($resolver, $finder, $this->container['events']);
163
        $factory->setContainer($this->container);
164
165
        //$factory->share('app', $this->container);
166
        $this->viewFactory = $factory;
167
    }
168
169
    /**
170
     * Register the view finder implementation.
171
     *
172
     * @return void
173
     */
174
    public function registerViewFinder()
175
    {
176
        $me = $this;
177
        $this->container->singleton('view.finder', function ($app) use ($me) {
178
            $paths = $me->viewPaths;
179
180
            return new ViewFinder($app['files'], $paths);
181
        });
182
    }
183
}
184