Issues (93)

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/Configuration/SourceCreate.php (3 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
declare(strict_types=1);
4
5
/*
6
 * This software may be modified and distributed under the terms
7
 * of the MIT license. See the LICENSE file for details.
8
 */
9
10
namespace Shapin\Stripe\Configuration;
11
12
use Shapin\Stripe\Model\Source\Source;
13
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
14
use Symfony\Component\Config\Definition\ConfigurationInterface;
15
16
class SourceCreate implements ConfigurationInterface
17
{
18 6
    public function getConfigTreeBuilder()
19
    {
20 6
        $treeBuilder = new TreeBuilder('shapin_stripe');
21 6
        $rootNode = $treeBuilder->getRootNode();
22
23
        $rootNode
24 6
            ->validate()
25
                ->ifTrue(function ($v) {
26 6
                    return isset($v['usage']) && Source::USAGE_SINGLE_USE === $v['usage'] && !isset($v['amount']);
27 6
                })
28 6
                ->thenInvalid('"amount" is required for "single_use" sources.')
29 6
            ->end()
30 6
            ->validate()
31
                ->ifTrue(function ($v) {
32 5
                    return isset($v['receiver']) && (!isset($v['flow']) || Source::FLOW_RECEIVER !== $v['flow']);
33 6
                })
34 6
                ->thenInvalid('"receiver" can be set only for "receiver" flow.')
35 6
            ->end()
36 6
            ->validate()
37 View Code Duplication
                ->ifTrue(function ($v) {
0 ignored issues
show
This code seems to be duplicated across 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...
38 3
                    return isset($v['flow']) && Source::FLOW_REDIRECT === $v['flow'] && !isset($v['redirect']);
39 6
                })
40 6
                ->thenInvalid('"redirect" must be set when using "redirect" flow.')
41 6
            ->end()
42 6
            ->validate()
43 View Code Duplication
                ->ifTrue(function ($v) {
0 ignored issues
show
This code seems to be duplicated across 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 2
                    return isset($v['type']) && Source::TYPE_THREE_D_SECURE === $v['type'] && !isset($v['three_d_secure']);
45 6
                })
46 6
                ->thenInvalid('"three_d_secure" must be set when using "three_d_secure" source type.')
47 6
            ->end()
48 6
            ->validate()
49 View Code Duplication
                ->ifTrue(function ($v) {
0 ignored issues
show
This code seems to be duplicated across 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...
50 1
                    return isset($v['type']) && Source::TYPE_THREE_D_SECURE === $v['type'] && !isset($v['redirect']);
51 6
                })
52 6
                ->thenInvalid('"redirect" must be set when using "three_d_secure" source type.')
53 6
            ->end()
54 6
            ->children()
55 6
                ->scalarNode('type')
56 6
                    ->isRequired()
57 6
                    ->info('The type of the source to create. Required unless customer and original_source are specified (see the Shared card Sources guide)')
58 6
                ->end()
59 6
                ->scalarNode('amount')
60 6
                    ->info('Amount associated with the source. This is the amount for which the source will be chargeable once ready. Required for single_use sources.')
61 6
                ->end()
62 6
                ->scalarNode('currency')
63 6
                    ->info('Three-letter ISO code for the currency associated with the source. This is the currency for which the source will be chargeable once ready.')
64 6
                ->end()
65 6
                ->enumNode('flow')
66 6
                    ->cannotBeEmpty()
67 6
                    ->values([Source::FLOW_CODE_VERIFICATION, Source::FLOW_NONE, Source::FLOW_RECEIVER, Source::FLOW_REDIRECT])
68 6
                    ->info('The authentication flow of the source to create. flow is one of redirect, receiver, code_verification, none. It is generally inferred unless a type supports multiple flows.')
69 6
                ->end()
70 6
                ->arrayNode('mandate')
71 6
                    ->children()
72 6
                        ->arrayNode('acceptance')
73 6
                            ->children()
74 6
                                ->integerNode('date')
75 6
                                    ->isRequired()
76 6
                                    ->info('The unix timestamp the mandate was accepted or refused at by the customer.')
77 6
                                ->end()
78 6
                                ->scalarNode('ip')
79 6
                                    ->isRequired()
80 6
                                    ->info('The IP address from which the mandate was accepted or refused by the customer.')
81 6
                                ->end()
82 6
                                ->enumNode('status')
83 6
                                    ->isRequired()
84 6
                                    ->cannotBeEmpty()
85 6
                                    ->values(['accepted', 'refused'])
86 6
                                    ->info('The status of the mandate acceptance. Either accepted (the mandate was accepted) or refused (the mandate was refused).')
87 6
                                ->end()
88 6
                                ->scalarNode('user_agent')
89 6
                                    ->isRequired()
90 6
                                    ->info('The user agent of the browser from which the mandate was accepted or refused by the customer. This can be unset by updating the value to null and then saving.')
91 6
                                ->end()
92 6
                            ->end()
93 6
                            ->info('The parameters required to notify Stripe of a mandate acceptance or refusal by the customer.')
94 6
                        ->end()
95 6
                        ->enumNode('notification_method')
96 6
                            ->cannotBeEmpty()
97 6
                            ->values([Source::NOTIFICATION_METHOD_EMAIL, Source::NOTIFICATION_METHOD_MANUAL, Source::NOTIFICATION_METHOD_NONE])
98 6
                            ->info('The method Stripe should use to notify the customer of upcoming debit instructions and/or mandate confirmation as required by the underlying debit network. Either email (an email is sent directly to the customer), manual (a source.mandate_notification event is sent to your webhooks endpoint and you should handle the notification) or none (the underlying debit network does not require any notification).')
99 6
                        ->end()
100 6
                    ->end()
101 6
                    ->info('Information about a mandate possiblity attached to a source object (generally for bank debits) as well as its acceptance status.')
102 6
                ->end()
103 6
                ->arrayNode('metadata')
104 6
                    ->scalarPrototype()->end()
105 6
                    ->info('A set of key/value pairs that you can attach to a source object. It can be useful for storing additional information about the source in a structured format.')
106 6
                ->end()
107 6
                ->arrayNode('owner')
108 6
                    ->children()
109 6
                        ->arrayNode('address')
110 6
                            ->isRequired()
111 6
                            ->children()
112 6
                                ->scalarNode('city')->end()
113 6
                                ->scalarNode('country')->end()
114 6
                                ->scalarNode('line1')->end()
115 6
                                ->scalarNode('line2')->end()
116 6
                                ->scalarNode('postal_code')->end()
117 6
                                ->scalarNode('state')->end()
118 6
                            ->end()
119 6
                            ->info('Shipping address.')
120 6
                        ->end()
121 6
                        ->scalarNode('email')->end()
122 6
                        ->scalarNode('name')->end()
123 6
                        ->scalarNode('phone')->end()
124 6
                    ->end()
125 6
                    ->info('Shipping information for the charge. Helps prevent fraud on charges for physical goods.')
126 6
                ->end()
127 6
                ->arrayNode('receiver')
128 6
                    ->children()
129 6
                        ->enumNode('refund_attributes_method')
130 6
                            ->cannotBeEmpty()
131 6
                            ->values([Source::REFUND_ATTRIBUTES_METHOD_EMAIL, Source::REFUND_ATTRIBUTES_METHOD_MANUAL])
132 6
                            ->info('The method Stripe should use to request information needed to process a refund or mispayment. Either email (an email is sent directly to the customer) or manual (a source.refund_attributes_required event is sent to your webhooks endpoint). Refer to each payment method’s documentation to learn which refund attributes may be required.')
133 6
                        ->end()
134 6
                    ->end()
135 6
                    ->info('Optional parameters for the receiver flow. Can be set only if the source is a receiver (flow is receiver).')
136 6
                ->end()
137 6
                ->arrayNode('redirect')
138 6
                    ->children()
139 6
                        ->scalarNode('return_url')
140 6
                            ->isRequired()
141 6
                            ->info('The URL you provide to redirect the customer back to you after they authenticated their payment. It can use your application URI scheme in the context of a mobile application.')
142 6
                        ->end()
143 6
                    ->end()
144 6
                    ->info('Parameters required for the redirect flow. Required if the source is authenticated by a redirect (flow is redirect).')
145 6
                ->end()
146 6
                ->scalarNode('statement_descriptor')
147 6
                    ->info('An arbitrary string to be displayed on your customer’s statement. As an example, if your website is RunClub and the item you’re charging for is a race ticket, you may want to specify a statement_descriptor of RunClub 5K race ticket. While many payment types will display this information, some may not display it at all.')
148 6
                ->end()
149 6
                ->arrayNode('three_d_secure')
150 6
                    ->children()
151 6
                        ->scalarNode('card')
152 6
                            ->info('The ID of the card source.')
153 6
                        ->end()
154 6
                    ->end()
155 6
                ->end()
156 6
                ->scalarNode('token')
157 6
                    ->info('An optional token used to create the source. When passed, token properties will override source parameters.')
158 6
                ->end()
159 6
                ->enumNode('usage')
160 6
                    ->cannotBeEmpty()
161 6
                    ->values([Source::USAGE_REUSABLE, Source::USAGE_SINGLE_USE])
162 6
                    ->info('Either reusable or single_use. Whether this source should be reusable or not. Some source types may or may not be reusable by construction, while other may leave the option at creation. If an incompatible value is passed, an error will be returned.')
163 6
                ->end()
164 6
            ->end()
165
        ;
166
167 6
        return $treeBuilder;
168
    }
169
}
170