Issues (33)

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.

src/Form.php (2 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
namespace Sausin\Signere;
4
5
use Carbon\Carbon;
6
7
class Form extends BaseClass
8
{
9
    /** The URI of the action */
10
    const URI = 'https://api.signere.no/api/Form';
11
12
    /**
13
     * Gets all forms to the authenticated documentprovider.
14
     *
15
     * @return object
16
     */
17 1
    public function get()
18
    {
19
        // make the URL for this request
20 1
        $url = sprintf('%s/GetForms', $this->getBaseUrl());
21
22
        // get the headers for this request
23 1
        $headers = $this->headers->make('GET', $url);
24
25
        // get the response
26 1
        $response = $this->client->get($url, [
27 1
            'headers' => $headers,
28
        ]);
29
30
        // return the response
31 1
        return $response;
32
    }
33
34
    /**
35
     * Gets all signed forms to the authenticated documentprovider
36
     * filtered by the input parameters provided.
37
     *
38
     * @param  string|null $formId
39
     * @param  Carbon|null $from
40
     * @param  Carbon|null $to
41
     * @return object
42
     */
43 1
    public function getAllSigned(string $formId = null, Carbon $from = null, Carbon $to = null)
44
    {
45
        // make the URL for this request
46 1
        $url = sprintf(
47 1
            '%s/GetSignedForms?formId=%s&fromDate=%s&toDate=%s',
48 1
            $this->getBaseUrl(),
49 1
            $formId,
50 1
            $from ? $from->toDateString() : null,
51 1
            $to ? $to->toDateString() : null
52
        );
53
54
        // get the headers for this request
55 1
        $headers = $this->headers->make('GET', $url);
56
57
        // get the response
58 1
        $response = $this->client->get($url, [
59 1
            'headers' => $headers,
60
        ]);
61
62
        // return the response
63 1
        return $response;
64
    }
65
66
    /**
67
     * Gets the attachements to the form.
68
     *
69
     * @param  string $formId
70
     * @param  string $formSignId
71
     * @param  string $attachReference
72
     * @return object
73
     */
74 1
    public function getAttachments(string $formId, string $formSignId, string $attachReference)
75
    {
76
        // make the URL for this request
77 1
        $url = sprintf(
78 1
            '%s/GetFormAttachment?formId=%s&FormSignatureId=%s&AttatchmentReference=%s',
79 1
            $this->getBaseUrl(),
80 1
            $formId,
81 1
            $formSignId,
82 1
            $attachReference
83
        );
84
85
        // get the headers for this request
86 1
        $headers = $this->headers->make('GET', $url);
87
88
        // get the response
89 1
        $response = $this->client->get($url, [
90 1
            'headers' => $headers,
91
        ]);
92
93
        // return the response
94 1
        return $response;
95
    }
96
97
    /**
98
     * Gets a signed form from DocumentID.
99
     *
100
     * @param  string $documentId
101
     * @return object
102
     */
103 1
    public function getSignedByDocId(string $documentId)
104
    {
105
        // make the URL for this request
106 1
        $url = sprintf('%s/GetSignedForm?documentid=%s', $this->getBaseUrl(), $documentId);
107
108
        // get the headers for this request
109 1
        $headers = $this->headers->make('GET', $url);
110
111
        // get the response
112 1
        $response = $this->client->get($url, [
113 1
            'headers' => $headers,
114
        ]);
115
116
        // return the response
117 1
        return $response;
118
    }
119
120
    /**
121
     * Gets a signed form from formId and formSessionId.
122
     *
123
     * @param  string $formId
124
     * @param  string $formSessionId
125
     * @return object
126
     */
127 1
    public function getSignedBySessionId(string $formId, string $formSessionId)
128
    {
129
        // make the URL for this request
130 1
        $url = sprintf(
131 1
            '%s/GetSignedFormByFormSessionId?formId=%s&formSessionId=%s',
132 1
            $this->getBaseUrl(),
133 1
            $formId,
134 1
            $formSessionId
135
        );
136
137
        // get the headers for this request
138 1
        $headers = $this->headers->make('GET', $url);
139
140
        // get the response
141 1
        $response = $this->client->get($url, [
142 1
            'headers' => $headers,
143
        ]);
144
145
        // return the response
146 1
        return $response;
147
    }
148
149
    /**
150
     * Enables the form.
151
     *
152
     * @param  string $formId
153
     * @return object
154
     */
155 1 View Code Duplication
    public function enable(string $formId)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
156
    {
157
        // make the URL for this request
158 1
        $url = sprintf('%s/EnableForm?formId=%s', $this->getBaseUrl(), $formId);
159
160
        // get the headers for this request
161 1
        $headers = $this->headers->make('PUT', $url, []);
162
163
        // get the response
164 1
        $response = $this->client->put($url, [
165 1
            'headers' => $headers,
166
            'json' => [],
167
        ]);
168
169
        // return the response
170 1
        return $response;
171
    }
172
173
    /**
174
     * Disables the form.
175
     *
176
     * @param  string $formId
177
     * @return object
178
     */
179 1 View Code Duplication
    public function disable(string $formId)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
180
    {
181
        // make the URL for this request
182 1
        $url = sprintf('%s/DisableForm?formId=%s', $this->getBaseUrl(), $formId);
183
184
        // get the headers for this request
185 1
        $headers = $this->headers->make('PUT', $url, []);
186
187
        // get the response
188 1
        $response = $this->client->put($url, [
189 1
            'headers' => $headers,
190
            'json' => [],
191
        ]);
192
193
        // return the response
194 1
        return $response;
195
    }
196
}
197