Issues (19)

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/FileParser/Ini.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
2
3
/**
4
 * Konfig.
5
 *
6
 * Yet another simple configuration loader library.
7
 *
8
 * PHP version 5
9
 *
10
 * @category Library
11
 * @package  Konfig
12
 * @author   Xeriab Nabil (aka KodeBurner) <[email protected]>
13
 * @license  https://raw.github.com/xeriab/konfig/master/LICENSE MIT
14
 * @link     https://xeriab.github.io/projects/konfig
15
 */
16
17
namespace Exen\Konfig\FileParser;
18
19
use Exception;
20
use Exen\Konfig\Exception\ParseException;
21
use Exen\Konfig\Utils;
22
23
/**
24
 * Konfig's INI parser class.
25
 *
26
 * @category FileParser
27
 * @package  Konfig
28
 * @author   Xeriab Nabil (aka KodeBurner) <[email protected]>
29
 * @license  https://raw.github.com/xeriab/konfig/master/LICENSE MIT
30
 * @link     https://xeriab.github.io/projects/konfig
31
 *
32
 * @implements Exen\Konfig\FileParser\AbstractFileParser
33
 */
34
class Ini extends AbstractFileParser
35
{
36
    /**
37
     * Parses an INI file as an array.
38
     *
39
     * @param string $path File path
40
     *
41
     * @throws ParseException If there is an error parsing INI file
42
     *
43
     * @return array The parsed data
44
     *
45
     * @since 0.1.0
46
     */
47 6
    public function parse($path)
48
    {
49 6
        $data = $this->loadFile($path);
50
51 6
        if (!$data || empty($data) || !is_array($data)) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $data of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
52 3
            throw new ParseException(error_get_last());
53
        }
54
55 3
        return $data;
56
    }
57
58
    /**
59
     * {@inheritdoc}
60
     *
61
     * @return array Supported extensions
62
     *
63
     * @since 0.1.0
64
     */
65 3
    public function getSupportedFileExtensions()
66
    {
67 3
        return ['ini', 'cfg'];
68
    }
69
70
    /**
71
     * Loads in the given file and parses it.
72
     *
73
     * @param string $file File to load
74
     *
75
     * @return array The parsed file data
76
     *
77
     * @since              0.2.4
78
     * @codeCoverageIgnore
79
     */
80
    protected function loadFile($file = null)
81
    {
82
        $this->file = $file;
83
        $contents = $this->parseVars(Utils::getContent($file));
84
85
        return @parse_ini_string($contents, true);
86
    }
87
88
    /**
89
     * Returns the formatted configuration file contents.
90
     *
91
     * @param array $contents configuration array
92
     *
93
     * @return string formatted configuration file contents
94
     *
95
     * @since              0.2.4
96
     * @codeCoverageIgnore
97
     */
98
    protected function exportFormat($contents = null)
99
    {
100
        throw new Exception(
101
            'Saving configuration to `INI` is not supported at this time'
102
        );
103
    }
104
105
    /**
106
     * __toString.
107
     *
108
     * @return             string
109
     * @since              0.1.2
110
     * @codeCoverageIgnore
111
     */
112
    public function __toString()
113
    {
114
        return 'Exen\Konfig\FileParser\Ini' . PHP_EOL;
115
    }
116
}
117
118
// END OF ./src/FileParser/Ini.php FILE
119