Issues (3099)

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.

Command/GenerateFormPagePartsCommand.php (4 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 Kunstmaan\GeneratorBundle\Command;
4
5
use Kunstmaan\GeneratorBundle\Generator\DefaultPagePartGenerator;
6
use Symfony\Component\Console\Input\InputOption;
7
8
/**
9
 * Generates the default form pageparts
10
 */
11
class GenerateFormPagePartsCommand extends KunstmaanGenerateCommand
12
{
13
    /**
14
     * @var BundleInterface
15
     */
16
    private $bundle;
17
18
    /**
19
     * @var string
20
     */
21
    private $prefix;
22
23
    /**
24
     * @see Command
25
     */
26
    protected function configure()
27
    {
28
        $this->setDescription('Generates default form pageparts')
29
            ->setHelp(
30
                <<<'EOT'
31
The <info>kuma:generate:form-pageparts</info> command generates the default form pageparts and adds the pageparts configuration.
32
33
<info>php bin/console kuma:generate:form-pageparts</info>
34
EOT
35
            )
36
            ->addOption('namespace', '', InputOption::VALUE_OPTIONAL, 'The namespace to generate the default form pageparts in')
37
            ->addOption('prefix', '', InputOption::VALUE_OPTIONAL, 'The prefix to be used in the table name of the generated entity')
38
            ->setName('kuma:generate:form-pageparts');
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    protected function getWelcomeText()
45
    {
46
        return 'Welcome to the Kunstmaan default form pageparts generator';
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    protected function doExecute()
53
    {
54
        $this->assistant->writeSection('Default Form PageParts generation');
55
56
        $pagepartNames = [
57
            'AbstractFormPagePart',
58
            'CheckboxPagePart',
59
            'ChoicePagePart',
60
            'EmailPagePart',
61
            'FileUploadPagePart',
62
            'MultiLineTextPagePart',
63
            'SingleLineTextPagePart',
64
            'SubmitButtonPagePart',
65
        ];
66
67
        foreach ($pagepartNames as $pagepartName) {
68
            $this->createGenerator()->generate($this->bundle, $pagepartName, $this->prefix, [], false);
69
        }
70
71
        $this->assistant->writeSection('PageParts successfully created', 'bg=green;fg=black');
72
        $this->assistant->writeLine(
73
            [
74
                'Make sure you update your database first before you test the pagepart:',
75
                '    Directly update your database:          <comment>bin/console doctrine:schema:update --force</comment>',
76
                '    Create a Doctrine migration and run it: <comment>bin/console doctrine:migrations:diff && bin/console doctrine:migrations:migrate</comment>',
77
            ]
78
        );
79
80
        return 0;
81
    }
82
83
    /**
84
     * {@inheritdoc}
85
     */
86
    protected function doInteract()
87
    {
88
        if (!$this->isBundleAvailable('KunstmaanPagePartBundle')) {
89
            $this->assistant->writeError('KunstmaanPagePartBundle not found', true);
90
        }
91
92
        $this->assistant->writeLine(["This command helps you to generate the form pageparts.\n"]);
93
94
        /**
95
         * Ask for which bundle we need to create the pagepart
96
         */
97
        $bundleNamespace = $this->assistant->getOptionOrDefault('namespace', null);
98
        $this->bundle = $this->askForBundleName('pagepart', $bundleNamespace);
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->askForBundleName(...art', $bundleNamespace) of type object<Symfony\Component...Bundle\BundleInterface> is incompatible with the declared type object<Kunstmaan\Generat...ommand\BundleInterface> of property $bundle.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
99
100
        /*
101
         * Ask the database table prefix
102
         */
103
        $this->prefix = $this->askForPrefix(null, $this->bundle->getNamespace());
104
    }
105
106
    /**
107
     * Get the generator.
108
     *
109
     * @return DefaultPagePartGenerator
110
     */
111 View Code Duplication
    protected function createGenerator()
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...
112
    {
113
        $filesystem = $this->getContainer()->get('filesystem');
114
        $registry = $this->getContainer()->get('doctrine');
115
116
        return new DefaultPagePartGenerator($filesystem, $registry, '/pagepart', $this->assistant, $this->getContainer());
0 ignored issues
show
$filesystem is of type object|null, but the function expects a object<Symfony\Component\Filesystem\Filesystem>.

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...
$registry is of type object|null, but the function expects a object<Symfony\Bridge\Doctrine\RegistryInterface>.

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...
117
    }
118
}
119