Issues (4)

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/Drivers/AwsS3v2DriverCompatible.php (2 issues)

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
2
/**
3
 * @link https://github.com/phpviet/laravel-flysystem
4
 * @copyright (c) PHP Viet
5
 * @license [MIT](http://www.opensource.org/licenses/MIT)
6
 */
7
8
namespace PHPViet\Laravel\Flysystem\Drivers;
9
10
use Aws\S3\S3Client;
11
use Illuminate\Filesystem\Cache;
12
use League\Flysystem\AdapterInterface;
13
use League\Flysystem\Cached\CachedAdapter;
14
use League\Flysystem\Cached\CacheInterface;
15
use League\Flysystem\Cached\Storage\Memory as MemoryStore;
16
17
/**
18
 * @author Vuong Minh <[email protected]>
19
 * @since 1.0.0
20
 */
21
trait AwsS3v2DriverCompatible
22
{
23
    /**
24
     * Khởi tạo AwsS3v2 adapter.
25
     *
26
     * @return \League\Flysystem\AdapterInterface
27
     */
28
    protected function createFilesystemAdapter(): AdapterInterface
29
    {
30
        $adapter = new AwsS3v2Adapter(
31
            $this->createS3Client(),
32
            $this->config['bucket'],
0 ignored issues
show
The property config does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
33
            $this->config['root'] ?? null,
34
            $this->config['options'] ?? []
35
        );
36
37
        if (isset($this->config['cache'])) {
38
            $adapter = new CachedAdapter(
39
                $adapter,
40
                $this->createCacheStore()
41
            );
42
        }
43
44
        return $adapter;
45
    }
46
47
    /**
48
     * Khởi tạo Aws S3 client.
49
     *
50
     * @return \Aws\S3\S3Client
51
     */
52
    protected function createS3Client(): S3Client
53
    {
54
        $config = array_merge([
55
            'endpoint' => $this->getEndPoint(),
56
            'version' => 'latest',
57
            'signature_version' => 's3',
58
        ], $this->config);
59
60
        return S3Client::factory($config);
61
    }
62
63
    /**
64
     * Khởi tạo cache.
65
     *
66
     * @return \League\Flysystem\Cached\CacheInterface
67
     */
68
    protected function createCacheStore(): CacheInterface
69
    {
70
        $config = $this->config['cache'];
71
72
        if (true === $config) {
73
            return new MemoryStore();
74
        }
75
76
        return new Cache(
77
            $this->app['cache']->store($config['store']),
0 ignored issues
show
The property app does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
78
            $config['prefix'] ?? 'flysystem',
79
            $config['expire'] ?? null
80
        );
81
    }
82
83
    /**
84
     * Phương thức trừu tượng trả về đường dẫn endpoint.
85
     *
86
     * @return string
87
     */
88
    abstract protected function getEndPoint(): string;
89
}
90