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 (1449)

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.

src/Message/AuthorizeResponse.php (104 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 Omnipay\FirstAtlanticCommerce\Message;
4
5
use Omnipay\Common\Exception\InvalidResponseException;
6
use Omnipay\Common\Message\RequestInterface;
7
use Omnipay\FirstAtlanticCommerce\Message\AbstractResponse;
8
9
/**
10
 * FACPG2 XML Authorize Response
11
 */
12
class AuthorizeResponse extends AbstractResponse
13
{
14
    /**
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
15
     * Constructor
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
16
     *
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
17
     * @param RequestInterface $request
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
18
     * @param string $data
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
19
     */
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
20
    public function __construct(RequestInterface $request, $data)
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
21
    {
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
22
        if ( empty($data) )
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
Opening brace should be on the same line as the declaration
Loading history...
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
23
        {
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
24
            throw new InvalidResponseException();
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
25
        }
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
26
27
        $this->request = $request;
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
28
        $this->data    = $this->xmlDeserialize($data);
0 ignored issues
show
$data is of type string, but the function expects a object<SimpleXMLElement>.

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...
Tabs must be used to indent lines; spaces are not allowed
Loading history...
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
29
30
        $this->verifySignature();
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
31
    }
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
32
33
    /**
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
34
     * Verifies the signature for the response.
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
35
     *
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
36
     * @throws InvalidResponseException if the signature doesn't match
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
37
     *
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
38
     * @return void
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
39
     */
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
40
    public function verifySignature()
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
The function name verifySignature is in camel caps, but expected verify_signature instead as per the coding standard.
Loading history...
41
    {
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
42
        if ( isset($this->data['CreditCardTransactionResults']['ResponseCode']) && (
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
Opening brace should be on the same line as the declaration
Loading history...
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
43
            '1' == $this->data['CreditCardTransactionResults']['ResponseCode'] ||
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
44
            '2' == $this->data['CreditCardTransactionResults']['ResponseCode']) )
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
45
        {
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
46
            $signature  = $this->request->getMerchantPassword();
0 ignored issues
show
It seems like you code against a concrete implementation and not the interface Omnipay\Common\Message\RequestInterface as the method getMerchantPassword() does only exist in the following implementations of said interface: Omnipay\FirstAtlanticCom...Message\AbstractRequest, Omnipay\FirstAtlanticCom...essage\AuthorizeRequest, Omnipay\FirstAtlanticCom...\Message\CaptureRequest, Omnipay\FirstAtlanticCom...ssage\CreateCardRequest, Omnipay\FirstAtlanticCom...Message\PurchaseRequest, Omnipay\FirstAtlanticCom...e\Message\RefundRequest, Omnipay\FirstAtlanticCom...e\Message\StatusRequest, Omnipay\FirstAtlanticCom...tionModificationRequest, Omnipay\FirstAtlanticCom...ssage\UpdateCardRequest, Omnipay\FirstAtlanticCommerce\Message\VoidRequest.

Let’s take a look at an example:

interface User
{
    /** @return string */
    public function getPassword();
}

class MyUser implements User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the interface:

    interface User
    {
        /** @return string */
        public function getPassword();
    
        /** @return string */
        public function getDisplayName();
    }
    
Loading history...
Tabs must be used to indent lines; spaces are not allowed
Loading history...
47
            $signature .= $this->request->getMerchantId();
0 ignored issues
show
It seems like you code against a concrete implementation and not the interface Omnipay\Common\Message\RequestInterface as the method getMerchantId() does only exist in the following implementations of said interface: Omnipay\FirstAtlanticCom...Message\AbstractRequest, Omnipay\FirstAtlanticCom...essage\AuthorizeRequest, Omnipay\FirstAtlanticCom...\Message\CaptureRequest, Omnipay\FirstAtlanticCom...ssage\CreateCardRequest, Omnipay\FirstAtlanticCom...Message\PurchaseRequest, Omnipay\FirstAtlanticCom...e\Message\RefundRequest, Omnipay\FirstAtlanticCom...e\Message\StatusRequest, Omnipay\FirstAtlanticCom...tionModificationRequest, Omnipay\FirstAtlanticCom...ssage\UpdateCardRequest, Omnipay\FirstAtlanticCommerce\Message\VoidRequest.

Let’s take a look at an example:

interface User
{
    /** @return string */
    public function getPassword();
}

class MyUser implements User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the interface:

    interface User
    {
        /** @return string */
        public function getPassword();
    
        /** @return string */
        public function getDisplayName();
    }
    
Loading history...
Tabs must be used to indent lines; spaces are not allowed
Loading history...
48
            $signature .= $this->request->getAcquirerId();
0 ignored issues
show
It seems like you code against a concrete implementation and not the interface Omnipay\Common\Message\RequestInterface as the method getAcquirerId() does only exist in the following implementations of said interface: Omnipay\FirstAtlanticCom...Message\AbstractRequest, Omnipay\FirstAtlanticCom...essage\AuthorizeRequest, Omnipay\FirstAtlanticCom...\Message\CaptureRequest, Omnipay\FirstAtlanticCom...ssage\CreateCardRequest, Omnipay\FirstAtlanticCom...Message\PurchaseRequest, Omnipay\FirstAtlanticCom...e\Message\RefundRequest, Omnipay\FirstAtlanticCom...e\Message\StatusRequest, Omnipay\FirstAtlanticCom...tionModificationRequest, Omnipay\FirstAtlanticCom...ssage\UpdateCardRequest, Omnipay\FirstAtlanticCommerce\Message\VoidRequest.

Let’s take a look at an example:

interface User
{
    /** @return string */
    public function getPassword();
}

class MyUser implements User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the interface:

    interface User
    {
        /** @return string */
        public function getPassword();
    
        /** @return string */
        public function getDisplayName();
    }
    
Loading history...
Tabs must be used to indent lines; spaces are not allowed
Loading history...
49
            $signature .= $this->request->getTransactionId();
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
50
51
            $signature  = base64_encode( sha1($signature, true) );
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
52
53
            if ( $signature !== $this->data['Signature'] ) {
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
54
                throw new InvalidResponseException('Signature verification failed');
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
55
            }
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
56
        }
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
57
    }
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
58
59
    /**
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
60
     * Return whether or not the response was successful
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
61
     *
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
62
     * @return boolean
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
63
     */
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
64
    public function isSuccessful()
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
The function name isSuccessful is in camel caps, but expected is_successful instead as per the coding standard.
Loading history...
65
    {
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
66
        return isset($this->data['CreditCardTransactionResults']['ResponseCode']) && '1' === $this->data['CreditCardTransactionResults']['ResponseCode'];
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
67
    }
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
68
69
    /**
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
70
     * Return the response's reason code
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
71
     *
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
72
     * @return string
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
73
     */
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
74
    public function getCode()
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
The function name getCode is in camel caps, but expected get_code instead as per the coding standard.
Loading history...
75
    {
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
76
        return isset($this->data['CreditCardTransactionResults']['ReasonCode']) ? $this->data['CreditCardTransactionResults']['ReasonCode'] : null;
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
77
    }
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
78
79
    /**
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
80
     * Return the response's reason message
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
81
     *
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
82
     * @return string
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
83
     */
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
84
    public function getMessage()
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
The function name getMessage is in camel caps, but expected get_message instead as per the coding standard.
Loading history...
85
    {
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
86
        return isset($this->data['CreditCardTransactionResults']['ReasonCodeDescription']) ? $this->data['CreditCardTransactionResults']['ReasonCodeDescription'] : null;
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
87
    }
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
88
89
    /**
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
90
     * Return transaction reference
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
91
     *
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
92
     * @return string
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
93
     */
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
94
    public function getTransactionReference()
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
The function name getTransactionReference is in camel caps, but expected get_transaction_reference instead as per the coding standard.
Loading history...
95
    {
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
96
        return isset($this->data['CreditCardTransactionResults']['ReferenceNumber']) ? $this->data['CreditCardTransactionResults']['ReferenceNumber'] : null;
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
97
    }
0 ignored issues
show
Tabs must be used to indent lines; spaces are not allowed
Loading history...
98
}
99