Issues (76)

Security Analysis    not enabled

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/Entity/Status.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
namespace Baguette\Mastodon\Entity;
4
5
/**
6
 * Status
7
 *
8
 * @author    USAMI Kenta <[email protected]>
9
 * @copyright 2017 Baguette HQ
10
 * @license   https://www.gnu.org/licenses/gpl-3.0.html GPL-3.0
11
 * @see https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#status
12
 * @property-read int      $id  The ID of the status
13
 * @property-read string   $uri A Fediverse-unique resource ID
14
 * @property-read string   $url URL to the status page (can be remote)
15
 * @property-read Account  $account The Account which posted the status
16
 * @property-read Attachments[] $media_attachments The Account which posted the status
17
 * @property-read int|null $in_reply_to_accountid  The ID of the status it replies to
18
 * @property-read int|null $in_reply_to_id The ID of the account it replies to
19
 * @property-read Status|null $reblog The reblogged Status
20
 * @property-read string   $content   Body of the status; this will contain HTML (remote HTML already sanitized)
21
 * @property-read \DateTimeImmutable $created_at The time the status was created
22
 * @property-read int    $reblogs_count    The number of reblogs for the status
23
 * @property-read int    $favourites_count The number of favourites for the status
24
 * @property-read bool   $reblogged    Whether the authenticated user has reblogged the status
25
 * @property-read bool   $favourited   Whether the authenticated user has favourited the status
26
 * @property-read string $sensitive    Whether media attachments should be hidden by default
27
 * @property-read string $spoiler_text If not empty, warning text that should be displayed before the actual content
28
 * @property-read string $visibility   One of: public, unlisted, private, direct
29
 * @property-read Attachment[] $media_attachments An array of Attachments
30
 * @property-read Mention[]    $mentions An array of Mentions
31
 * @property-read Tag[]        $tags     An array of Tags
32
 * @property-read Application  $application Application from which the status was posted
33
 */
34
class Status extends Entity
35
{
36
    use \Teto\Object\TypedProperty;
37
38
    private static $property_types = [
0 ignored issues
show
The property $property_types is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
39
        'id'                => 'int',
40
        'uri'               => 'string',
41
        'url'               => 'string',
42
        'account'           => Account::class,
43
        'in_reply_to_id'    => '?int',
44
        'in_reply_to_account_id' => '?int',
45
        'reblog'            => Status::class,
46
        'content'           => 'string',
47
        'created_at'        => \DateTimeImmutable::class,
48
        'reblogs_count'     => 'int',
49
        'favourites_count'  => 'int',
50
        'reblogged'         => 'bool',
51
        'favourited'        => 'bool',
52
        'sensitive'         => 'bool',
53
        'spoiler_text'      => 'string',
54
        'visibility'        => 'enum',
55
        'media_attachments' => 'Baguette\Mastodon\Entity\Attachment[]',
56
        'mentions'          => 'Baguette\Mastodon\Entity\Mention[]',
57
        'tags'              => 'Baguette\Mastodon\Entity\Tag[]',
58
        'application'       => Application::class,
59
    ];
60
61
    private static $enum_values = [
0 ignored issues
show
The property $enum_values is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
62
        'visibility' => ['direct', 'private', 'unlisted', 'public'],
63
    ];
64
65 2
    public function __construct(array $properties)
66
    {
67 2
        $this->setProperties(mapValues($properties, [
68 2
            'account'           => Account::class,
69
            'reblog'            => Status::class,
70
            'created_at'        => \DateTimeImmutable::class,
71
            'media_attachments' => [Attachment::class],
72
            'mentions'          => [Mention::class],
73
            'tags'              => [Tag::class],
74
            'application'       => Application::class,
75
        ]));
76 2
    }
77
78
    /**
79
     * Returns account data as array
80
     *
81
     * @return array
82
     */
83 3
    public function toArray()
84
    {
85
        return [
86 3
            'id'                => $this->id,
87 3
            'uri'               => $this->uri,
88 3
            'url'               => $this->url,
89 3
            'account'           => toArrayValue($this->account),
90 3
            'in_reply_to_id'    => $this->in_reply_to_id,
91 3
            'in_reply_to_account_id' => $this->in_reply_to_account_id,
0 ignored issues
show
The property in_reply_to_account_id does not seem to exist. Did you mean account?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
92 3
            'reblog'            => toArrayValue($this->reblog),
93 3
            'content'           => $this->content,
94 3
            'created_at'        => toArrayValue($this->created_at),
95 3
            'reblogs_count'     => $this->reblogs_count,
96 3
            'favourites_count'  => $this->favourites_count,
97 3
            'reblogged'         => $this->reblogged,
98 3
            'favourited'        => $this->favourited,
99 3
            'sensitive'         => $this->sensitive,
100 3
            'spoiler_text'      => $this->spoiler_text,
101 3
            'visibility'        => $this->visibility,
102 3
            'media_attachments' => toArrayValue($this->media_attachments),
103 3
            'mentions'          => toArrayValue($this->mentions),
104 3
            'tags'              => toArrayValue($this->tags),
105 3
            'application'       => toArrayValue($this->application),
106
        ];
107
    }
108
}
109