Issues (16)

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.

src/Resources/Source.php (1 issue)

Labels
Severity

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 namespace Arcanedev\Stripe\Resources;
2
3
use Arcanedev\Stripe\Contracts\Resources\Source as SourceContract;
4
use Arcanedev\Stripe\Exceptions\ApiException;
5
use Arcanedev\Stripe\Exceptions\InvalidRequestException;
6
use Arcanedev\Stripe\StripeResource;
7
use Arcanedev\Stripe\Utilities\Util;
8
9
/**
10
 * Class     Source
11
 *
12
 * @package  Arcanedev\Stripe\Resources
13
 * @author   ARCANEDEV <[email protected]>
14
 *
15
 * @property  string  type
16
 */
17
class Source extends StripeResource implements SourceContract
18
{
19
    /* -----------------------------------------------------------------
20
     |  Main Methods
21
     | -----------------------------------------------------------------
22
     */
23
24
    /**
25
     * Retrieve a Source.
26
     *
27
     * @param  string             $id
28
     * @param  array|string|null  $options
29
     *
30
     * @return self
31
     */
32 8
    public static function retrieve($id, $options = null)
33
    {
34 8
        return self::scopedRetrieve($id, $options);
35
    }
36
37
    /**
38
     * Create a Source.
39
     *
40
     * @param  array|null         $params
41
     * @param  array|string|null  $options
42
     *
43
     * @return self
44
     */
45 2
    public static function create($params = null, $options = null)
46
    {
47 2
        return self::scopedCreate($params, $options);
48
    }
49
50
    /**
51
     * Verify the bank account.
52
     *
53
     * @param  array|null         $params
54
     * @param  array|string|null  $options
55
     *
56
     * @return self
57
     */
58 2
    public function verify($params = null, $options = null)
59
    {
60 2
        list($response, $opts) = $this->request('post', $this->instanceUrl() . '/verify', $params, $options);
61 2
        $this->refreshFrom($response, $opts);
62
63 2
        return $this;
64
    }
65
66
    /**
67
     * Update a source.
68
     *
69
     * @param  string             $id
70
     * @param  array|null         $params
71
     * @param  array|string|null  $options
72
     *
73
     * @return self
74
     */
75
    public static function update($id, $params = null, $options = null)
76
    {
77
        return self::scopedUpdate($id, $params, $options);
78
    }
79
80
    /**
81
     * Save a source.
82
     *
83
     * @param array|string|null $options
84
     *
85
     * @return self
86
     */
87 6
    public function save($options = null)
88
    {
89 6
        return $this->scopedSave($options);
90
    }
91
92
    /**
93
     * Detach a source.
94
     *
95
     * @param  array|null         $params
96
     * @param  array|string|null  $options
97
     *
98
     * @return self
99
     *
100
     * @throws \Arcanedev\Stripe\Exceptions\ApiException
101
     * @throws \Arcanedev\Stripe\Exceptions\InvalidRequestException
102
     */
103 4
    public function detach($params = null, $options = null)
104
    {
105 4
        static::checkArguments($params, $options);
106
107 4
        $id = $this['id'];
108 4
        if ( ! $id) {
109
            $class = get_class($this);
110
111
            throw new InvalidRequestException(
112
                "Could not determine which URL to request: {$class} instance has invalid ID: {$id}", null
113
            );
114
        }
115
116 4
        if ($this['customer']) {
117 2
            $base       = Customer::classUrl();
118 2
            $parentExtn = urlencode(str_utf8($this['customer']));
119 2
            $extn       = urlencode(str_utf8($id));
120
121 2
            list($response, $opts) = $this->request('delete', "{$base}/{$parentExtn}/sources/{$extn}", $params, $options);
122 2
            $this->refreshFrom($response, $opts);
123
124 2
            return $this;
125
        }
126
127 2
        throw new ApiException(
128 2
            'This source object does not appear to be currently attached to a customer object.'
129
        );
130
    }
131
132
    /**
133
     * Delete a source.
134
     *
135
     * @deprecated Use the `detach` method instead.
136
     *
137
     * @param  array|null         $params
138
     * @param  array|string|null  $options
139
     *
140
     * @return self
141
     */
142
    public function delete($params = null, $options = null)
143
    {
144
        return $this->detach($params, $options);
145
    }
146
147
    /**
148
     * Get the source transactions.
149
     *
150
     * @param  array|null         $params
151
     * @param  array|string|null  $options
152
     *
153
     * @return \Arcanedev\Stripe\Collection
154
     */
155 2
    public function sourceTransactions($params = null, $options = null)
156
    {
157 2
        list($response, $opts) = static::staticRequest(
158 2
            'get', $this->instanceUrl().'/source_transactions', $params, $options
159
        );
160
161
        /** @var  \Arcanedev\Stripe\Http\Response  $response */
162 2
        return Util::convertToStripeObject($response->getJson(), $opts)
0 ignored issues
show
It seems like $response->getJson() targeting Arcanedev\Stripe\Http\Response::getJson() can also be of type null; however, Arcanedev\Stripe\Utiliti...convertToStripeObject() does only seem to accept array, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
163 2
                   ->setLastResponse($response);
164
    }
165
}
166