Issues (1191)

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/Model/EloquentObserver.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 namespace Anomaly\Streams\Platform\Model;
2
3
use Anomaly\Streams\Platform\Model\Command\CascadeDelete;
4
use Anomaly\Streams\Platform\Model\Command\CascadeRestore;
5
use Anomaly\Streams\Platform\Model\Event\ModelsWereDeleted;
6
use Anomaly\Streams\Platform\Model\Event\ModelsWereUpdated;
7
use Anomaly\Streams\Platform\Model\Event\ModelWasCreated;
8
use Anomaly\Streams\Platform\Model\Event\ModelWasDeleted;
9
use Anomaly\Streams\Platform\Model\Event\ModelWasRestored;
10
use Anomaly\Streams\Platform\Model\Event\ModelWasSaved;
11
use Anomaly\Streams\Platform\Model\Event\ModelWasUpdated;
12
use Anomaly\Streams\Platform\Support\Observer;
13
use Illuminate\Database\Eloquent\Model;
14
15
/**
16
 * Class EloquentObserver
17
 *
18
 * @link    http://pyrocms.com/
19
 * @author  PyroCMS, Inc. <[email protected]>
20
 * @author  Ryan Thompson <[email protected]>
21
 */
22
class EloquentObserver extends Observer
23
{
24
25
    /**
26
     * Run after a record is created.
27
     *
28
     * @param EloquentModel $model
29
     */
30
    public function creating(EloquentModel $model)
0 ignored issues
show
The parameter $model 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...
31
    {
32
        return true;
33
    }
34
35
    /**
36
     * Run after a record is created.
37
     *
38
     * @param EloquentModel $model
39
     */
40
    public function created(EloquentModel $model)
41
    {
42
        $model->flushCache();
43
44
        $this->events->fire(new ModelWasCreated($model));
45
    }
46
47
    /**
48
     * Run after saving a record.
49
     *
50
     * @param EloquentModel $model
51
     */
52
    public function saved(EloquentModel $model)
53
    {
54
        $model->flushCache();
55
56
        $this->events->fire(new ModelWasSaved($model));
57
    }
58
59
    /**
60
     * Run after a record has been updated.
61
     *
62
     * @param EloquentModel $model
63
     */
64
    public function updated(EloquentModel $model)
65
    {
66
        $model->flushCache();
67
68
        $this->events->fire(new ModelWasUpdated($model));
69
    }
70
71
    /**
72
     * Run after multiple records have been updated.
73
     *
74
     * @param EloquentModel $model
75
     */
76
    public function updatedMultiple(EloquentModel $model)
77
    {
78
        $model->flushCache();
79
80
        $this->events->fire(new ModelsWereUpdated($model));
81
    }
82
83
    /**
84
     * Run before a record is deleted.
85
     *
86
     * @param  EloquentModel $entry
87
     * @return bool
88
     */
89
    public function deleting(EloquentModel $entry)
90
    {
91
        $this->dispatch(new CascadeDelete($entry));
92
93
        return true;
94
    }
95
96
    /**
97
     * Run after a record has been deleted.
98
     *
99
     * @param EloquentModel $model
100
     */
101
    public function deleted(EloquentModel $model)
102
    {
103
        $model->flushCache();
104
105
        /* @var Model $translation */
106
        if ($model->isTranslatable()) {
107
            foreach ($model->translations as $translation) {
0 ignored issues
show
The property translations does not exist on object<Anomaly\Streams\P...rm\Model\EloquentModel>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
108
                $translation->delete();
109
            }
110
        }
111
112
        $this->events->fire(new ModelWasDeleted($model));
113
    }
114
115
    /**
116
     * Run after multiple records have been deleted.
117
     *
118
     * @param EloquentModel $model
119
     */
120
    public function deletedMultiple(EloquentModel $model)
121
    {
122
        $model->flushCache();
123
124
        $this->events->fire(new ModelsWereDeleted($model));
125
    }
126
127
    /**
128
     * Fired just before restoring.
129
     *
130
     * @param EloquentModel $model
131
     */
132
    public function restoring(EloquentModel $model)
0 ignored issues
show
The parameter $model 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...
133
    {
134
        //
135
    }
136
137
    /**
138
     * Run after a record has been restored.
139
     *
140
     * @param EloquentModel $model
141
     */
142
    public function restored(EloquentModel $model)
143
    {
144
        $model->flushCache();
145
146
        $this->dispatch(new CascadeRestore($model));
147
148
        $this->events->fire(new ModelWasRestored($model));
149
    }
150
}
151