Issues (9)

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/Bootstrap.php (9 issues)

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
 * Jaeger
4
 *
5
 * @author		Eric Lamb <[email protected]>
6
 * @copyright	Copyright (c) 2015-2016, mithra62, Eric Lamb
7
 * @link		http://jaeger-app.com
8
 * @version		1.0
9
 * @filesource 	./Bootstrap.php
10
 */
11
namespace JaegerApp;
12
13
use JaegerApp\Di;
14
use JaegerApp\Encrypt;
15
use JaegerApp\Db;
16
use JaegerApp\Language;
17
use JaegerApp\Validate;
18
use JaegerApp\Files;
19
use JaegerApp\Errors;
20
use JaegerApp\License;
21
use JaegerApp\Email;
22
use JaegerApp\View;
23
use JaegerApp\Regex;
24
use JaegerApp\Shell;
25
use JaegerApp\Console; 
26
27
/**
28
 * Jaeger - Bootstrap Object
29
 *
30
 * Sets up the environment and needed objects
31
 *
32
 * @package Bootstrap
33
 */
34
class Bootstrap extends Di
35
{
36
    /**
37
     * The language file to load
38
     * 
39
     * @var array
40
     */
41
    protected $lang_file = null;
42
43
    /**
44
     * The paths to look for language files at
45
     * 
46
     * @var array
47
     */
48
    protected $lang_paths = array();
49
50
    /**
51
     * The environment config details
52
     * 
53
     * @var array
54
     */
55
    protected $config = array(
56
        'db' => array()
57
    );
58
59
    /**
60
     *
61
     * @ignore
62
     *
63
     */
64
    public function __construct()
65
    {
66
        parent::__construct();
67
        $this->setLangPath(realpath(dirname(__FILE__) . '/language'));
68
    }
69
70
    /**
71
     * Sets a language paths to use
72
     * 
73
     * @param string $path            
74
     */
75
    public function setLangPath($path)
76
    {
77
        $this->lang_paths[base64_encode($path)] = $path;
78
        return $this;
79
    }
80
81
    /**
82
     * Returns the set language paths
83
     * 
84
     * @return \mithra62\array
85
     */
86
    public function getLangPath()
87
    {
88
        return $this->lang_paths;
89
    }
90
91
    /**
92
     * Sets the database connection details
93
     * 
94
     * @param array $config            
95
     */
96
    public function setDbConfig(array $config)
97
    {
98
        $this->config['db'] = $config;
99
        return $this;
100
    }
101
102
    /**
103
     * Returns the database configuration details
104
     * 
105
     * @return array
106
     */
107
    public function getDbConfig()
108
    {
109
        return $this->config['db'];
110
    }
111
112
    /**
113
     * Sets up and returns all the objects we'll use
114
     * 
115
     * @return \Pimple\Container
116
     */
117
    public function getServices()
118
    {
119
        $this->container = parent::getServices();
120
        $this->container['db'] = function ($c) {
0 ignored issues
show
The parameter $c is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
121
            $db = new Db();
122
            $db->setCredentials($this->getDbConfig());
123
            $type = 'mysqli';
124
            if(class_exists('Pdo')) {
125
                $type = 'pdo';
126
            }
127
            
128
            $db->setAccessType($type);
129
            return $db;
130
        };
131
        
132
        $this->container['encrypt'] = function ($c) {
133
            $encrypt = new Encrypt();
134
            $new_key = $c['platform']->getEncryptionKey();
135
            $encrypt->setKey($new_key);
136
            return $encrypt;
137
        };
138
        
139
        $this->container['lang'] = function ($c) {
0 ignored issues
show
The parameter $c is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
140
            $lang = new Language();
141
            if (is_array($this->getLangPath())) {
142
                foreach ($this->getLangPath() as $path) {
143
                    $lang->init($path);
144
                }
145
            } elseif ($this->getLangPath() != '') {
146
                $lang->init($this->getLangPath());
147
            }
148
            return $lang;
149
        };
150
        
151
        $this->container['validate'] = function ($c) {
0 ignored issues
show
The parameter $c is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
152
            $validate = new Validate();
153
            $validate->setRegex($this->container['regex']);
154
            return $validate;
155
        };
156
        
157
        $this->container['files'] = function ($c) {
0 ignored issues
show
The parameter $c is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
158
            $file = new Files();
159
            return $file;
160
        };
161
        
162
        $this->container['errors'] = function ($c) {
163
            $errors = new Errors();
164
            $errors->setValidation($c['validate']);
165
            return $errors;
166
        };
167
        
168
        $this->container['license'] = function ($c) {
0 ignored issues
show
The parameter $c is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
169
            $license = new License();
170
            return $license;
171
        };
172
        
173
        $this->container['email'] = function ($c) {
174
            
175
            $email = new Email();
176
            $email->setView($c['view']);
177
            $email->setLang($c['lang']);
178
            return $email;
179
        };
180
        
181
        $this->container['view'] = function ($c) {
0 ignored issues
show
The parameter $c is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
182
            $view = new View();
183
            $helpers = array(
184
                'file_size' => function ($text) {
185
                    return $this->container['view_helpers']->m62FileSize($text, false);
186
                },
187
                'lang' => function ($text) {
188
                    return $this->container['view_helpers']->m62Lang($text);
189
                },
190
                'date_time' => function ($text, $html = true) {
0 ignored issues
show
The parameter $html is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
191
                    return $this->container['view_helpers']->m62DateTime($text, false);
192
                },
193
                'relative_time' => function ($date) {
194
                    return $this->container['view_helpers']->m62RelativeDateTime($date);
195
                },
196
                'encode' => function ($text) {
197
                    return $this->container['view_helpers']->m62Encode($text);
198
                },
199
                'decode' => function ($text) {
200
                    return $this->container['view_helpers']->m62Decode($text);
201
                }
202
            );
203
            
204
            $view->addHelper('m62', $helpers);
205
            return $view;
206
        };
207
        
208
        $this->container['regex'] = function ($c) {
0 ignored issues
show
The parameter $c is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
209
            $regex = new Regex();
210
            return $regex;
211
        };
212
        
213
        $this->container['shell'] = function ($c) {
0 ignored issues
show
The parameter $c is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
214
            $shell = new Shell();
215
            return $shell;
216
        };
217
        
218
        $this->container['console'] = function ($c) {
219
            $console = new Console();
220
            $console->setLang($c['lang']);
221
            return $console;
222
        };
223
        
224
        return $this->container;
225
    }
226
}