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

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/Baruica/Xml/XmlReader/DomDocXmlReader.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
declare(strict_types=1);
4
5
namespace Baruica\Xml\XmlReader;
6
7
final class DomDocXmlReader implements XmlReader
8
{
9
    private \DOMXPath $domXpath;
0 ignored issues
show
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_NS_SEPARATOR, expecting T_FUNCTION or T_CONST
Loading history...
10
11
    private function __construct(\DOMDocument $domDocument, array $namespaces = [])
12
    {
13
        $this->domXpath = new \DOMXPath($domDocument);
14
15
        foreach ($namespaces as $prefix => $namespace) {
16
            if (false === $this->domXpath->registerNamespace($prefix, $namespace)) {
17
                throw new \RuntimeException("Error while trying to register namespace [$namespace] with prefix [$prefix]");
18
            }
19
        }
20
    }
21
22
    public static function fromFile(string $filePath, array $namespaces = []): self
23
    {
24
        $domDocument = new \DOMDocument();
25
26
        try {
27
            if (false === \file_exists($filePath) || false === $domDocument->load($filePath)) {
28
                throw new \RuntimeException("Could not load xml file [$filePath].");
29
            }
30
        } catch (\Exception $e) {
31
            throw new \RuntimeException($e->getMessage());
32
        }
33
34
        return new self($domDocument, $namespaces);
35
    }
36
37
    public static function fromString(string $xmlStr, array $namespaces = []): self
38
    {
39
        $domDocument = new \DOMDocument();
40
41
        try {
42
            if (false === $domDocument->loadXML($xmlStr)) {
43
                throw new \RuntimeException("Could not load XML from string [$xmlStr]");
44
            }
45
        } catch (\Exception $e) {
46
            throw new \RuntimeException($e->getMessage());
47
        }
48
49
        return new self($domDocument, $namespaces);
50
    }
51
52
    public function getList(string $xpath): \Generator
53
    {
54
        if (null === $nodeList = $this->getNodeList($xpath)) {
55
            return [];
56
        }
57
58
        foreach ($nodeList as $node) {
59
            yield $this->getNodeValue($node);
60
        }
61
    }
62
63
    public function getNodeList(string $xpath, \DOMNode $contextNode = null): \DOMNodeList
64
    {
65
        try {
66
            $nodeList = $this->domXpath->query($xpath, $contextNode);
67
        } catch (\Throwable $e) {
68
            return new \DOMNodeList();
69
        }
70
71
        if (false === $nodeList) {
72
            return new \DOMNodeList();
73
        }
74
75
        return $nodeList;
76
    }
77
78
    public function getFirstNode(string $xpath, \DOMNode $contextNode = null): ?\DOMElement
79
    {
80
        $nodeList = $this->getNodeList($xpath, $contextNode);
81
82
        if (0 !== $nodeList->length) {
83
            return $nodeList->item(0);
84
        }
85
86
        return null;
87
    }
88
89
    public function getLastNode(string $xpath, \DOMNode $contextNode = null): ?\DOMElement
90
    {
91
        $nodeList = $this->getNodeList($xpath, $contextNode);
92
93
        if (0 !== $nodeList->length) {
94
            $lastIndex = $nodeList->length - 1;
95
96
            return $nodeList->item($lastIndex);
97
        }
98
99
        return null;
100
    }
101
102
    public function getNodeAttribute(string $att, \DOMElement $node = null): ?string
103
    {
104
        if (null !== $node) {
105
            return $node->getAttribute($att);
106
        }
107
108
        return null;
109
    }
110
111
    public function getNodeValue(\DOMElement $node = null): ?string
112
    {
113
        if (null !== $node) {
114
            return $node->nodeValue;
115
        }
116
117
        return null;
118
    }
119
120
    public function getValue(string $xpath, \DOMNode $contextNode = null): ?string
121
    {
122
        return $this->getNodeValue($this->getFirstNode($xpath, $contextNode));
123
    }
124
125
    public function getLastValue(string $xpath, \DOMNode $contextNode = null): ?string
126
    {
127
        return $this->getNodeValue($this->getLastNode($xpath, $contextNode));
128
    }
129
130
    public function getNeighborNodeValue(string $neighborNodeName, \DOMElement $node = null): ?string
131
    {
132
        if (null !== $node) {
133
            return $this->getNodeValue(
134
                $node->parentNode->getElementsByTagName($neighborNodeName)->item(0)
135
            );
136
        }
137
138
        return null;
139
    }
140
141
    public function getValues(\DOMNodeList $contextNodes, string $keyNodeName, array $valNodes = [], \Closure $fn = null, array $fnParams = []): array
142
    {
143
        $values = [];
144
145
        foreach ($contextNodes as $node) {
146
            $keyNodeValue = $this->getValue($keyNodeName, $node);
147
148
            if (!\array_key_exists($keyNodeValue, $values)) {
149
                $values[$keyNodeValue] = [];
150
            }
151
152
            foreach ($valNodes as $valNodeName) {
153
                if (null !== $fn) {
154
                    $params = $fnParams;
155
                    \array_unshift($params, $this->getValue($valNodeName, $node));
156
                    $values[$keyNodeValue] = $fn($params);
157
                } else {
158
                    $values[$keyNodeValue] = $this->getValue($valNodeName, $node);
159
                }
160
            }
161
        }
162
163
        \ksort($values);
164
165
        return $values;
166
    }
167
}
168