Issues (13)

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.

SignRequest.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
 *
4
 * @copyright (c) 2015, Paul Sohier
5
 * @copyright (c) 2014 Yubico AB
6
 * @license BSD-2-Clause
7
 *
8
 *
9
 * Orignal Copyright:
10
 * Copyright (c) 2014 Yubico AB
11
 * All rights reserved.
12
 *
13
 * Redistribution and use in source and binary forms, with or without
14
 * modification, are permitted provided that the following conditions are
15
 * met:
16
 *
17
 *   * Redistributions of source code must retain the above copyright
18
 *     notice, this list of conditions and the following disclaimer.
19
 *
20
 *   * Redistributions in binary form must reproduce the above
21
 *     copyright notice, this list of conditions and the following
22
 *     disclaimer in the documentation and/or other materials provided
23
 *     with the distribution.
24
 *
25
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
 */
37
38
namespace paul999\u2f;
39
use JsonSerializable;
40
41
/**
42
 * Class for building up an authentication request
43
 *
44
 * @package u2flib_server
45
 */
46
class SignRequest implements SignRequestInterface, JsonSerializable
47
{
48
    /**
49
     * Protocol version
50
     * @var string
51
     */
52
    private $version = U2F_interface::U2F_VERSION;
53
54
    /**
55
     * Authentication challenge
56
     * @var string
57
     */
58
    private $challenge;
59
60
    /**
61
     * Key handle of a registered authenticator
62
     * @var string
63
     */
64
    private $keyHandle;
65
66
    /**
67
     * Application id
68
     * @var string
69
     */
70
    private $appId;
71
72
    /**
73
     * SignRequest constructor.
74
     * @param string $challenge
75
     * @param string $keyHandle
76
     * @param string $appId
77
     */
78
    public function __construct($challenge, $keyHandle, $appId)
79
    {
80
        $this->setChallenge($challenge);
81
        $this->setKeyHandle($keyHandle);
82
        $this->setAppId($appId);
83
    }
84
85
    /**
86
     * @return string
87
     */
88
    public function getVersion()
89
    {
90
        return $this->version;
91
    }
92
93
    /**
94
     * @param string $version
95
     * @return SignRequestInterface
96
     */
97
    public function setVersion($version)
98
    {
99
        $this->version = $version;
100
        return $this;
101
    }
102
103
    /**
104
     * @return string
105
     */
106
    public function getChallenge()
107
    {
108
        return $this->challenge;
109
    }
110
111
    /**
112
     * @param string $challenge
113
     * @return SignRequestInterface
114
     */
115
    public function setChallenge($challenge)
116
    {
117
        $this->challenge = $challenge;
118
        return $this;
119
    }
120
121
    /**
122
     * @return string
123
     */
124
    public function getKeyHandle()
125
    {
126
        return $this->keyHandle;
127
    }
128
129
    /**
130
     * @param string $keyHandle
131
     * @return SignRequestInterface
132
     */
133
    public function setKeyHandle($keyHandle)
134
    {
135
        $this->keyHandle = $keyHandle;
136
        return $this;
137
    }
138
139
    /**
140
     * @return string
141
     */
142
    public function getAppId()
143
    {
144
        return $this->appId;
145
    }
146
147
    /**
148
     * @param string $appId
149
     * @return SignRequestInterface
150
     */
151
    public function setAppId($appId)
152
    {
153
        $this->appId = $appId;
154
        return $this;
155
    }
156
157
    /**
158
     * Specify data which should be serialized to JSON
159
     * @link http://php.net/manual/en/jsonserializable.jsonserialize.php
160
     * @return mixed data which can be serialized by <b>json_encode</b>,
161
     * which is a value of any type other than a resource.
162
     * @since 5.4.0
163
     */
164
    function jsonSerialize()
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
165
    {
166
        return [
167
            'version'   => $this->getVersion(),
168
            'appId'     => $this->getAppId(),
169
            'challenge' => $this->getChallenge(),
170
            'keyHandle' => $this->getKeyHandle(),
171
        ];
172
    }
173
}