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

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/DynamicParser.php (1 issue)

Labels
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
namespace Minime\Annotations;
4
5
use Minime\Annotations\Interfaces\ParserInterface;
6
use Minime\Annotations\Types\DynamicType;
7
8
/**
9
 * An Annotations parser
10
 *
11
 * @package Annotations
12
 * @author  Márcio Almada and the Minime Community
13
 * @license MIT
14
 *
15
 */
16
class DynamicParser implements ParserInterface
17
{
18
    const TOKEN_ANNOTATION_IDENTIFIER = '@';
19
20
    const TOKEN_ANNOTATION_NAME = '[a-zA-Z\_\-\\\][a-zA-Z0-9\_\-\.\\\]*';
21
22
    /**
23
     * The regex to extract data from a single line
24
     *
25
     * @var string
26
     */
27
    protected $dataPattern;
28
29
    /**
30
     * Parser constructor
31
     *
32
     */
33
    public function __construct()
34
    {
35
        $this->dataPattern = '/(?<=\\'. self::TOKEN_ANNOTATION_IDENTIFIER .')('
36
            . self::TOKEN_ANNOTATION_NAME
37
            .')(((?!\s\\'. self::TOKEN_ANNOTATION_IDENTIFIER .').)*)/s';
38
    }
39
40
    /**
41
     * Parse a given docblock
42
     *
43
     * @param  string $docblock
44
     * @return array
45
     */
46
    public function parse($docblock)
47
    {
48
        $docblock = $this->getDocblockTagsSection($docblock);
49
        $annotations = $this->parseAnnotations($docblock);
50
        foreach ($annotations as &$value) {
51
            if (1 == count($value)) {
52
                $value = $value[0];
53
            }
54
        }
55
56
        return $annotations;
57
    }
58
59
    /**
60
     * Filters docblock tags section, removing unwanted long and short descriptions
61
     *
62
     * @param  string $docblock A docblok string without delimiters
63
     * @return string Tag section from given docblock
64
     */
65
    protected function getDocblockTagsSection($docblock)
66
    {
67
        $docblock = $this->sanitizeDocblock($docblock);
68
        preg_match('/^\s*\\'.self::TOKEN_ANNOTATION_IDENTIFIER.'/m', $docblock, $matches, PREG_OFFSET_CAPTURE);
69
70
        // return found docblock tag section or empty string
71
        return isset($matches[0]) ? substr($docblock, $matches[0][1]) : '';
72
    }
73
74
    /**
75
     * Filters docblock delimiters
76
     *
77
     * @param  string $docblock A raw docblok string
78
     * @return string A docblok string without delimiters
79
     */
80
    protected function sanitizeDocblock($docblock)
81
    {
82
        return preg_replace('/\s*\*\/$|^\s*\*\s{0,1}|^\/\*{1,2}/m', '', $docblock);
83
    }
84
85
    /**
86
     * Creates raw [annotation => value, [...]] tree
87
     *
88
     * @param  string $str
89
     * @return array
90
     */
91
    protected function parseAnnotations($str)
92
    {
93
        $annotations = [];
94
        preg_match_all($this->dataPattern, $str, $found);
95
        foreach ($found[2] as $key => $value) {
96
            $annotations[ $this->sanitizeKey($found[1][$key]) ][] = $this->parseValue($value, $found[1][$key]);
97
        }
98
99
        return $annotations;
100
    }
101
102
    /**
103
     * Parse a single annotation value
104
     *
105
     * @param  string $value
106
     * @param  string $key
107
     * @return mixed
108
     */
109
    protected function parseValue($value, $key = null)
110
    {
111
        return (new DynamicType)->parse(trim($value), $key);
0 ignored issues
show
It seems like $key defined by parameter $key on line 109 can also be of type string; however, Minime\Annotations\Types\DynamicType::parse() does only seem to accept null, maybe add an additional type check?

This check looks at variables that have been passed in as parameters and are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
112
    }
113
114
    /**
115
     * Just a hook so derived parsers can transform annotation identifiers before they go to AST
116
     *
117
     * @param  string $key
118
     * @return string
119
     */
120
    protected function sanitizeKey($key)
121
    {
122
        return $key;
123
    }
124
}
125