Issues (21)

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/Received/Partial/Header.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
namespace MrPrompt\Centercob\Received\Partial;
3
4
use DateTime;
5
use MrPrompt\ShipmentCommon\Base\Customer;
6
use MrPrompt\ShipmentCommon\Base\Sequence;
7
8
/**
9
 * File header
10
 *
11
 * @author Thiago Paes <[email protected]>
12
 */
13
class Header
14
{
15
    /**
16
     * Line length
17
     *
18
     * @const int
19
     */
20
    const LENGTH = 1006;
21
22
    /**
23
     * Type of register
24
     *
25
     * @const string
26
     */
27
    const TYPE = 'A';
28
29
    /**
30
     * Shippment code
31
     *
32
     * @const int
33
     */
34
    const SHIPPING = 1;
35
36
    /**
37
     * Layout version
38
     *
39
     * @const int
40
     */
41
    const VERSION = '00000013';
42
43
    /**
44
     * Sequencial line
45
     *
46
     * @const int
47
     */
48
    const LINE = 1;
49
50
    /**
51
     * Customer Code
52
     *
53
     * @var Customer
54
     */
55
    private $customer;
56
57
    /**
58
     * File date creation
59
     *
60
     * @var DateTime
61
     */
62
    private $created;
63
64
    /**
65
     * Sequencial number of file
66
     *
67
     * @var Sequence
68
     */
69
    private $sequence;
70
71
    /**
72
     * @var string
73
     */
74
    private $passed;
75
76
    /**
77
     * Constructor
78
     * @param string $row
79
     */
80 9
    public function __construct($row)
81
    {
82 9
        $customer = new Customer();
83 9
        $customer->setName(substr($row, 5, 20));
84
85 9
        $this->passed   = substr($row, 2, 3);
86 9
        $this->customer = $customer;
87 9
        $this->created  = DateTime::createFromFormat('dmY h:i:s', substr($row, 25, 8) . ' 00:00:00');
0 ignored issues
show
Documentation Bug introduced by
It seems like \DateTime::createFromFor..., 25, 8) . ' 00:00:00') can also be of type false. However, the property $created is declared as type object<DateTime>. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
88 9
        $this->sequence = new Sequence(substr($row, 500, 6));
89 9
    }
90
91
    /**
92
     * @return Customer
93
     */
94 1
    public function getCustomer()
95
    {
96 1
        return $this->customer;
97
    }
98
99
    /**
100
     * @param Customer $customer
101
     */
102 1
    public function setCustomer(Customer $customer)
103
    {
104 1
        $this->customer = $customer;
105 1
    }
106
107
    /**
108
     * @return DateTime
109
     */
110 1
    public function getCreated()
111
    {
112 1
        return $this->created;
113
    }
114
115
    /**
116
     * @param DateTime $created
117
     */
118 1
    public function setCreated(DateTime $created)
119
    {
120 1
        $this->created = $created;
121 1
    }
122
123
    /**
124
     * @return Sequence
125
     */
126 1
    public function getSequence()
127
    {
128 1
        return $this->sequence;
129
    }
130
131
    /**
132
     * @param Sequence $sequence
133
     */
134 1
    public function setSequence(Sequence $sequence)
135
    {
136 1
        $this->sequence = $sequence;
137 1
    }
138
139
    /**
140
     * @return string
141
     */
142 1
    public function getPassed()
143
    {
144 1
        return $this->passed;
145
    }
146
147
    /**
148
     * @param string $passed
149
     */
150 1
    public function setPassed($passed)
151
    {
152 1
        $this->passed = $passed;
153 1
    }
154
}
155