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/Mailer.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
/**
3
 * Mail.php
4
 *
5
 * PHP version 5.6+
6
 *
7
 * @author Philippe Gaultier <[email protected]>
8
 * @copyright 2010-2017 Philippe Gaultier
9
 * @license http://www.sweelix.net/license license
10
 * @version XXX
11
 * @link http://www.sweelix.net
12
 * @package sweelix\postmark
13
 */
14
15
namespace sweelix\postmark;
16
17
18
use Postmark\Models\PostmarkException;
19
use Postmark\PostmarkClient;
20
use yii\base\InvalidConfigException;
21
use yii\mail\BaseMailer;
22
23
/**
24
 * This component allow user to send an email
25
 *
26
 * @author Philippe Gaultier <[email protected]>
27
 * @copyright 2010-2017 Philippe Gaultier
28
 * @license http://www.sweelix.net/license license
29
 * @version XXX
30
 * @link http://www.sweelix.net
31
 * @package sweelix\postmark
32
 * @since XXX
33
 * @todo implement batch messages using API
34
 */
35
class Mailer extends BaseMailer
36
{
37
    /**
38
     * @var string
39
     */
40
    public $token;
41
42
    /**
43
     * @var string
44
     */
45
    public $apiUri;
46
47
    /**
48
     * @var boolean
49
     */
50
    public $verifySsl;
51
52
    /**
53
     * @var int
54
     */
55
    public $timeOut = 30;
56
    /**
57
     * @inheritdoc
58
     */
59
    public $messageClass = 'sweelix\postmark\Message';
60
    /**
61
     * @param Message $message
62
     * @since XXX
63
     * @throws InvalidConfigException
64
     */
65 2
    public function sendMessage($message)
66
    {
67
        try {
68 2
            if ($this->token === null) {
69 2
                throw new InvalidConfigException('Token is missing');
70
            }
71
            if ($this->apiUri !== null) {
72
                PostmarkClient::$BASE_URL = $this->apiUri;
73
            }
74
            if ($this->verifySsl !== null) {
75
                PostmarkClient::$VERIFY_SSL = $this->verifySsl;
76
            }
77
            $client = new PostmarkClient($this->token, $this->timeOut);
78
            $templateId = $message->getTemplateId();
79
            if ($templateId === null) {
80
                $sendResult = $client->sendEmail(
81
                    $message->getFrom(),
82
                    Message::stringifyEmails($message->getTo()),
83
                    $message->getSubject(),
84
                    $message->getHtmlBody(), $message->getTextBody(),
85
                    $message->getTag(),
86
                    $message->getTrackOpens(),
87
                    $message->getReplyTo(),
88
                    Message::stringifyEmails($message->getCc()),
89
                    Message::stringifyEmails($message->getBcc()),
90
                    $message->getHeaders(),
91
                    $message->getAttachments()
92
                );
93
            } else {
94
                $sendResult = $client->sendEmailWithTemplate(
95
                    $message->getFrom(),
96
                    Message::stringifyEmails($message->getTo()),
97
                    $message->getTemplateId(), $message->getTemplateModel(),
0 ignored issues
show
$message->getTemplateModel() is of type array, but the function expects a object.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
98
                    $message->getInlineCss(),
99
                    $message->getTag(),
100
                    $message->getTrackOpens(),
101
                    $message->getReplyTo(),
102
                    Message::stringifyEmails($message->getCc()),
103
                    Message::stringifyEmails($message->getBcc()),
104
                    $message->getHeaders(),
105
                    $message->getAttachments()
106
                );
107
            }
108
            //TODO: handle error codes and log stuff
109
            return isset($sendResult['ErrorCode']) ? ($sendResult['ErrorCode'] == 0) : false;
110 2
        } catch (PostmarkException $e) {
111
            throw $e;
112
        }
113
    }
114
}