Issues (118)

Security Analysis    not enabled

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.

MessagingBundle/Controller/NewThreadController.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
/*
4
 * This file is part of the MilioooMessageBundle package.
5
 *
6
 * (c) Michiel boeckaert <[email protected]>
7
 * This source file is subject to the MIT license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
11
namespace Miliooo\MessagingBundle\Controller;
12
13
use Miliooo\Messaging\Form\FormFactory\NewThreadMessageFormFactory;
14
use Miliooo\Messaging\Form\FormHandler\NewSingleThreadFormHandler;
15
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
16
use Symfony\Component\HttpFoundation\Response;
17
use Miliooo\Messaging\User\ParticipantProviderInterface;
18
use Miliooo\Messaging\Helpers\FlashMessages\FlashMessageProviderInterface;
19
use Symfony\Component\Routing\RouterInterface;
20
use Symfony\Component\HttpFoundation\RedirectResponse;
21
use Symfony\Component\HttpFoundation\Request;
22
23
/**
24
 * Controller for adding new threads.
25
 *
26
 * This controller is responsible for creating new threads for the logged in user
27
 *
28
 * @author Michiel Boeckaert <[email protected]>
29
 */
30
class NewThreadController
31
{
32
    /**
33
     * A new thread message form factory instance.
34
     *
35
     * @var NewThreadMessageFormFactory
36
     */
37
    protected $formFactory;
38
39
    /**
40
     * A new single thread form handler.
41
     *
42
     * @var NewSingleThreadFormHandler
43
     */
44
    protected $formHandler;
45
46
    /**
47
     * A participant provider.
48
     *
49
     * @var ParticipantProviderInterface
50
     */
51
    protected $participantProvider;
52
53
    /**
54
     * An templating instance.
55
     *
56
     * @var EngineInterface
57
     */
58
    protected $templating;
59
60
    /**
61
     * A flash message provider.
62
     *
63
     * @var FlashMessageProviderInterface
64
     */
65
    protected $flashMessageProvider;
66
67
    /**
68
     * A router instance.
69
     *
70
     * @var RouterInterface
71
     */
72
    protected $router;
73
74
    /**
75
     * Constructor.
76
     *
77
     * @param NewThreadMessageFormFactory   $formFactory          A formfactory instance for a new thread
78
     * @param NewSingleThreadFormHandler    $formHandler          A new single thread formhandler instance
79
     * @param ParticipantProviderInterface  $participantProvider  A participant provider
80
     * @param EngineInterface               $templating           A templating engine instance
81
     * @param FlashMessageProviderInterface $flashMessageProvider A flash message provider instance
82
     * @param RouterInterface               $router               A router instance
83
     */
84
    public function __construct(
85
        NewThreadMessageFormFactory $formFactory,
86
        NewSingleThreadFormHandler $formHandler,
87
        ParticipantProviderInterface $participantProvider,
88
        EngineInterface $templating,
89
        FlashMessageProviderInterface $flashMessageProvider,
90
        RouterInterface $router
91
        ) {
0 ignored issues
show
Multi-line function declaration not indented correctly; expected 4 spaces but found 8
Loading history...
92
        $this->formFactory = $formFactory;
93
        $this->formHandler = $formHandler;
94
        $this->participantProvider = $participantProvider;
95
        $this->templating = $templating;
96
        $this->flashMessageProvider = $flashMessageProvider;
97
        $this->router = $router;
98
99
    }
100
101
    /**
102
     * Create a new thread
103
     *
104
     * This method is responsible for showing the form for creating a new thread
105
     * When the form is submitted it has to process the creation of that thread
106
     * and return an response.
107
     *
108
     * @param Request $request
109
     *
110
     * @return Response
111
     */
112
    public function createAction(Request $request)
113
    {
114
        $sender = $this->participantProvider->getAuthenticatedParticipant();
115
116
        $recipient = $request->query->get('recipient', false);
117
        $form = $this->formFactory->create($sender, $recipient);
118
        $processed = $this->formHandler->process($form);
119
        if ($processed) {
120
            return $this->doProcessValidForm();
121
        }
122
123
        $twig = 'MilioooMessagingBundle:NewThread:new_thread.html.twig';
124
125
        return $this->templating->renderResponse($twig, ['form' => $form->createView()]);
126
    }
127
128
    /**
129
     * Processes a valid form.
130
     *
131
     * Here we process a valid submitted form.
132
     * We add a flash message and redirect the user to the new thread page.
133
     *
134
     * @return RedirectResponse
135
     */
136
    protected function doProcessValidForm()
137
    {
138
        $this->flashMessageProvider->addFlash(
139
            FlashMessageProviderInterface::TYPE_SUCCESS,
140
            'flash.thread_created_success'
141
        );
142
143
        $url = $this->router->generate('miliooo_message_thread_new');
144
145
        return new RedirectResponse($url);
146
    }
147
}
148