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

Security Analysis    not enabled

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/Loader/XmlUtil.php (2 issues)

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
 * @link https://github.com/old-town/old-town-workflow
4
 * @author  Malofeykin Andrey  <[email protected]>
5
 */
6
namespace OldTown\Workflow\Loader;
7
8
use DOMElement;
9
use OldTown\Workflow\Exception\NotExistsRequiredAttributeException;
10
use OldTown\Workflow\Exception\NotExistsRequiredElementException;
11
12
/**
13
 * Class XmlUtil
14
 *
15
 * @package OldTown\Workflow\Loader
16
 */
17
abstract class XmlUtil
18
{
19
    /**
20
     * Ищет среди потомков элемента $parent, первый элемент с именем тега $childName
21
     *
22
     * @param DOMElement $parent
23
     * @param string $childName
24
     *
25
     * @return DOMElement|null
26
     */
27 112
    public static function getChildElement(DOMElement $parent, $childName)
28
    {
29 112
        $listElements = $parent->getElementsByTagName($childName);
30 112
        if ($listElements->length > 0) {
31 88 View Code Duplication
            for ($i = 0; $i < $listElements->length; $i++) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
32 88
                $currentItem = $listElements->item($i);
33 88
                if ($parent->isSameNode($currentItem->parentNode)) {
34 88
                    return $currentItem;
35
                }
36 17
            }
37 16
        }
38
39 105
        return null;
40
    }
41
42
    /**
43
     * Ищет среди потомков элемента $parent, первый элемент с именем тега $childName. В случае если элемент не найден,
44
     * бросается исключение
45
     *
46
     * @param DOMElement $parent
47
     * @param string $childName
48
     *
49
     * @return DOMElement
50
     */
51 5
    public static function getRequiredChildElement(DOMElement $parent, $childName)
52
    {
53 5
        $element = static::getChildElement($parent, $childName);
54
55 5
        if (!$element instanceof DOMElement) {
56 1
            $errMsg = sprintf('Отсутствует элемен %s', $childName);
57 1
            $exception =  new NotExistsRequiredElementException($errMsg);
58
59 1
            throw $exception;
60
        }
61
62 4
        return $element;
63
    }
64
65
66
67
    /**
68
     * Ищет среди потомков элемента $parent,  элементы с именем тега $childName
69
     *
70
     * @param DOMElement $parent
71
     * @param string $childName
72
     *
73
     * @return DOMElement[]|null
74
     */
75 124
    public static function getChildElements(DOMElement $parent, $childName)
76
    {
77 124
        $listElements = $parent->getElementsByTagName($childName);
78 124
        if ($listElements->length > 0) {
79 107
            $list = [];
80
81 107 View Code Duplication
            for ($i = 0; $i < $listElements->length; $i++) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
82 107
                $currentItem = $listElements->item($i);
83
84 107
                if (!$parent->isSameNode($currentItem->parentNode)) {
85 7
                    continue;
86
                }
87
88 107
                $list[] = $currentItem;
89 107
            }
90
91 107
            return $list;
92
        }
93
94 90
        return [];
95
    }
96
97
    /**
98
     * Ищет среди потомков элемента $parent, первый элемент с именем тега $childName и возвращает его текст
99
     *
100
     * @param DOMElement $parent
101
     * @param string $childName
102
     *
103
     * @return null
104
     */
105 2
    public static function getChildText(DOMElement $parent, $childName)
106
    {
107 2
        $child = self::getChildElement($parent, $childName);
108
109 2
        if (null === $child) {
110 1
            return null;
111
        }
112
113 1
        return self::getText($child);
114
    }
115
116
    /**
117
     * Получает текст из нод потомков
118
     *
119
     * @param DOMElement $node
120
     * @return string
121
     */
122 67
    public static function getText(DOMElement $node)
123
    {
124 67
        $s = '';
125 67
        for ($i = 0; $i < $node->childNodes->length; $i++) {
126 67
            $child = $node->childNodes->item($i);
127
128 67
            switch ($child->nodeType) {
129 67
                case XML_CDATA_SECTION_NODE:
130 67
                case XML_TEXT_NODE: {
131 67
                    $s .= $child->nodeValue;
132
                }
133 67
            }
134 67
        }
135
136 67
        return $s;
137
    }
138
139
    /**
140
     * @param DOMElement $node
141
     * @param string     $attributeName
142
     *
143
     * @return string
144
     */
145 134
    public static function getRequiredAttributeValue(DOMElement $node, $attributeName)
146
    {
147 134
        $attributeName = (string)$attributeName;
148
149 134
        $attribute = $node->attributes->getNamedItem($attributeName);
150 134
        if (!$attribute) {
151 1
            $errMsg = "Отсутствует атрибут {$attributeName} у тега {$node->nodeName}";
152 1
            $exception =  new NotExistsRequiredAttributeException($errMsg);
153 1
            $exception->setRequiredAttributeName($attributeName);
154
155 1
            throw $exception;
156
        }
157
158 133
        $value = $attribute->nodeValue;
159
160 133
        return $value;
161
    }
162
163
164
    /**
165
     * @fixme Реализовать методу \OldTown\Workflow\Loader\XmlUtil::encode
166
     *
167
     * @param string $string
168
     * @return string
169
     */
170 20
    public static function encode($string)
171
    {
172 20
        return $string;
173
    }
174
}
175