Issues (18)

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/Dropbox/Models/MetadataCollection.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
namespace Dropbox\Models;
3
4
class MetadataCollection extends BaseModel
5
{
6
7
    /**
8
     * Collection Items Key
9
     *
10
     * @const string
11
     */
12
    const COLLECTION_ITEMS_KEY = 'entries';
13
14
    /**
15
     * Collection Cursor Key
16
     *
17
     * @const string
18
     */
19
    const COLLECTION_CURSOR_KEY = 'cursor';
20
21
    /**
22
     * Collection has-more-items Key
23
     *
24
     * @const string
25
     */
26
    const COLLECTION_HAS_MORE_ITEMS_KEY = 'has_more';
27
28
    /**
29
     * Collection Data
30
     *
31
     * @var array
32
     */
33
    protected $data;
34
35
    /**
36
     * List of Files/Folder Metadata
37
     *
38
     * @var \Dropbox\Models\ModelCollection
39
     */
40
    protected $items = null;
41
42
    /**
43
     * Cursor for pagination and updates
44
     *
45
     * @var string
46
     */
47
    protected $cursor;
48
49
    /**
50
     * If more items are available
51
     *
52
     * @var boolean
53
     */
54
    protected $hasMoreItems;
55
56
    /**
57
     * Create a new Metadata Collection
58
     *
59
     * @param array $data Collection Data
60
     */
61 7
    public function __construct(array $data)
62
    {
63 7
        parent::__construct($data);
64
65 7
        $this->cursor = isset($data[$this->getCollectionCursorKey()]) ? $data[$this->getCollectionCursorKey()] : '';
66 7
        $this->hasMoreItems = isset($data[$this->getCollectionHasMoreItemsKey()]) && $data[$this->getCollectionHasMoreItemsKey()] ? true : false;
67
68 7
        $items = isset($data[$this->getCollectionItemsKey()]) ? $data[$this->getCollectionItemsKey()] : [];
69 7
        $this->processItems($items);
70 7
    }
71
72
    /**
73
     * Get the Collection Items Key
74
     *
75
     * @return string
76
     */
77 7
    public function getCollectionItemsKey()
78
    {
79 7
        return static::COLLECTION_ITEMS_KEY;
80
    }
81
82
    /**
83
     * Get the Collection has-more-items Key
84
     *
85
     * @return string
86
     */
87 7
    public function getCollectionHasMoreItemsKey()
88
    {
89 7
        return static::COLLECTION_HAS_MORE_ITEMS_KEY;
90
    }
91
92
    /**
93
     * Get the Collection Cursor Key
94
     *
95
     * @return string
96
     */
97 7
    public function getCollectionCursorKey()
98
    {
99 7
        return static::COLLECTION_CURSOR_KEY;
100
    }
101
102
    /**
103
     * Get the Items
104
     *
105
     * @return \Dropbox\Models\ModelCollection
106
     */
107 7
    public function getItems()
108
    {
109 7
        return $this->items;
110
    }
111
112
    /**
113
     * Get the cursor
114
     *
115
     * @return string
116
     */
117 1
    public function getCursor()
118
    {
119 1
        return $this->cursor;
120
    }
121
122
    /**
123
     * More items are available
124
     *
125
     * @return boolean
126
     */
127
    public function hasMoreItems()
128
    {
129
        return $this->hasMoreItems;
130
    }
131
132
    /**
133
     * Process items and cast them
134
     * to their respective Models
135
     *
136
     * @param array $items Unprocessed Items
137
     *
138
     * @return void
139
     */
140 4 View Code Duplication
    protected function processItems(array $items)
0 ignored issues
show
This method seems to be duplicated in 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...
141
    {
142 4
        $processedItems = [];
143
144 4
        foreach ($items as $entry) {
145 4
            $processedItems[] = ModelFactory::make($entry);
146
        }
147
148 4
        $this->items = new ModelCollection($processedItems);
149 4
    }
150
}
151