Issues (4714)

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.

tests/unit/XMLRPC/NewsletterXMLRPCTest.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
require_once 'Intraface/XMLRPC/Newsletter/Server.php';
3
4
class NewsletterXMLRPCTest extends PHPUnit_Framework_TestCase
5
{
6
    protected $server;
7
    protected $db;
8
9
    function setUp()
10
    {
11
        $this->server = new Intraface_XMLRPC_Newsletter_Server;
12
        $this->db = MDB2::singleton(DB_DSN);
13
        $this->kernel = new Stub_Kernel;
0 ignored issues
show
The property kernel does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
14
    }
15
16
    function tearDown()
17
    {
18
        $this->db->exec('TRUNCATE contact');
19
        $this->db->exec('TRUNCATE newsletter_subscriber');
20
    }
21
22
    function testConstruction()
23
    {
24
        $this->markTestIncomplete(
25
            'This test has not been implemented yet.'
26
        );
27
        $this->assertTrue(is_object($this->server));
28
    }
29
30
    function testEmptyCredentialsThrowsException()
31
    {
32
        $this->markTestIncomplete(
33
            'This test has not been implemented yet.'
34
        );
35
        $credentials = array();
36
        $list = 1;
37
        $email = 'test';
38
39
        try {
40
            $this->server->subscribe($credentials, $list, $email);
0 ignored issues
show
$credentials is of type array, but the function expects a object<Struct>.

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...
41
            $this->assertFalse(true, 'Should have thrown an exception');
42
        } catch (XML_RPC2_FaultException $e) {
0 ignored issues
show
The class XML_RPC2_FaultException does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
43
            $this->assertTrue(true);
44
        }
45
    }
46
47
    /**
48
     * @group xmlrpc
49
     */
50
    function testIfANonExistingListIsUsedWithSubscribeAnExceptionIsThrown()
51
    {
52
        $this->markTestIncomplete(
53
            'This test has not been implemented yet.'
54
        );
55
        $client = $this->getClient();
56
57
        $credentials = array('private_key' => 'privatekeyshouldbereplaced', 'session_id' => 'something');
58
        $list = 1; // non existing list
59
        $email = 'test';
60
61
        try {
62
            $client->subscribe($credentials, $list, $email);
63
            $this->assertFalse(true, 'Should have thrown an exception');
64
        } catch (XML_RPC2_FaultException $e) {
0 ignored issues
show
The class XML_RPC2_FaultException does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
65
            $this->assertTrue(true);
66
        }
67
    }
68
69
    /**
70
     * @group xmlrpc
71
     */
72
    function testSubscribeHandlesStuff()
73
    {
74
        $this->markTestIncomplete(
75
            'This test has not been implemented yet.'
76
        );
77
        $client = $this->getClient();
78
        $credentials = array('private_key' => 'privatekeyshouldbereplaced', 'session_id' => 'something');
79
        $email = 'test';
80
81
        // create the list
82
        $newsletter = new NewsletterList($this->kernel);
83
        $data = array(
84
            'title' => 'title',
85
            'sender_name' => 'sender name',
86
            'reply_email' => '[email protected]',
87
            'description' => 'description',
88
            'subscribe_message' => 'subscribe message',
89
            'subscribe_subject' => 'subscribe subject',
90
            'optin_link' => 'http://example.dk/'
91
            );
92
        $list = $newsletter->save($data);
93
94
        try {
95
            $client->subscribe($credentials, $list, $email);
96
            $this->assertFalse(true, 'Should have thrown an exception');
97
        } catch (XML_RPC2_FaultException $e) {
0 ignored issues
show
The class XML_RPC2_FaultException does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
98
            $this->assertTrue(true);
99
        }
100
    }
101
102
    protected function getClient()
103
    {
104
        require_once dirname(__FILE__) . '/../../../install/Install.php';
105
106
        if (!defined('SERVER_STATUS')) {
107
            define('SERVER_STATUS', 'TEST');
108
        }
109
        $install = new Intraface_Install;
110
        $install->resetServer();
111
        $install->grantModuleAccess('administration', 'contact', 'newsletter');
0 ignored issues
show
The call to Intraface_Install::grantModuleAccess() has too many arguments starting with 'contact'.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
112
113
        require_once 'XML/RPC2/Client.php';
114
        $options = array('prefix' => 'newsletter.', 'debug' => false);
115
        return XML_RPC2_Client::create(XMLRPC_SERVER_URL.'newsletter?version=0.2.0', $options);
116
    }
117
}
118