Issues (1)

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.

OpenConext/Value/Saml/Metadata/ContactPerson.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
namespace OpenConext\Value\Saml\Metadata;
4
5
use OpenConext\Value\Assert\Assertion;
6
use OpenConext\Value\Saml\Metadata\ContactPerson\Company;
7
use OpenConext\Value\Saml\Metadata\ContactPerson\ContactType;
8
use OpenConext\Value\Saml\Metadata\ContactPerson\EmailAddressList;
9
use OpenConext\Value\Saml\Metadata\ContactPerson\GivenName;
10
use OpenConext\Value\Saml\Metadata\ContactPerson\Surname;
11
use OpenConext\Value\Saml\Metadata\ContactPerson\TelephoneNumberList;
12
use OpenConext\Value\Serializable;
13
14
final class ContactPerson implements Serializable
15
{
16
    /**
17
     * @var ContactType
18
     */
19
    private $contactType;
20
21
    /**
22
     * @var EmailAddressList
23
     */
24
    private $emailAddressList;
25
26
    /**
27
     * @var TelephoneNumberList
28
     */
29
    private $telephoneNumberList;
30
31
    /**
32
     * @var GivenName|null
33
     */
34
    private $givenName;
35
36
    /**
37
     * @var Surname|null
38
     */
39
    private $surname;
40
41
    /**
42
     * @var Company|null
43
     */
44
    private $company;
45
46
    public function __construct(
47
        ContactType $contactType,
48
        EmailAddressList $emailAddressList,
49
        TelephoneNumberList $telephoneNumberList,
50
        GivenName $givenName = null,
51
        Surname $surname = null,
52
        Company $company = null
53
    ) {
54
        $this->contactType         = $contactType;
55
        $this->emailAddressList    = $emailAddressList;
56
        $this->telephoneNumberList = $telephoneNumberList;
57
        $this->givenName           = $givenName;
58
        $this->surname             = $surname;
59
        $this->company             = $company;
60
    }
61
62
    /**
63
     * @param ContactPerson $other
64
     * @return bool
65
     */
66
    public function equals(ContactPerson $other)
67
    {
68
        if (!$this->contactType->equals($other->contactType)) {
69
            return false;
70
        }
71
72
        if (!$this->emailAddressList->equals($other->emailAddressList)) {
73
            return false;
74
        }
75
76
        if (!$this->telephoneNumberList->equals($other->telephoneNumberList)) {
77
            return false;
78
        }
79
80
        if ($this->givenName != $other->givenName) {
81
            return false;
82
        }
83
84
        if ($this->surname != $other->surname) {
85
            return false;
86
        }
87
88
        if ($this->company != $other->company) {
0 ignored issues
show
This if statement, and the following return statement can be replaced with return !($this->company != $other->company);.
Loading history...
89
            return false;
90
        }
91
92
        return true;
93
    }
94
95
    /**
96
     * @return ContactType
97
     */
98
    public function getContactType()
99
    {
100
        return $this->contactType;
101
    }
102
103
    /**
104
     * @return EmailAddressList
105
     */
106
    public function getEmailAddressList()
107
    {
108
        return $this->emailAddressList;
109
    }
110
111
    /**
112
     * @return TelephoneNumberList
113
     */
114
    public function getTelephoneNumberList()
115
    {
116
        return $this->telephoneNumberList;
117
    }
118
119
    /**
120
     * @return null|GivenName
121
     */
122
    public function getGivenName()
123
    {
124
        return $this->givenName;
125
    }
126
127
    /**
128
     * @return null|Surname
129
     */
130
    public function getSurname()
131
    {
132
        return $this->surname;
133
    }
134
135
    /**
136
     * @return null|Company
137
     */
138
    public function getCompany()
139
    {
140
        return $this->company;
141
    }
142
143
    public static function deserialize($data)
144
    {
145
        Assertion::isArray($data);
146
        Assertion::keysExist(
147
            $data,
148
            array('contact_type', 'email_address_list', 'telephone_number_list', 'given_name', 'surname', 'company')
149
        );
150
151
        $contact = new self(
152
            ContactType::deserialize($data['contact_type']),
153
            EmailAddressList::deserialize($data['email_address_list']),
154
            TelephoneNumberList::deserialize($data['telephone_number_list'])
155
        );
156
157
        if ($data['given_name']) {
158
            $contact->givenName = GivenName::deserialize($data['given_name']);
159
        }
160
161
        if ($data['surname']) {
162
            $contact->surname = Surname::deserialize($data['surname']);
163
        }
164
165
        if ($data['company']) {
166
            $contact->company = Company::deserialize($data['company']);
167
        }
168
169
        return $contact;
170
    }
171
172
    public function serialize()
173
    {
174
        return array(
175
            'contact_type'          => $this->contactType->serialize(),
176
            'email_address_list'    => $this->emailAddressList->serialize(),
177
            'telephone_number_list' => $this->telephoneNumberList->serialize(),
178
            'given_name'            => ($this->givenName ? $this->givenName->serialize() : null),
179
            'surname'               => ($this->surname ? $this->surname->serialize() : null),
180
            'company'               => ($this->company ? $this->company->serialize() : null)
181
        );
182
    }
183
184
    public function __toString()
185
    {
186
        return sprintf(
187
            'ContactPerson(%s, =%s, %s%s%s%s)',
188
            'ContactType=' . $this->contactType,
189
            'EmailAddressList=' . $this->emailAddressList,
190
            'TelephoneNumberList=' . $this->telephoneNumberList,
191
            ($this->givenName ? ', GivenName=' . $this->givenName : ''),
192
            ($this->surname ? ', Surname=' . $this->surname : ''),
193
            ($this->company ? ', Company=' . $this->company : '')
194
        );
195
    }
196
}
197