Issues (7)

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.

spec/Resolvable/ResolvableFilesystemSpec.php (1 issue)

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 spec\Gaufrette\Extras\Resolvable;
4
5
use Gaufrette\Extras\Resolvable\ResolvableFilesystem;
6
use Gaufrette\Extras\Resolvable\ResolverInterface;
7
use Gaufrette\Extras\Resolvable\UnresolvableObjectException;
8
use Gaufrette\File;
9
use Gaufrette\FilesystemInterface;
10
use Gaufrette\Stream;
11
use PhpSpec\ObjectBehavior;
12
13
class ResolvableFilesystemSpec extends ObjectBehavior
14
{
15
    function let(MockedFilesystem $decorated, ResolverInterface $resolver)
16
    {
17
        $this->beConstructedWith($decorated, $resolver);
18
    }
19
20
    function it_is_initializable()
21
    {
22
        $this->shouldHaveType(ResolvableFilesystem::class);
23
    }
24
25
    function it_is_a_filesystem()
26
    {
27
        $this->shouldImplement(FilesystemInterface::class);
28
    }
29
30
    function it_resolves_object_path_into_uri($resolver)
31
    {
32
        $resolver->resolve('foo')->willReturn('https://yolo.com/my_image.png');
33
        $this->resolve('foo')->shouldReturn('https://yolo.com/my_image.png');
34
    }
35
36
    function it_throws_unresolvable_object_exception_if_any_error_happen_during_resolution($resolver)
37
    {
38
        $resolver->resolve('foo')->willThrow(\Exception::class);
39
        $this->shouldThrow(UnresolvableObjectException::class)->duringResolve('foo');
40
    }
41
42
    function it_delegates_has_to_decorated_filesystem($decorated)
43
    {
44
        $decorated->has('foo')->willReturn(true);
45
        $this->has('foo')->shouldReturn(true);
46
    }
47
48
    function it_delegates_rename_to_decorated_filesystem($decorated)
49
    {
50
        $decorated->rename('foo', 'bar')->willReturn(true);
51
        $this->rename('foo', 'bar')->shouldReturn(true);
52
    }
53
54
    function it_delegates_get_to_decorated_filesystem($decorated, File $file)
55
    {
56
        $decorated->get('foo', true)->willReturn($file);
57
        $this->get('foo', true)->shouldReturn($file);
58
    }
59
60
    function it_delegates_write_to_decorated_filesystem($decorated)
61
    {
62
        $decorated->write('foo', 'content', true)->willReturn(7);
63
        $this->write('foo', 'content', true)->shouldReturn(7);
64
    }
65
66
    function it_delegates_read_to_decorated_filesystem($decorated)
67
    {
68
        $decorated->read('foo')->willReturn('content');
69
        $this->read('foo')->shouldReturn('content');
70
    }
71
72
    function it_delegates_delete_to_decorated_filesystem($decorated)
73
    {
74
        $decorated->delete('foo')->willReturn(true);
75
        $this->delete('foo')->shouldReturn(true);
76
    }
77
78
    function it_delegates_keys_to_decorated_filesystem($decorated)
79
    {
80
        $decorated->keys()->willReturn(['foo', 'bar']);
81
        $this->keys()->shouldReturn(['foo', 'bar']);
82
    }
83
84
    function it_delegates_list_keys_to_decorated_filesystem($decorated)
85
    {
86
        $decorated->listKeys('aze/*')->willReturn(['keys' => ['foo', 'bar']]);
87
        $this->listKeys('aze/*')->shouldReturn(['keys' => ['foo', 'bar']]);
88
    }
89
90
    function it_delegates_mime_type_retrieval_to_decorated_filesystem($decorated)
91
    {
92
        $decorated->mtime('foo')->willReturn(123);
93
        $this->mtime('foo')->shouldReturn(123);
94
    }
95
96
    function it_delegates_checksum_computation_to_decorated_filesystem($decorated)
97
    {
98
        $decorated->checksum('foo')->willReturn('abcdef');
99
        $this->checksum('foo')->shouldReturn('abcdef');
100
    }
101
102
    function it_delegates_size_computation_to_decorated_filesystem($decorated)
103
    {
104
        $decorated->size('foo')->willReturn(123);
105
        $this->size('foo')->shouldReturn(123);
106
    }
107
108
    function it_delegates_stream_creation_to_decorated_filesystem($decorated, Stream $stream)
109
    {
110
        $decorated->createStream('foo')->willReturn($stream);
111
        $this->createStream('foo')->shouldReturn($stream);
112
    }
113
114
    function it_delegates_file_creation_to_decorated_filesystem($decorated, File $file)
115
    {
116
        $decorated->createFile('foo')->willReturn($file);
117
        $this->createFile('foo')->shouldReturn($file);
118
    }
119
120
    function it_delegates_mime_type_guessing_to_decorated_filesystem($decorated)
121
    {
122
        $decorated->mimeType('foo')->willReturn('application/json');
123
        $this->mimeType('foo')->shouldReturn('application/json');
124
    }
125
126
    function it_delegates_is_directory_to_delegated_filesystem($decorated)
127
    {
128
        $decorated->isDirectory('foo')->willReturn(false);
129
        $this->isDirectory('foo')->shouldReturn(false);
130
    }
131
132
    function it_delegates_any_other_method_call_to_decorated_filesystem($decorated)
133
    {
134
        $decorated->otherMethod()->shouldBeCalled();
135
136
        $this->otherMethod();
137
    }
138
}
139
140
interface MockedFilesystem extends FilesystemInterface {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
141
    public function otherMethod();
142
}
143