Issues (114)

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/Relationships/Pivot.php (1 issue)

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
namespace Analogue\ORM\Relationships;
4
5
use Analogue\ORM\Entity;
6
7
class Pivot extends Entity
8
{
9
    /**
10
     * @var bool
11
     */
12
    protected $exists;
13
14
    /**
15
     * Pivot's table
16
     *
17
     * @var string
18
     */
19
    protected $table;
20
21
    /**
22
     * The parent entity of the relationship.
23
     *
24
     * @var object
25
     */
26
    protected $parent;
27
28
    /**
29
     * The parent entity of the relationship.
30
     *
31
     * @var \Analogue\ORM\EntityMap
32
     */
33
    protected $parentMap;
34
35
    /**
36
     * We may define a pivot mapping to deal with
37
     * soft deletes, timestamps, etc.
38
     *
39
     * @var \Analogue\ORM\EntityMap
40
     */
41
    protected $pivotMap;
42
43
    /**
44
     * The name of the foreign key column.
45
     *
46
     * @var string
47
     */
48
    protected $foreignKey;
49
50
    /**
51
     * The name of the "other key" column.
52
     *
53
     * @var string
54
     */
55
    protected $otherKey;
56
57
    /**
58
     * The attributes that aren't mass assignable.
59
     *
60
     * @var array
61
     */
62
    protected $guarded = [];
63
64
    /**
65
     * Pivot uses timestamps ?
66
     *
67
     * @var boolean
68
     */
69
    protected $timestamps;
70
71
    /**
72
     * Create a new pivot model instance.
73
     *
74
     * @param \Analogue\ORM\System\InternallyMappable $parent
75
     * @param \Analogue\ORM\EntityMap                 $parentMap
76
     * @param array                                   $attributes
77
     * @param string                                  $table
78
     * @param bool                                    $exists
79
     */
80
    public function __construct($parent, $parentMap, $attributes, $table, $exists = false)
81
    {
82
        // The pivot model is a "dynamic" model since we will set the tables dynamically
83
        // for the instance. This allows it work for any intermediate tables for the
84
        // many to many relationship that are defined by this developer's classes.
85
        $this->setEntityAttributes($attributes, true);
0 ignored issues
show
The call to Pivot::setEntityAttributes() has too many arguments starting with true.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
86
87
        $this->table = $table;
88
89
        // We store off the parent instance so we will access the timestamp column names
90
        // for the model, since the pivot model timestamps aren't easily configurable
91
        // from the developer's point of view. We can use the parents to get these.
92
        $this->parent = $parent;
93
94
        $this->parentMap = $parentMap;
95
96
        $this->exists = $exists;
97
98
        $this->timestamps = $this->hasTimestampAttributes();
99
    }
100
101
    /**
102
     * Get the foreign key column name.
103
     *
104
     * @return string
105
     */
106
    public function getForeignKey()
107
    {
108
        return $this->foreignKey;
109
    }
110
111
    /**
112
     * Get the "other key" column name.
113
     *
114
     * @return string
115
     */
116
    public function getOtherKey()
117
    {
118
        return $this->otherKey;
119
    }
120
121
    /**
122
     * Set the key names for the pivot model instance.
123
     *
124
     * @param  string $foreignKey
125
     * @param  string $otherKey
126
     * @return $this
127
     */
128
    public function setPivotKeys($foreignKey, $otherKey)
129
    {
130
        $this->foreignKey = $foreignKey;
131
132
        $this->otherKey = $otherKey;
133
134
        return $this;
135
    }
136
137
    /**
138
     * Determine if the pivot model has timestamp attributes.
139
     *
140
     * @return bool
141
     */
142
    public function hasTimestampAttributes()
143
    {
144
        return array_key_exists($this->getCreatedAtColumn(), $this->attributes);
145
    }
146
147
    /**
148
     * Get the name of the "created at" column.
149
     *
150
     * @return string
151
     */
152
    public function getCreatedAtColumn()
153
    {
154
        return $this->parentMap->getCreatedAtColumn();
155
    }
156
157
    /**
158
     * Get the name of the "updated at" column.
159
     *
160
     * @return string
161
     */
162
    public function getUpdatedAtColumn()
163
    {
164
        return $this->parentMap->getUpdatedAtColumn();
165
    }
166
}
167