Issues (5)

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.

Controller/EmailController.php (3 issues)

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 Citrax\Bundle\DatabaseSwiftMailerBundle\Controller;
4
5
use Symfony\Component\HttpFoundation\Request;
6
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
8
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
9
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
10
use Citrax\Bundle\DatabaseSwiftMailerBundle\Entity\Email;
11
use Citrax\Bundle\DatabaseSwiftMailerBundle\Form\EmailType;
12
13
/**
14
 * Email controller.
15
 *
16
 * @Route("/email-spool")
17
 */
18
class EmailController extends Controller
19
{
20
21
    /**
22
     * Lists all Email entities.
23
     *
24
     * @Route("/{page}", name="email-spool", defaults={"page" = 1}, requirements={"page" = "\d+"})
25
     * @Method("GET")
26
     * @Template()
27
     */
28
    public function indexAction($page)
29
    {
30
        $em = $this->getDoctrine()->getManager();
31
32
        $query = $em->getRepository('CitraxDatabaseSwiftMailerBundle:Email')->getAllEmails();
33
34
        $paginator  = $this->get('knp_paginator');
35
        $pagination = $paginator->paginate(
36
            $query,
37
            $page/*page number*/,
38
            30/*limit per page*/
39
        );
40
        return array(
41
            'entities' => $pagination,
42
        );
43
    }
44
45
    /**
46
     * Finds and displays a Email entity.
47
     *
48
     * @Route("/{id}/show", name="email-spool_show")
49
     * @Method("GET")
50
     * @Template()
51
     */
52
    public function showAction($id)
53
    {
54
        $em = $this->getDoctrine()->getManager();
55
56
        $entity = $em->getRepository('CitraxDatabaseSwiftMailerBundle:Email')->find($id);
57
58
        if (!$entity) {
59
            throw $this->createNotFoundException('Unable to find Email entity.');
60
        }
61
62
        return array(
63
            'entity'      => $entity,
64
        );
65
    }
66
67
    /**
68
     * Retry to send an email
69
     *
70
     * @Route("/{id}/retry", name="email-spool_retry")
71
     * @Method("GET")
72
     */
73 View Code Duplication
    public function retryAction($id)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
74
    {
75
        $em = $this->getDoctrine()->getManager();
76
77
        $entity = $em->getRepository('CitraxDatabaseSwiftMailerBundle:Email')->find($id);
78
79
        if (!$entity) {
80
            throw $this->createNotFoundException('Unable to find Email entity.');
81
        }
82
83
        $entity->setStatus(Email::STATUS_FAILED);
84
        $entity->setRetries(0);
85
86
        $em->persist($entity);
87
        $em->flush();
88
89
        return $this->redirect($this->generateUrl('email-spool'));
90
    }
91
92
    /**
93
     * Resend an email
94
     *
95
     * @Route("/{id}/resend", name="email-spool_resend")
96
     * @Method("GET")
97
     */
98 View Code Duplication
    public function resendAction($id)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
99
    {
100
        $em = $this->getDoctrine()->getManager();
101
102
        $entity = $em->getRepository('CitraxDatabaseSwiftMailerBundle:Email')->find($id);
103
104
        if (!$entity) {
105
            throw $this->createNotFoundException('Unable to find Email entity.');
106
        }
107
108
        $entity->setStatus(Email::STATUS_READY);
109
        $entity->setRetries(0);
110
111
        $em->persist($entity);
112
        $em->flush();
113
114
        return $this->redirect($this->generateUrl('email-spool'));
115
    }
116
117
    /**
118
     * Cancel an email sending
119
     *
120
     * @Route("/{id}/cancel", name="email-spool_cancel")
121
     * @Method("GET")
122
     */
123 View Code Duplication
    public function cancelAction($id)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
124
    {
125
        $em = $this->getDoctrine()->getManager();
126
127
        $entity = $em->getRepository('CitraxDatabaseSwiftMailerBundle:Email')->find($id);
128
129
        if (!$entity) {
130
            throw $this->createNotFoundException('Unable to find Email entity.');
131
        }
132
133
        $entity->setStatus(Email::STATUS_CANCELLED);
134
135
        $em->persist($entity);
136
        $em->flush();
137
138
        return $this->redirect($this->generateUrl('email-spool'));
139
    }
140
141
    /**
142
     * Deletes a Email entity.
143
     *
144
     * @Route("/{id}/delete", name="email-spool_delete")
145
     * @Method("GET")
146
     */
147
    public function deleteAction($id)
148
    {
149
150
        $em = $this->getDoctrine()->getManager();
151
        $entity = $em->getRepository('CitraxDatabaseSwiftMailerBundle:Email')->find($id);
152
153
        if (!$entity) {
154
            throw $this->createNotFoundException('Unable to find Email entity.');
155
        }
156
157
        $em->remove($entity);
158
        $em->flush();
159
160
161
        return $this->redirect($this->generateUrl('email-spool'));
162
    }
163
164
}
165