GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (90)

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/Bindings/Browser/VersioningService.php (7 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
namespace Dkd\PhpCmis\Bindings\Browser;
3
4
/*
5
 * This file is part of php-cmis-client.
6
 *
7
 * (c) Sascha Egerer <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
use Dkd\PhpCmis\Constants;
14
use Dkd\PhpCmis\Data\AclInterface;
15
use Dkd\PhpCmis\Data\ExtensionDataInterface;
16
use Dkd\PhpCmis\Data\ObjectDataInterface;
17
use Dkd\PhpCmis\Data\PropertiesInterface;
18
use Dkd\PhpCmis\Enum\IncludeRelationships;
19
use Dkd\PhpCmis\VersioningServiceInterface;
20
use GuzzleHttp\Stream\StreamInterface;
21
22
/**
23
 * Versioning Service Browser Binding client.
24
 */
25
class VersioningService extends AbstractBrowserBindingService implements VersioningServiceInterface
26
{
27
    /**
28
     * Reverses the effect of a check-out.
29
     *
30
     * @param string $repositoryId the identifier for the repository
31
     * @param string $objectId the identifier for the PWC
32
     * @param ExtensionDataInterface|null $extension
33
     */
34 View Code Duplication
    public function cancelCheckOut($repositoryId, & $objectId, ExtensionDataInterface $extension = null)
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...
35
    {
36
        $objectId = $this->getJsonConverter()->convertObject(
37
            (array) $this->postJson(
38
                $this->getObjectUrl($repositoryId, $objectId),
39
                $this->createQueryArray(
40
                    Constants::CMISACTION_CANCEL_CHECK_OUT,
41
                    [],
42
                    $extension
43
                )
44
            )
45
        );
46
    }
47
48
    /**
49
     * Checks-in the private working copy (PWC) document.
50
     *
51
     * @param string $repositoryId the identifier for the repository
52
     * @param string $objectId input: the identifier for the PWC,
53
     *      output: the identifier for the newly created version document
54
     * @param boolean $major indicator if the new version should become a major (<code>true</code>) or minor
55
     *      (<code>false</code>) version
56
     * @param PropertiesInterface|null $properties the property values that must be applied to the
57
     *      newly created document object
58
     * @param StreamInterface|null $contentStream the content stream that must be stored
59
     *      for the newly created document object
60
     * @param string|null $checkinComment a version comment
61
     * @param string[] $policies a list of policy IDs that must be applied to the newly created document object
62
     * @param AclInterface|null $addAces a list of ACEs that must be added to the newly created document object
63
     * @param AclInterface|null $removeAces a list of ACEs that must be removed from the newly created document object
64
     * @param ExtensionDataInterface|null $extension
65
     */
66
    public function checkIn(
67
        $repositoryId,
68
        & $objectId,
69
        $major = true,
70
        PropertiesInterface $properties = null,
71
        StreamInterface $contentStream = null,
72
        $checkinComment = null,
73
        array $policies = [],
74
        AclInterface $addAces = null,
75
        AclInterface $removeAces = null,
76
        ExtensionDataInterface $extension = null
77
    ) {
78
        $queryArray = $this->createQueryArray(
79
            Constants::CMISACTION_CHECK_IN,
80
            [
81
                Constants::PARAM_MAJOR => $major ? 'true' : 'false',
82
            ],
83
            $extension
84
        );
85
        if ($properties) {
86
            $queryArray = array_replace(
87
                $queryArray,
88
                $this->convertPropertiesToQueryArray($properties)
89
            );
90
        }
91
        if ($checkinComment) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $checkinComment of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
92
            $queryArray[Constants::PARAM_CHECKIN_COMMENT] = $checkinComment;
93
        }
94
        if (!empty($policies)) {
95
            $queryArray = array_replace(
96
                $queryArray,
97
                $this->convertPolicyIdArrayToQueryArray($policies)
98
            );
99
        }
100 View Code Duplication
        if (!empty($removeAces)) {
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...
101
            $queryArray = array_replace($queryArray, $this->convertAclToQueryArray(
102
                $removeAces,
103
                Constants::CONTROL_REMOVE_ACE_PRINCIPAL,
104
                Constants::CONTROL_REMOVE_ACE_PERMISSION
105
            ));
106
        }
107 View Code Duplication
        if (!empty($addAces)) {
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...
108
            $queryArray = array_replace($queryArray, $this->convertAclToQueryArray(
109
                $addAces,
110
                Constants::CONTROL_ADD_ACE_PRINCIPAL,
111
                Constants::CONTROL_ADD_ACE_PERMISSION
112
            ));
113
        }
114
        if ($contentStream) {
115
            $queryArray['content'] = $contentStream;
116
        }
117
        $objectId = $this->getJsonConverter()->convertObject(
118
            (array) $this->postJson(
119
                $this->getObjectUrl($repositoryId, $objectId),
120
                $queryArray
121
            )
122
        )->getId();
123
    }
124
125
    /**
126
     * Create a private working copy of the document.
127
     *
128
     * @param string $repositoryId the identifier for the repository
129
     * @param string $objectId input: the identifier for the document that should be checked out,
130
     *      output: the identifier for the newly created PWC
131
     * @param ExtensionDataInterface|null $extension
132
     * @param boolean|null $contentCopied output: indicator if the content of the original
133
     *      document has been copied to the PWC
134
     */
135 View Code Duplication
    public function checkOut(
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...
136
        $repositoryId,
137
        & $objectId,
138
        ExtensionDataInterface $extension = null,
139
        $contentCopied = null
140
    ) {
141
        $objectData = $this->getJsonConverter()->convertObject(
142
            (array) $this->postJson(
143
                $this->getObjectUrl($repositoryId, $objectId),
144
                $this->createQueryArray(
145
                    Constants::CMISACTION_CHECK_OUT,
146
                    [],
147
                    $extension
148
                )
149
            )
150
        );
151
        $objectId = $objectData->getId();
152
    }
153
154
    /**
155
     * Returns the list of all document objects in the specified version series,
156
     * sorted by the property "cmis:creationDate" descending.
157
     *
158
     * @param string $repositoryId the identifier for the repository
159
     * @param string $objectId the identifier for the object
160
     * @param string $versionSeriesId the identifier for the object
161
     * @param string|null $filter a comma-separated list of query names that defines which properties must be
162
     *      returned by the repository (default is repository specific)
163
     * @param boolean $includeAllowableActions if <code>true</code>, then the repository must return the allowable
164
     *      actions for the objects (default is <code>false</code>)
165
     * @param ExtensionDataInterface|null $extension
166
     * @return ObjectDataInterface[] the complete version history of the version series
167
     */
168
    public function getAllVersions(
169
        $repositoryId,
170
        $objectId,
171
        $versionSeriesId,
172
        $filter = null,
173
        $includeAllowableActions = false,
174
        ExtensionDataInterface $extension = null
175
    ) {
176
        return $this->getJsonConverter()->convertObjectList(
177
            [
178
                'objects' => (array) $this->readJson(
179
                    $this->getObjectUrl($repositoryId, $objectId, Constants::SELECTOR_VERSIONS)
180
                )
181
            ]
182
        )->getObjects();
183
    }
184
185
    /**
186
     * Get the latest document object in the version series.
187
     *
188
     * @param string $repositoryId the identifier for the repository
189
     * @param string $objectId
190
     * @param string $versionSeriesId
191
     * @param boolean $major
192
     * @param string|null $filter a comma-separated list of query names that defines which properties must be
193
     *      returned by the repository (default is repository specific)
194
     * @param boolean $includeAllowableActions
195
     * @param IncludeRelationships|null $includeRelationships indicates what relationships in which the objects
196
     *      participate must be returned (default is <code>IncludeRelationships::NONE</code>)
197
     * @param string $renditionFilter indicates what set of renditions the repository must return whose kind
198
     *      matches this filter (default is "cmis:none")
199
     * @param boolean $includePolicyIds if <code>true</code>, then the repository must return the policy ids for
200
     *      the object (default is <code>false</code>)
201
     * @param boolean $includeAcl if <code>true</code>, then the repository must return the ACL for the object
202
     *      (default is <code>false</code>)
203
     * @param ExtensionDataInterface|null $extension
204
     * @return ObjectDataInterface
205
     */
206
    public function getObjectOfLatestVersion(
207
        $repositoryId,
208
        $objectId,
209
        $versionSeriesId,
210
        $major = false,
211
        $filter = null,
212
        $includeAllowableActions = false,
213
        IncludeRelationships $includeRelationships = null,
214
        $renditionFilter = Constants::RENDITION_NONE,
215
        $includePolicyIds = false,
216
        $includeAcl = false,
217
        ExtensionDataInterface $extension = null
218
    ) {
219
        $object = (array) $this->readJson(
220
            $this->getObjectUrl($repositoryId, $objectId, Constants::SELECTOR_VERSIONS)
221
        );
222
        return $this->getJsonConverter()->convertObject(reset($object));
223
    }
224
225
    /**
226
     * Get a subset of the properties for the latest document object in the version series.
227
     *
228
     * @param string $repositoryId the identifier for the repository
229
     * @param string $objectId The identifier for the object
230
     * @param string $versionSeriesId The identifier for the version series.
231
     * @param boolean $major If <code>true</code>, then the repository MUST return the properties for the latest
232
     *      major version object in the version series.
233
     *      If <code>false</code>, the repository MUST return the properties for the latest
234
     *      (major or non-major) version object in the version series.
235
     * @param string|null $filter a comma-separated list of query names that defines which properties must be
236
     *      returned by the repository (default is repository specific)
237
     * @param ExtensionDataInterface|null $extension
238
     * @return PropertiesInterface
239
     */
240
    public function getPropertiesOfLatestVersion(
241
        $repositoryId,
242
        $objectId,
243
        $versionSeriesId,
244
        $major = false,
245
        $filter = null,
246
        ExtensionDataInterface $extension = null
247
    ) {
248
        return $this->getObjectOfLatestVersion(
249
            $repositoryId,
250
            $objectId,
251
            $versionSeriesId,
252
            $major,
253
            $filter,
254
            $extension
0 ignored issues
show
$extension is of type null|object<Dkd\PhpCmis\...ExtensionDataInterface>, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
255
        )->getProperties();
256
    }
257
258
    /**
259
     * @param string $action
260
     * @param array $parameters
261
     * @param ExtensionDataInterface $extension
262
     * @return array
263
     */
264
    protected function createQueryArray(
265
        $action,
266
        array $parameters = [],
267
        ExtensionDataInterface $extension = null
0 ignored issues
show
The parameter $extension is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
268
    ) {
269
        $queryArray = array_replace(
270
            $parameters,
271
            [
272
                Constants::CONTROL_CMISACTION => $action,
273
                Constants::PARAM_SUCCINCT => $this->getSuccinct() ? 'true' : 'false',
274
            ]
275
        );
276
        return $queryArray;
277
    }
278
279
}
280