Issues (40)

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

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
/**
4
 * @copyright 2017 Vladimir Jimenez
5
 * @license   https://github.com/allejo/PhpPulse/blob/master/LICENSE.md MIT
6
 */
7
8
namespace allejo\DaPulse;
9
10
use allejo\DaPulse\Exceptions\InvalidColumnException;
11
use allejo\DaPulse\Objects\ApiObject;
12
use allejo\DaPulse\Objects\PulseColumnStatusValue as StatusColumn;
13
14
/**
15
 * Class PulseColumn
16
 *
17
 * @api
18
 * @package allejo\DaPulse
19
 * @since   0.1.0
20
 */
21
class PulseColumn extends ApiObject
22
{
23
    const API_PREFIX = "boards";
24
25
    const Date     = "date";
26
    const Numeric  = "numeric";
27
    const Person   = "person";
28
    const Status   = "status";
29
    const Tag      = "tag";
30
    const Text     = "text";
31
    const Timeline = "timerange";
32
33
    protected $title;
34
    protected $type;
35
    protected $empty_text;
36
    protected $labels;
37
    protected $board_id;
38
39
    private $labelsSanityCheck;
40
41
    /**
42
     * PulseColumn constructor.
43
     *
44
     * @internal
45
     *
46
     * @param array $idOrArray
47
     */
48 40
    public function __construct ($idOrArray)
49
    {
50 40
        $this->arrayConstructionOnly = true;
51 40
        $this->labelsSanityCheck = false;
52
53 40
        parent::__construct($idOrArray);
54 40
    }
55
56
    public function getId ()
57
    {
58
        return $this->id;
59
    }
60
61
    public function getTitle ()
62
    {
63
        $this->lazyLoad();
64
65
        return $this->title;
66
    }
67
68 13
    public function getType ()
69
    {
70 13
        $this->lazyLoad();
71
72
        // @todo Workaround due to a bug in DaPulse's API see: https://github.com/allejo/PhpPulse/issues/5
73 13
        if ($this->type === "color")
74
        {
75 2
            $this->type = self::Status;
76
        }
77
78 13
        return $this->type;
79
    }
80
81
    /**
82
     * Get the labels for a Status column type
83
     *
84
     * @throws InvalidColumnException if the column is not a Status column
85
     *
86
     * @since  0.3.0 An InvalidColumnException is thrown when the given column is not a status column
87
     * @since  0.1.0
88
     *
89
     * @return string[]
90
     */
91 2
    public function getLabels ()
92
    {
93 2
        if ($this->getType() != PulseColumn::Status)
94
        {
95 1
            throw new InvalidColumnException('This column type does not contain labels');
96
        }
97
98 1
        $this->lazyLoad();
99 1
        $this->sanitizeLabels();
100
101 1
        return $this->labels;
102
    }
103
104
    public function getBoardId ()
105
    {
106
        $this->lazyLoad();
107
108
        return $this->board_id;
109
    }
110
111
    public function editTitle ($title)
112
    {
113
        $this->editField("title", $title);
114
    }
115
116
    public function editLabels ($labels)
117
    {
118
        $this->editField("labels", $labels);
119
    }
120
121
    public function deleteColumn ()
122
    {
123
        $this->checkInvalid();
124
125
        self::sendDelete($this->getColumnsUrl());
126
127
        $this->deletedObject = true;
128
    }
129
130
    private function editField ($field, $value)
131
    {
132
        $this->checkInvalid();
133
134
        $postParams = [
135
            $field => $value
136
        ];
137
138
        self::sendPut($this->getColumnsUrl(), $postParams);
139
140
        $this->$field = $value;
141
    }
142
143
    private function getColumnsUrl ()
144
    {
145
        return sprintf("%s/%d/columns/%s.json", parent::apiEndpoint(), $this->getBoardId(), $this->getId());
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (apiEndpoint() instead of getColumnsUrl()). Are you sure this is correct? If so, you might want to change this to $this->apiEndpoint().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
146
    }
147
148
    /**
149
     * DaPulse will only set labels if it has content
150
     */
151 1
    private function sanitizeLabels ()
152
    {
153 1
        if ($this->labelsSanityCheck)
154
        {
155
            return;
156
        }
157
158 1
        for ($i = StatusColumn::MIN_VALUE; $i <= StatusColumn::MAX_VALUE; $i++)
159
        {
160 1
            !isset($this->labels[$i]) && $this->labels[$i] = '';
161
        }
162
163 1
        $this->labelsSanityCheck = true;
164 1
    }
165
}
166