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 (27)

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/Component/Config/ChapiConfig.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
 * @package: chapi
4
 *
5
 * @author:  msiebeneicher
6
 * @since:   2017-03-22
7
 *
8
 */
9
10
namespace Chapi\Component\Config;
11
12
use Symfony\Component\Yaml\Parser as YamlParser;
13
14
class ChapiConfig implements ChapiConfigInterface
15
{
16
    /**
17
     * @var string[]
18
     */
19
    private $directoryPaths = [];
20
21
    /**
22
     * @var YamlParser
23
     */
24
    private $parser;
25
26
    /**
27
     * @var string
28
     */
29
    private $activeProfile = '';
30
31
    /**
32
     * @var array
33
     */
34
    private $config = null;
35
36
    /**
37
     * ChapiConfig constructor.
38
     * @param string[] $directoryPaths
39
     * @param YamlParser $parser
40
     * @param string $activeProfile
41
     */
42 3
    public function __construct(
43
        $directoryPaths,
44
        YamlParser $parser,
45
        $activeProfile
46
    ) {
47 3
        $this->directoryPaths = $directoryPaths;
48 3
        $this->parser = $parser;
49 3
        $this->activeProfile = $activeProfile;
50 3
    }
51
52
    /**
53
     * @inheritdoc
54
     */
55 2
    public function getProfileConfig()
56
    {
57 2
        $config = $this->getConfig();
58 2
        return $config['profiles'][$this->activeProfile];
59
    }
60
61
    /**
62
     * @inheritdoc
63
     */
64 3
    public function getConfig()
65
    {
66 3
        if (is_null($this->config)) {
67 3
            $this->config = $this->loadConfigs();
68
        }
69
70 3
        return $this->config;
71
    }
72
73
    /**
74
     * @return array
75
     */
76 3
    private function loadConfigs()
77
    {
78 3
        $config = [];
79
80 3
        foreach ($this->directoryPaths as $directoryPath) {
81 3
            if (!is_dir($directoryPath)) {
82
                throw new \InvalidArgumentException(sprintf('Path "%s" is not valid', $directoryPath));
83
            }
84
85 3
            $configPart = $this->loadConfig($directoryPath);
86 3
            $config = self::arrayMergeRecursiveDistinct($config, $configPart);
87
        }
88
89 3
        return $config;
90
    }
91
92
    /**
93
     * @param string $path
94
     * @return array
0 ignored issues
show
Should the return type not be null|\Symfony\Component\...|string|array|\stdClass? Also, consider making the array more specific, something like array<String>, or String[].

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

If the return type contains the type array, this check recommends the use of a more specific type like String[] or array<String>.

Loading history...
95
     */
96 3
    private function loadConfig($path)
97
    {
98 3
        $filePath = $path . DIRECTORY_SEPARATOR . self::CONFIG_FILE_NAME;
99
100 3
        if (is_file($filePath)) {
101 3
            $config = $this->parser->parse(
102 3
                file_get_contents($filePath)
103
            );
104
105 3
            return $config;
106
        }
107
108
        return [];
109
    }
110
111
    /**
112
     * array_merge_recursive does indeed merge arrays, but it converts values with duplicate
113
     * keys to arrays rather than overwriting the value in the first array with the duplicate
114
     * value in the second array, as array_merge does. I.e., with array_merge_recursive,
115
     * this happens (documented behavior):
116
     *
117
     * array_merge_recursive(array('key' => 'org value'), array('key' => 'new value'));
118
     *     => array('key' => array('org value', 'new value'));
119
     *
120
     * array_merge_recursive_distinct does not change the datatypes of the values in the arrays.
121
     * Matching keys' values in the second array overwrite those in the first array, as is the
122
     * case with array_merge, i.e.:
123
     *
124
     * array_merge_recursive_distinct(array('key' => 'org value'), array('key' => 'new value'));
125
     *     => array('key' => array('new value'));
126
     *
127
     * Parameters are passed by reference, though only for performance reasons. They're not
128
     * altered by this function.
129
     *
130
     * @param array $array1
131
     * @param array $array2
132
     * @return array
133
     * @author Daniel <daniel (at) danielsmedegaardbuus (dot) dk>
134
     * @author Gabriel Sobrinho <gabriel (dot) sobrinho (at) gmail (dot) com>
135
     *
136
     * @see http://php.net/manual/de/function.array-merge-recursive.php
137
     */
138 3
    private static function arrayMergeRecursiveDistinct(array &$array1, array &$array2)
139
    {
140 3
        $merged = $array1;
141
142 3
        foreach ($array2 as $key => &$value) {
143 3
            if (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) {
144 1
                $merged[$key] = self::arrayMergeRecursiveDistinct($merged[$key], $value);
145
            } else {
146
                // add new element for numeric arrays
147 3
                if (isset($merged[$key]) && is_numeric($key)) {
148 1
                    $merged[] = $value;
149
                } else {
150 3
                    $merged[$key] = $value;
151
                }
152
            }
153
        }
154
155 3
        return $merged;
156
    }
157
}
158