GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (77)

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.

tests/Ogone/Tests/OgoneTest.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
 * This file is part of the Marlon Ogone package.
4
 *
5
 * (c) Marlon BVBA <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Ogone\Tests;
12
13
use Guzzle\Http\Client;
14
use Ogone\DirectLink\Eci;
15
use Ogone\DirectLink\PaymentOperation;
16
use Ogone\Passphrase;
17
use Ogone\DirectLink\Alias;
18
use Ogone\DirectLink\CreateAliasRequest;
19
use Ogone\DirectLink\CreateAliasResponse;
20
use Ogone\ShaComposer\AllParametersShaComposer;
21
use Ogone\ParameterFilter\ShaOutParameterFilter;
22
use Ogone\DirectLink\DirectLinkPaymentRequest;
23
use Ogone\DirectLink\DirectLinkPaymentResponse;
24
25
/**
26
 * @group integration
27
 */
28
class OgoneTest extends \PHPUnit_Framework_TestCase
29
{
30
    /**
31
     * @test
32
     */
33
    public function AliasCreationIsSuccessful()
34
    {
35
        $passphraseOut = new Passphrase(PASSPHRASE_SHA_OUT);
36
        $shaOutComposer = new AllParametersShaComposer($passphraseOut);
37
        $shaOutComposer->addParameterFilter(new ShaOutParameterFilter());
38
39
        $createAliasResponse = $this->provideAliasResponse();
40
41
        $this->assertTrue($createAliasResponse->isValid($shaOutComposer));
42
        $this->assertTrue($createAliasResponse->isSuccessful());
43
44
        return (string) $createAliasResponse->getAlias();
45
    }
46
47
    /**
48
     * @test
49
     * @depends AliasCreationIsSuccessful
50
     */
51
    public function DirectLinkPaymentIsSuccessful($alias)
52
    {
53
        $passphrase = new Passphrase(PASSPHRASE_SHA_IN);
54
        $shaComposer = new AllParametersShaComposer($passphrase);
55
        $directLinkRequest = new DirectLinkPaymentRequest($shaComposer);
56
57
        $orderId = uniqid('order_'); // create a unique order id
58
        $directLinkRequest->setOrderid($orderId);
59
60
        $alias = new Alias($alias);
61
        $directLinkRequest->setPspid(PSPID);
62
        $directLinkRequest->setUserId(USERID);
63
        $directLinkRequest->setPassword(PASSWORD);
64
        $directLinkRequest->setAlias($alias);
65
        $directLinkRequest->setAmount(100);
66
        $directLinkRequest->setCurrency('EUR');
67
        $directLinkRequest->setEci(new Eci(Eci::ECOMMERCE_RECURRING));
68
        $directLinkRequest->setOperation(new PaymentOperation(PaymentOperation::REQUEST_FOR_DIRECT_SALE));
69
        $directLinkRequest->validate();
70
71
        $body = array();
72
        foreach ($directLinkRequest->toArray() as $key => $value) {
73
            $body[strtoupper($key)] = $value;
74
        }
75
76
        $body['SHASIGN'] = $directLinkRequest->getShaSign();
77
78
        $client = new Client($directLinkRequest->getOgoneUri());
79
        $request = $client->post(null, null, $body);
80
        $response = $request->send();
81
82
        $directLinkResponse = new DirectLinkPaymentResponse($response->getBody(true));
83
84
        $this->assertTrue($directLinkResponse->isSuccessful());
85
86
        return $alias;
87
    }
88
89
    /**
90
     * @test
91
     */
92 View Code Duplication
    public function AliasIsCreatedByOgone()
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...
93
    {
94
        $passphraseOut = new Passphrase(PASSPHRASE_SHA_OUT);
95
        $shaOutComposer = new AllParametersShaComposer($passphraseOut);
96
        $shaOutComposer->addParameterFilter(new ShaOutParameterFilter());
97
98
        $createAliasResponse = $this->provideAliasResponse(false);
99
100
        $this->assertTrue($createAliasResponse->isValid($shaOutComposer));
101
        $this->assertTrue($createAliasResponse->isSuccessful());
102
    }
103
104
    /**
105
     * @test
106
     */
107 View Code Duplication
    public function CreateAliasInvalid()
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...
108
    {
109
        $passphraseOut = new Passphrase(PASSPHRASE_SHA_OUT);
110
        $shaOutComposer = new AllParametersShaComposer($passphraseOut);
111
        $shaOutComposer->addParameterFilter(new ShaOutParameterFilter());
112
113
        $createAliasResponse = $this->provideAliasResponse(true, true);
114
115
        $this->assertTrue($createAliasResponse->isValid($shaOutComposer));
116
        $this->assertFalse($createAliasResponse->isSuccessful());
117
    }
118
119
120
    public function provideAliasResponse($createAlias = true, $noValidCardnumber = false)
121
    {
122
        /*
123
         *  Create an alias request to Ogone
124
         */
125
        $passphrase = new Passphrase(PASSPHRASE_SHA_IN);
126
        $shaComposer = new AllParametersShaComposer($passphrase);
127
128
        $createAliasRequest = new CreateAliasRequest($shaComposer);
129
        $createAliasRequest->setPspid(PSPID);
130
        $createAliasRequest->setAccepturl('http://www.example.com');
131
        $createAliasRequest->setExceptionurl('http://www.example.com');
132
133
        if ($createAlias == true) {
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
134
            $unique_alias = uniqid('customer_'); // create a unique alias
135
            $alias = new Alias($unique_alias);
136
            $createAliasRequest->setAlias($alias);
137
        }
138
139
        $createAliasRequest->validate();
140
141
        $body = array();
142
        foreach ($createAliasRequest->toArray() as $key => $value) {
143
            $body[strtoupper($key)] = $value;
144
        }
145
146
        $body['SHASIGN'] = $createAliasRequest->getShaSign();
147
        $body['CN'] = 'Don Corleone';
148
        $body['CARDNO'] = ($noValidCardnumber) ? '' : '4111111111111111'; // Ogone Visa test cardnumber
149
        $body['CVC'] = '777';
150
        $body['ED'] = date('my', strtotime('+1 year')); // test-date should be in the future
151
152
        $client = new Client($createAliasRequest->getOgoneUri());
153
        $request = $client->post(null, null, $body);
154
        $response = $request->send();
155
156
        $url = parse_url($response->getInfo('url'));
157
        $params = array();
158
        parse_str($url['query'], $params);
159
160
        /*
161
         * Validate alias response from Ogone
162
         */
163
164
        $createAliasResponse = new CreateAliasResponse($params);
0 ignored issues
show
It seems like $params can also be of type null; however, Ogone\AbstractResponse::__construct() does only seem to accept array, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
165
166
        return $createAliasResponse;
167
    }
168
}
169