Issues (387)

Branch: develop

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/phpDocumentor/Parser/SpecificationFactory.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
declare(strict_types=1);
3
4
/**
5
 * This file is part of phpDocumentor.
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @author    Mike van Riel <[email protected]>
11
 * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com)
12
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
13
 * @link      http://phpdoc.org
14
 */
15
16
namespace phpDocumentor\Parser;
17
18
use Flyfinder\Path;
19
use Flyfinder\Specification\AndSpecification;
20
use Flyfinder\Specification\HasExtension;
21
use Flyfinder\Specification\InPath;
22
use Flyfinder\Specification\IsHidden;
23
use Flyfinder\Specification\NotSpecification;
24
use Flyfinder\Specification\OrSpecification;
25
use Flyfinder\Specification\SpecificationInterface;
26
use phpDocumentor\Parser\SpecificationFactoryInterface as FactoryInterface;
27
28
/**
29
 * Factory class to build Specification used by FlyFinder when reading files to process.
30
 */
31
final class SpecificationFactory implements FactoryInterface
32
{
33
    /**
34
     * Creates a SpecificationInterface object based on the ignore and extension parameters.
35
     *
36
     * @var (\phpDocumentor\Path|string)[] $paths
37
     * @var (\phpDocumentor\Path|string)[] $ignore
38
     * @var string[] $extensions
39
     */
40 4
    public function create(array $paths, array $ignore, array $extensions): SpecificationInterface
41
    {
42 4
        $pathSpec = null;
43 4
        foreach ($paths as $path) {
44 3
            if ($pathSpec === null) {
45 3
                $pathSpec = $this->inPath((string) $path);
46 3
                continue;
47
            }
48
49 1
            $pathSpec = $this->orSpec($this->inPath($path), $pathSpec);
50
        }
51
52 4
        $ignoreSpec = null;
53 4
        foreach ($ignore['paths'] ?? [] as $path) {
0 ignored issues
show
The expression $ignore['paths'] ?? array() of type object<phpDocumentor\Path>|string|array is not guaranteed to be traversable. How about adding an additional type check?

There are different options of fixing this problem.

  1. If you want to be on the safe side, you can add an additional type-check:

    $collection = json_decode($data, true);
    if ( ! is_array($collection)) {
        throw new \RuntimeException('$collection must be an array.');
    }
    
    foreach ($collection as $item) { /** ... */ }
    
  2. If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:

    /** @var array $collection */
    $collection = json_decode($data, true);
    
    foreach ($collection as $item) { /** .. */ }
    
  3. Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.

Loading history...
54 2
            if ($ignoreSpec === null) {
55 2
                $ignoreSpec = $this->inPath((string) $path);
56 2
                continue;
57
            }
58
59 1
            $ignoreSpec = $this->orSpec($this->inPath((string) $path), $ignoreSpec);
60
        }
61
62 4
        if (($ignore['hidden'] ?? false) === true) {
63 1
            $ignoreSpec = $ignoreSpec === null
64 1
                ? new IsHidden()
65 1
                : $this->orSpec(new IsHidden(), $ignoreSpec);
66
        }
67
68 4
        $result = new HasExtension($extensions);
69 4
        if ($ignoreSpec !== null) {
70 3
            $result = $this->andSpec($result, $this->notSpec($ignoreSpec));
71
        }
72 4
        if ($pathSpec !== null) {
73 3
            $result = $this->andSpec($pathSpec, $result);
74
        }
75
76 4
        return $result;
77
    }
78
79 4
    private function inPath(string $path): InPath
80
    {
81 4
        return new InPath(new Path((string) $path));
82
    }
83
84 2
    private function orSpec(SpecificationInterface $or, SpecificationInterface $spec): SpecificationInterface
85
    {
86 2
        return new OrSpecification($spec, $or);
87
    }
88
89 3
    private function notSpec(SpecificationInterface $ignoreSpec): SpecificationInterface
90
    {
91 3
        return new NotSpecification($ignoreSpec);
92
    }
93
94 4
    private function andSpec(SpecificationInterface $spec, SpecificationInterface $spec2): SpecificationInterface
95
    {
96 4
        return new AndSpecification($spec, $spec2);
97
    }
98
}
99