Issues (86)

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.

src/Trucker/Bootstrapper.php (2 issues)

1
<?php
2
3
namespace Trucker;
4
5
use Illuminate\Container\Container;
6
7
/**
8
 * Finds configurations and paths.
9
 *
10
 * @author Alessandro Manno <[email protected]>
11
 */
12
class Bootstrapper
13
{
14
    /**
15
     * The Container.
16
     *
17
     * @var Container
18
     */
19
    protected $container;
20
21
    /**
22
     * Build a new Bootstrapper.
23
     *
24
     * @param Container $app
25
     */
26 6
    public function __construct(Container $app)
27
    {
28 6
        $this->app = $app;
0 ignored issues
show
Bug Best Practice introduced by
The property app does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
29 6
    }
30
31
    /**
32
     * Bind paths to the container.
33
     */
34 6
    public function bindPaths()
35
    {
36 6
        $this->bindBase();
37 6
        $this->bindConfiguration();
38 6
    }
39
40
    /**
41
     * Get the path to the configuration folder.
42
     *
43
     * @return string
44
     */
45 2
    public function getConfigurationPath()
46
    {
47
        // Return path to Laravel configuration
48 2
        if ($this->app->bound('path')) {
49 2
            $laravel = $this->app['path'] . '/config/packages/alexmanno/trucker';
50 2
            if (file_exists($laravel)) {
51
                return $laravel;
52
            }
53
        }
54
55 2
        return $this->app['path.trucker.config'];
56
    }
57
58
    /**
59
     * Export the configuration files.
60
     */
61 2
    public function exportConfiguration()
62
    {
63 2
        $source = __DIR__ . '/../config';
64 2
        $destination = $this->getConfigurationPath();
65
66
        // Unzip configuration files
67 2
        $this->app['files']->copyDirectory($source, $destination);
68
69 2
        return $destination;
70
    }
71
72
    /**
73
     * Replace placeholders in configuration.
74
     *
75
     * @param string $folder
76
     * @param array  $values
77
     */
78 1
    public function updateConfiguration($folder, array $values = [])
79
    {
80
        // Replace stub values in files
81 1
        $files = $this->app['files']->files($folder);
82 1
        foreach ($files as $file) {
83 1
            foreach ($values as $name => $value) {
84 1
                $contents = str_replace('{' . $name . '}', $value, file_get_contents($file));
85 1
                $this->app['files']->put($file, $contents);
86
            }
87
        }
88 1
    }
89
90
    /**
91
     * Bind the base path to the Container.
92
     */
93 6
    protected function bindBase()
94
    {
95 6
        if ($this->app->bound('path.base')) {
96 1
            return;
97
        }
98
99 5
        $this->app->instance('path.base', getcwd());
100 5
    }
101
102
    /**
103
     * Bind paths to the configuration files.
104
     */
105 6
    protected function bindConfiguration()
106
    {
107 6
        $path = $this->app['path.base'] ? $this->app['path.base'] . '/' : '';
108 6
        $logs = $this->app->bound('path.storage') ? str_replace($this->unifySlashes($path), null, $this->unifySlashes($this->app['path.storage'])) : '.trucker';
109
110
        $paths = [
111 6
            'config' => '.trucker',
112 6
            'logs' => $logs . '/logs',
113
        ];
114
115 6
        foreach ($paths as $key => $file) {
116 6
            $filename = $path . $file;
117
118
            // Check whether we provided a file or folder
119 6
            if (!is_dir($filename) and file_exists($filename . '.php')) {
120
                $filename .= '.php';
121
            }
122
123
            // Use configuration in current folder if none found
124 6
            $realpath = realpath('.') . '/' . $file;
0 ignored issues
show
Are you sure realpath('.') of type false|string can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

124
            $realpath = /** @scrutinizer ignore-type */ realpath('.') . '/' . $file;
Loading history...
125 6
            if (!file_exists($filename) and file_exists($realpath)) {
126
                $filename = $realpath;
127
            }
128
129 6
            $this->app->instance('path.trucker.' . $key, $filename);
130
        }
131 6
    }
132
133
    /**
134
     * Unify the slashes to the UNIX mode (forward slashes).
135
     *
136
     * @param string $path
137
     *
138
     * @return string
139
     */
140 5
    protected function unifySlashes($path)
141
    {
142 5
        return str_replace('\\', '/', $path);
143
    }
144
}
145