Issues (14)

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.

Template/AbstractTemplate.php (1 issue)

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
namespace SfCod\EmailEngineBundle\Template;
4
5
use SfCod\EmailEngineBundle\Repository\RepositoryInterface;
6
use SfCod\EmailEngineBundle\Template\Attachments\AttachmentInterface;
7
use SfCod\EmailEngineBundle\Template\Params\ParameterResolverInterface;
8
9
/**
10
 * Abstract argumentative, repository aware template
11
 *
12
 * Class AbstractTemplate
13
 *
14
 * @author Virchenko Maksim <[email protected]>
15
 *
16
 * @package SfCod\EmailEngineBundle\Template
17
 */
18
abstract class AbstractTemplate implements TemplateInterface, RepositoryAwareInterface, ParametersAwareInterface, AttachmentsAwareInterface
19
{
20
    /**
21
     * Template data
22
     *
23
     * @var array
24
     */
25
    protected $data = [];
26
27
    /**
28
     * Template options
29
     *
30
     * @var TemplateOptionsInterface
31
     */
32
    protected $options;
33
34
    /**
35
     * Template repository
36
     *
37
     * @var RepositoryInterface
38
     */
39
    protected $repository;
40
41
    /**
42
     * Parameter resolver
43
     *
44
     * @var ParameterResolverInterface
45
     */
46
    protected $parameterResolver;
47
48
    /**
49
     * AbstractTemplate constructor.
50
     *
51
     * @param TemplateOptionsInterface $options
52
     */
53
    public function __construct(TemplateOptionsInterface $options)
54
    {
55
        $this->options = $options;
56
    }
57
58
    /**
59
     * Set parameter resolver
60
     *
61
     * @param ParameterResolverInterface $parameterResolver
62
     *
63
     * @return mixed|void
64
     */
65
    public function setParameterResolver(ParameterResolverInterface $parameterResolver)
66
    {
67
        $this->parameterResolver = $parameterResolver;
68
    }
69
70
    /**
71
     * Add data for template
72
     *
73
     * @param $key
74
     * @param $value
75
     */
76
    public function addData($key, $value)
77
    {
78
        $this->data[$key] = $value;
79
    }
80
81
    /**
82
     * Set repository
83
     *
84
     * @param RepositoryInterface $repository
85
     */
86
    public function setRepository(RepositoryInterface $repository)
87
    {
88
        $this->repository = $repository;
89
    }
90
91
    /**
92
     * Get repository
93
     *
94
     * @return RepositoryInterface
95
     */
96
    public function getRepository(): RepositoryInterface
97
    {
98
        return $this->repository;
99
    }
100
101
    /**
102
     * Get email's subject
103
     *
104
     * @return string
105
     */
106
    public function getSubject(): string
107
    {
108
        return $this->repository->getSubjectTemplate($this->getData());
109
    }
110
111
    /**
112
     * Get email's body
113
     *
114
     * @return string
115
     */
116
    public function getBody(): string
117
    {
118
        return $this->repository->getBodyTemplate($this->getData());
119
    }
120
121
    /**
122
     * Get email's sender name
123
     *
124
     * @return string
125
     */
126
    public function getSenderName(): string
127
    {
128
        return $this->repository->getSenderNameTemplate($this->getData());
129
    }
130
131
    /**
132
     * Get email's sender email
133
     *
134
     * @return string
135
     */
136
    public function getSenderEmail(): string
137
    {
138
        return $this->repository->getSenderEmailTemplate($this->getData());
139
    }
140
141
    /**
142
     * Get priority
143
     *
144
     * @return int
145
     */
146
    public function getPriority(): int
147
    {
148
        return self::PRIORITY_NORMAL;
149
    }
150
151
    /**
152
     * Get template attachments
153
     *
154
     * @return AttachmentInterface[]
155
     */
156
    public function getAttachments(): array
157
    {
158
        $attachments = [];
159
160
        foreach (static::listAttachments() as $attachment) {
161
            /** @var AttachmentInterface $attachment */
162
            $attachment = new $attachment($this->options);
163
164
            $attachments[$attachment->getFileName()] = $attachment;
165
        }
166
167
        return $attachments;
168
    }
169
170
    /**
171
     * List template attachments
172
     *
173
     * @return AttachmentInterface[]
174
     */
175
    public static function listAttachments(): array
176
    {
177
        return [];
178
    }
179
180
    /**
181
     * Get arguments list
182
     *
183
     * @return array
184
     */
185
    protected function getData(): array
186
    {
187
        if (empty($this->data)) {
188
            foreach (static::listParameters() as $parameterClass) {
189
                $this->data[$parameterClass::getName()] = $this->parameterResolver->getParameterValue($parameterClass, $this->options);
0 ignored issues
show
$parameterClass is of type object<SfCod\EmailEngine...ams\ParameterInterface>, but the function expects a string.

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...
190
            }
191
        }
192
193
        return $this->data;
194
    }
195
}
196