Issues (22)

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/MessageTrait.php (4 issues)

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
namespace SamIT\React\Smtp;
3
4
trait MessageTrait
5
{
6
    use \GuzzleHttp\Psr7\MessageTrait;
7
8
    protected $recipients = [];
9
    public function withHeader($name, $value)
0 ignored issues
show
The parameter $name is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $value is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
10
    {
11
        throw new \Exception('SMTP Message does not support replacing headers.');
12
    }
13
14
    public function withAddedHeader($name, $value)
15
    {
16
        $new = clone $this;
17
        $new->headers[] = [$name, $value];
18
        return $new;
19
20
    }
21
22
    public function getHeaderLine($name) {
0 ignored issues
show
The parameter $name is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
23
        throw new \Exception('SMTP Message does not support merging headers with the same name.');
24
    }
25
26
    public function getHeader($header)
27
    {
28
        $result = [];
29
        $header = strtolower($header);
30
        foreach($this->headers as list($name, $value)) {
31
            if ($header == strtolower($name)) {
32
                $result[] = [$name, $value];
33
            }
34
        }
35
        return $result;
36
    }
37
38
    public function getHeaders() {
39
        return $this->headers;
40
    }
41
42
    public function hasHeader($header)
43
    {
44
        return !empty($this->getHeader($header));
45
    }
46
47
    public function withoutHeader($header)
0 ignored issues
show
The parameter $header is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
48
    {
49
        throw new \Exception('SMTP Message does not support removing headers.');
50
    }
51
52
    /**
53
     * @inheritdoc
54
     */
55
    public function withRecipient($email, $name = null)
56
    {
57
        return $this->withRecipients([$email => $name]);
58
    }
59
60
   public function withRecipients(array $recipients)
61
   {
62
       $new = clone $this;
63
       $new->recipients = $recipients;
64
       return $new;
65
   }
66
67
    public function withAddedRecipient($email, $name = null)
68
    {
69
        $new = clone $this;
70
        $new->recipients[$email] = $name;
71
        return $new;
72
    }
73
74
    /**
75
     * Return an instance with the provided recipients added to the original recipient(s).
76
     *
77
     * This method MUST be implemented in such a way as to retain the
78
     * immutability of the message, and MUST return an instance that has the
79
     * new and/or updated header and value.
80
     *
81
     * @return self
82
     * @param array $recipients Array of email => name pairs.
83
     * @throws \InvalidArgumentException for invalid email.
84
     */
85
    public function withAddedRecipients(array $recipients)
86
    {
87
        $new = clone $this;
88
        $new->recipients = array_merge($this->recipients, $recipients);
89
        return $new;
90
    }
91
92
93
}
94