Issues (336)

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.

app/Models/Issue.php (10 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
 * GitScrum v0.1.
4
 *
5
 * @author  Renato Marinho <[email protected]>
6
 * @license http://opensource.org/licenses/GPL-3.0 GPLv3
7
 */
8
9
namespace GitScrum\Models;
10
11
use Illuminate\Database\Eloquent\Model;
12
use Illuminate\Database\Eloquent\SoftDeletes;
13
use Carbon\Carbon;
14
use GitScrum\Scopes\GlobalScope;
15
use GitScrum\Classes\Parsedown;
16
17
class Issue extends Model
18
{
19
    use SoftDeletes;
20
    use GlobalScope;
21
    /**
22
     * The database table used by the model.
23
     *
24
     * @var string
25
     */
26
    protected $table = 'issues';
27
28
    /**
29
     * Attributes that should be mass-assignable.
30
     *
31
     * @var array
32
     */
33
    protected $fillable = ['config_issue_effort_id', 'issue_type_id', 'provider_id', 'provider', 'user_id', 'product_backlog_id', 'parent_id',
34
        'branch_id', 'sprint_id', 'user_story_id', 'number', 'effort', 'slug', 'code', 'title', 'description', 'state',
35
        'config_status_id', 'position', 'is_planning_poker', 'closed_user_id', 'closed_at', ];
36
37
    /**
38
     * The attributes excluded from the model's JSON form.
39
     *
40
     * @var array
41
     */
42
    protected $hidden = [];
43
44
    /**
45
     * The attributes that should be casted to native types.
46
     *
47
     * @var array
48
     */
49
    protected $casts = [];
50
51
    protected $dates = ['deleted_at'];
52
53
    protected static function boot()
54
    {
55
        parent::boot();
56
    }
57
58
    public function branch()
59
    {
60
        return $this->belongsTo(\GitScrum\Models\Branch::class, 'branch_id', 'id');
61
    }
62
63
    public function type()
64
    {
65
        return $this->belongsTo(\GitScrum\Models\IssueType::class, 'issue_type_id', 'id');
66
    }
67
68
    public function configEffort()
69
    {
70
        return $this->belongsTo(\GitScrum\Models\ConfigIssueEffort::class, 'config_issue_effort_id', 'id');
71
    }
72
73
    public function sprint()
74
    {
75
        return $this->belongsTo(\GitScrum\Models\Sprint::class, 'sprint_id', 'id');
76
    }
77
78
    public function productBacklog()
79
    {
80
        return $this->belongsTo(\GitScrum\Models\ProductBacklog::class, 'product_backlog_id', 'id');
81
    }
82
83
    public function userStory()
84
    {
85
        return $this->belongsTo(\GitScrum\Models\UserStory::class, 'user_story_id', 'id');
86
    }
87
88
    public function user()
89
    {
90
        return $this->belongsTo(\GitScrum\Models\User::class, 'user_id', 'id');
91
    }
92
93
    public function closedUser()
94
    {
95
        return $this->belongsTo(\GitScrum\Models\User::class, 'closed_user_id', 'id');
96
    }
97
98
    public function users()
99
    {
100
        return $this->belongsToMany(\GitScrum\Models\User::class, 'issues_has_users', 'issue_id', 'user_id');
101
    }
102
103
    public function commits()
104
    {
105
        return $this->hasMany(\GitScrum\Models\Commit::class, 'issue_id', 'id');
106
    }
107
108
    public function comments()
0 ignored issues
show
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
109
    {
110
        return $this->morphMany(\GitScrum\Models\Comment::class, 'commentable')
111
            ->orderby('created_at', 'DESC');
112
    }
113
114
    public function attachments()
115
    {
116
        return $this->morphMany(\GitScrum\Models\Attachment::class, 'attachmentable');
117
    }
118
119
    public function notes()
0 ignored issues
show
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
120
    {
121
        return $this->morphMany(\GitScrum\Models\Note::class, 'noteable')
122
            ->orderby('position', 'ASC');
123
    }
124
125
    public function favorite()
126
    {
127
        return $this->morphOne(\GitScrum\Models\Favorite::class, 'favoriteable');
128
    }
129
130
    public function labels()
131
    {
132
        return $this->morphToMany(\GitScrum\Models\Label::class, 'labelable');
133
    }
134
135
    public function status()
136
    {
137
        return $this->hasOne(\GitScrum\Models\ConfigStatus::class, 'id', 'config_status_id');
138
    }
139
140
    public function statuses()
0 ignored issues
show
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
141
    {
142
        return $this->morphMany(\GitScrum\Models\Status::class, 'statusesable')
143
            ->orderby('created_at', 'DESC');
144
    }
145
146
    public function dateForHumans($dateField = 'created_at')
147
    {
148
        return Carbon::createFromFormat('Y-m-d H:i:s', $this->attributes[$dateField])->diffForHumans();
149
    }
150
151
    public function getNumberAttribute()
0 ignored issues
show
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
152
    {
153
        return isset($this->attributes['number']) ? $this->attributes['number'] : null;
154
    }
155
156
    public function getStatusAvailableAttribute()
0 ignored issues
show
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
157
    {
158
        return ConfigStatus::type('issue')->get();
159
    }
160
161
    public function getSprintSlugAttribute()
0 ignored issues
show
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
162
    {
163
        return isset($this->sprint->slug) ? $this->sprint->slug : 0;
0 ignored issues
show
The property sprint does not exist on object<GitScrum\Models\Issue>. 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...
164
    }
165
166
    public function getSprintClosedAttribute()
0 ignored issues
show
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
167
    {
168
        return isset($this->sprint->closed_at) ? $this->sprint->closed_at : null;
0 ignored issues
show
The property sprint does not exist on object<GitScrum\Models\Issue>. 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...
169
    }
170
171
    public function getDescriptionAttribute()
172
    {
173
        $parsedown = new Parsedown;
174
        return $parsedown->text($this->attributes['description']);
175
    }
176
177
    public function getMarkdownDescriptionAttribute()
0 ignored issues
show
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
178
    {
179
        return $this->attributes['description'];
180
    }
181
}
182