Issues (74)

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.

Response/Command/ParsedFetchCommandResponse.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
namespace Genkgo\Mail\Protocol\Imap\Response\Command;
5
6
use Genkgo\Mail\Exception\AssertionFailedException;
7
use Genkgo\Mail\Protocol\Imap\MessageData\ItemList;
8
use Genkgo\Mail\Protocol\Imap\Response\CompletionResult;
9
use Genkgo\Mail\Protocol\Imap\ResponseInterface;
10
11
final class ParsedFetchCommandResponse implements ResponseInterface
12
{
13
    /**
14
     * @var int
15
     */
16
    private $number;
17
18
    /**
19
     * @var ItemList
20
     */
21
    private $itemList;
22
23
    /**
24
     * @param \Iterator<int, string> $lineIterator
25
     */
26 7
    public function __construct(\Iterator $lineIterator)
27
    {
28 7
        $line = $lineIterator->current();
29 7
        if (\substr($line, 0, 2) !== '* ') {
30
            throw new \InvalidArgumentException('Expecting an untagged response');
31
        }
32
33 7
        $lineContent = \substr($line, 2);
34
35 7
        $fetchStart = \preg_match('/^([0-9]+) FETCH (.*)$/s', $lineContent, $matches);
36 7
        if ($fetchStart !== 1) {
37
            throw new \InvalidArgumentException('Expecting a fetch command response');
38
        }
39
40 7
        $this->number = (int)$matches[1];
41 7
        $this->itemList = ItemList::fromBytes(
0 ignored issues
show
Documentation Bug introduced by
It seems like \Genkgo\Mail\Protocol\Im...; } } })()) of type object<self> is incompatible with the declared type object<Genkgo\Mail\Proto...p\MessageData\ItemList> of property $itemList.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
42
            (function () use ($matches, $lineIterator) {
43 7
                foreach (\str_split($matches[2]) as $char) {
44 7
                    yield $char;
45
                }
46
47 5
                while ($lineIterator->valid()) {
48 5
                    $lineIterator->next();
49
50 5
                    foreach (\str_split($lineIterator->current()) as $char) {
51 5
                        yield $char;
52
                    }
53
                }
54 7
            })()
55
        );
56 7
    }
57
58
    /**
59
     * @return string
60
     */
61 2
    public function __toString(): string
62
    {
63 2
        return \sprintf("* %s\r\n", $this->getBody());
64
    }
65
66
    /**
67
     * @param CompletionResult $expectedResult
68
     * @return ResponseInterface
69
     * @throws AssertionFailedException
70
     */
71 1
    public function assertCompletion(CompletionResult $expectedResult): ResponseInterface
72
    {
73 1
        throw new AssertionFailedException('A parsed fetch command response is a completion result');
74
    }
75
76
    /**
77
     * @return ResponseInterface
78
     * @throws AssertionFailedException
79
     */
80 2
    public function assertContinuation(): ResponseInterface
81
    {
82 2
        throw new AssertionFailedException();
83
    }
84
85
    /**
86
     * @return ResponseInterface
87
     * @throws AssertionFailedException
88
     */
89 2
    public function assertTagged(): ResponseInterface
90
    {
91 2
        throw new AssertionFailedException('An untagged response is never tagged');
92
    }
93
94
    /**
95
     * @param string $className
96
     * @return ResponseInterface
97
     * @throws AssertionFailedException
98
     */
99
    public function assertParsed(string $className): ResponseInterface
100
    {
101
        if ($className !== self::class) {
102
            throw new AssertionFailedException(self::class . ' is not parsed as a ' . $className);
103
        }
104
105
        return $this;
106
    }
107
108
    /**
109
     * @return string
110
     */
111 4
    public function getBody(): string
112
    {
113 4
        return \sprintf(
114 4
            '%s FETCH %s',
115 4
            $this->number,
116 4
            (string)$this->itemList
117
        );
118
    }
119
120
    /**
121
     * @return int
122
     */
123 1
    public function getNumber(): int
124
    {
125 1
        return $this->number;
126
    }
127
128
    /**
129
     * @return ItemList
130
     */
131 1
    public function getItemList(): ItemList
132
    {
133 1
        return $this->itemList;
134
    }
135
}
136