Issues (143)

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.

LoevgaardDandomainAltapayExtensionTest.php (6 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 Loevgaard\DandomainAltapayBundle\Tests\DependencyInjection;
4
5
use Loevgaard\DandomainAltapayBundle\DependencyInjection\LoevgaardDandomainAltapayExtension;
6
use PHPUnit\Framework\TestCase;
7
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
8
use Symfony\Component\DependencyInjection\ContainerBuilder;
9
use Symfony\Component\Yaml\Parser;
10
11
class LoevgaardDandomainAltapayExtensionTest extends TestCase
12
{
13 View Code Duplication
    public function testThrowsExceptionUnlessAltapayUsernameSet()
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...
14
    {
15
        $this->expectException(InvalidConfigurationException::class);
16
17
        $loader = new LoevgaardDandomainAltapayExtension();
18
        $config = $this->getEmptyConfig();
19
        unset($config['altapay_username']);
20
        $loader->load([$config], new ContainerBuilder());
21
    }
22
23 View Code Duplication
    public function testThrowsExceptionUnlessAltapayPasswordSet()
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...
24
    {
25
        $this->expectException(InvalidConfigurationException::class);
26
27
        $loader = new LoevgaardDandomainAltapayExtension();
28
        $config = $this->getEmptyConfig();
29
        unset($config['altapay_password']);
30
        $loader->load([$config], new ContainerBuilder());
31
    }
32
33 View Code Duplication
    public function testThrowsExceptionUnlessSharedKey1Set()
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...
34
    {
35
        $this->expectException(InvalidConfigurationException::class);
36
37
        $loader = new LoevgaardDandomainAltapayExtension();
38
        $config = $this->getEmptyConfig();
39
        unset($config['shared_key_1']);
40
        $loader->load([$config], new ContainerBuilder());
41
    }
42
43 View Code Duplication
    public function testThrowsExceptionUnlessSharedKey2Set()
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...
44
    {
45
        $this->expectException(InvalidConfigurationException::class);
46
47
        $loader = new LoevgaardDandomainAltapayExtension();
48
        $config = $this->getEmptyConfig();
49
        unset($config['shared_key_2']);
50
        $loader->load([$config], new ContainerBuilder());
51
    }
52
53 View Code Duplication
    public function testThrowsExceptionUnlessAltapayIpsSet()
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...
54
    {
55
        $this->expectException(InvalidConfigurationException::class);
56
57
        $loader = new LoevgaardDandomainAltapayExtension();
58
        $config = $this->getEmptyConfig();
59
        unset($config['altapay_ips']);
60
        $loader->load([$config], new ContainerBuilder());
61
    }
62
63 View Code Duplication
    public function testThrowsExceptionUnlessDefaultSettingsSet()
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...
64
    {
65
        $this->expectException(InvalidConfigurationException::class);
66
67
        $loader = new LoevgaardDandomainAltapayExtension();
68
        $config = $this->getEmptyConfig();
69
        unset($config['default_settings']);
70
        $loader->load([$config], new ContainerBuilder());
71
    }
72
73
    public function testGettersSetters()
74
    {
75
        $loader = new LoevgaardDandomainAltapayExtension();
76
        $config = $this->getEmptyConfig();
77
        $container = new ContainerBuilder();
78
        $loader->load([$config], $container);
79
80
        $this->assertSame($config['altapay_username'], $container->getParameter('loevgaard_dandomain_altapay.altapay_username'));
81
        $this->assertSame($config['altapay_password'], $container->getParameter('loevgaard_dandomain_altapay.altapay_password'));
82
        $this->assertSame($config['altapay_url'], $container->getParameter('loevgaard_dandomain_altapay.altapay_url'));
83
        $this->assertSame($config['altapay_ips'], $container->getParameter('loevgaard_dandomain_altapay.altapay_ips'));
84
        $this->assertSame($config['shared_key_1'], $container->getParameter('loevgaard_dandomain_altapay.shared_key_1'));
85
        $this->assertSame($config['shared_key_2'], $container->getParameter('loevgaard_dandomain_altapay.shared_key_2'));
86
        $this->assertSame($config['webhook_urls'], $container->getParameter('loevgaard_dandomain_altapay.webhook_urls'));
87
        $this->assertSame($config['default_settings'], $container->getParameter('loevgaard_dandomain_altapay.default_settings'));
88
    }
89
90
    /**
91
     * @return array
92
     */
93
    protected function getEmptyConfig()
94
    {
95
        $yaml = <<<EOF
96
altapay_username: username
97
altapay_password: password
98
altapay_url: https://altapayurl.com
99
altapay_ips: ['123.123.123.123']
100
shared_key_1: key1
101
shared_key_2: key2
102
webhook_urls:
103
    ['http://www.example.com']
104
default_settings:
105
    layout:
106
        logo: logo_default.jpg
107
    opening_days: Monday - Friday
108
    opening_hours: 09:00 - 15:00
109
    email: [email protected]
110
    phone: +45 11 22 33 44
111
EOF;
112
        $parser = new Parser();
113
114
        return $parser->parse($yaml);
115
    }
116
}
117