GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (666)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  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.
  Header Injection
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/Libraries/Curl/Curl.php (67 issues)

1
<?php
0 ignored issues
show
Class found in ".php" file; use ".inc" extension instead
Loading history...
This file is missing a doc comment.
Loading history...
The PHP open tag does not have a corresponding PHP close tag
Loading history...
Filename "Curl.php" doesn't match the expected filename "curl.php"
Loading history...
2
0 ignored issues
show
Missing file doc comment
Loading history...
3
namespace RattfieldNz\Shodan\Libraries\Curl;
4
5
use Curl\Curl as PhpCurl;
6
use RattfieldNz\Shodan\Libraries\Data\Data;
7
8
/**
9
 * Class Curl.
10
 *
11
 * @category PHP
0 ignored issues
show
Coding Style Documentation introduced by
@category tag is not allowed in class comment
Loading history...
12
 *
13
 * @author  Rob Attfield <[email protected]>
0 ignored issues
show
Coding Style Documentation introduced by
@author tag is not allowed in class comment
Loading history...
14
 * @license https://github.com/rattfieldnz/shodan/blob/master/LICENSE MIT
0 ignored issues
show
Coding Style Documentation introduced by
@license tag is not allowed in class comment
Loading history...
15
 */
0 ignored issues
show
Missing @package tag in class comment
Loading history...
Missing @link tag in class comment
Loading history...
16
class Curl
17
{
0 ignored issues
show
Opening brace should be on the same line as the declaration for class Curl
Loading history...
18
    private $_data;
0 ignored issues
show
Expected 1 blank line(s) before first member var; 0 found
Loading history...
Coding Style Documentation introduced by
Missing member variable doc comment
Loading history...
19
    private $_defaultHeaders;
0 ignored issues
show
Expected 1 blank line(s) before member var; 0 found
Loading history...
Coding Style Documentation introduced by
Missing member variable doc comment
Loading history...
20
    private $_timeout;
0 ignored issues
show
Expected 1 blank line(s) before member var; 0 found
Loading history...
Coding Style Documentation introduced by
Missing member variable doc comment
Loading history...
21
    private $_curl;
0 ignored issues
show
Expected 1 blank line(s) before member var; 0 found
Loading history...
Coding Style Documentation introduced by
Missing member variable doc comment
Loading history...
22
23
    /**
24
     * Curl constructor.
25
     *
26
     * Set the needed properties to do a CURL request.
27
     *
28
     * @param Data $data    Data to use when executing cURL.
29
     * @param int  $timeout Timeout in seconds to complete a CURL request. Default is 10.
0 ignored issues
show
Expected "integer" but found "int" for parameter type
Loading history...
30
     *
31
     * @throws \ErrorException Will throw an exception if PHP ext-curl is not installed.
32
     */
33 4
    public function __construct(Data $data, int $timeout = 10)
0 ignored issues
show
Expected 2 blank lines before function; 1 found
Loading history...
Incorrect spacing between argument "$timeout" and equals sign; expected 0 but found 1
Loading history...
Incorrect spacing between default value and equals sign for argument "$timeout"; expected 0 but found 1
Loading history...
34
    {
0 ignored issues
show
Opening brace should be on the same line as the declaration
Loading history...
35 4
        if (!extension_loaded('curl')) {
0 ignored issues
show
Expected 1 space(s) after NOT operator; 0 found
Loading history...
36
            throw new \ErrorException(
37
                'The cURL extensions is not loaded, make sure you have installed the cURL extension: https://php.net/manual/curl.setup.php'
0 ignored issues
show
This line exceeds maximum limit of 100 characters; contains 139 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
38
            );
39
        }
40
41 4
        $this->_curl = new PhpCurl();
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
42 4
        $this->_data = $data;
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
43 4
        $this->_timeout = $timeout;
44 4
        $this->_setDefaultHeaders();
45 4
    }
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected //end __construct()
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
46
47
    /**
48
     * Execute a CURL request, and return current object for further processing.
49
     *
50
     * @return PhpCurl
51
     */
52 3
    public function execute(): PhpCurl
53
    {
0 ignored issues
show
Opening brace should be on the same line as the declaration
Loading history...
54 3
        $this->_curl->setOpt(CURLOPT_RETURNTRANSFER, true);
0 ignored issues
show
TRUE, FALSE and NULL should be uppercase as per the configured coding-style; instead of true please use TRUE.
Loading history...
55 3
        $this->_curl->setOpt(CURLOPT_CONNECTTIMEOUT, $this->_timeout);
56 3
        $this->_curl->setOpt(CURLOPT_HTTPHEADER, $this->_defaultHeaders);
57 3
        $this->_curl->setOpt(CURLOPT_SSL_VERIFYPEER, false);
0 ignored issues
show
TRUE, FALSE and NULL should be uppercase as per the configured coding-style; instead of false please use FALSE.
Loading history...
58 3
        $this->_curl->setOpt(CURLOPT_SSL_VERIFYHOST, false);
0 ignored issues
show
TRUE, FALSE and NULL should be uppercase as per the configured coding-style; instead of false please use FALSE.
Loading history...
59 3
        $this->_curl->get($this->_data->shodanApiUrl());
60
61 3
        return $this->_curl;
62
    }
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected //end execute()
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
63
64
    /**
65
     * Get the data retrieved from executing CURL request, in JSON format.
66
     *
67
     * @return array
68
     *
69
     * @see \RattfieldNz\SafeUrls\Libraries\Curl\Curl->execute().
70
     */
71 3
    public function getData()
72
    {
0 ignored issues
show
Opening brace should be on the same line as the declaration
Loading history...
73 3
        $dataObject = $this->execute();
74
75 3
        $status = $dataObject->getHttpStatus();
76
77 3
        $response = $dataObject->error_code != 0 ?
0 ignored issues
show
The value of a comparison must not be assigned to a variable
Loading history...
Variable "error_code" is not in valid camel caps format
Loading history...
Operator != prohibited; use !== instead
Loading history...
Expected 1 space after "?"; newline found
Loading history...
Inline IF statements are not allowed
Loading history...
Inline shorthand IF statement must be declared on a single line
Loading history...
78 1
            ['message' => $dataObject->error_message] :
0 ignored issues
show
Short array syntax is not allowed
Loading history...
Variable "error_message" is not in valid camel caps format
Loading history...
Expected 1 space after ":"; newline found
Loading history...
79 3
            json_decode($dataObject->response, true);
0 ignored issues
show
TRUE, FALSE and NULL should be uppercase as per the configured coding-style; instead of true please use TRUE.
Loading history...
It seems like $dataObject->response can also be of type boolean and null; however, parameter $json of json_decode() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

79
            json_decode(/** @scrutinizer ignore-type */ $dataObject->response, true);
Loading history...
80
81
        $data = [
0 ignored issues
show
Short array syntax is not allowed
Loading history...
82 3
            'status'   => $status,
0 ignored issues
show
This array key does not seem to be aligned correctly; expected 17 spaces, but found 12.
Loading history...
83 3
            'response' => $response,
0 ignored issues
show
This array key does not seem to be aligned correctly; expected 17 spaces, but found 12.
Loading history...
84
        ];
0 ignored issues
show
The closing parenthesis does not seem to be aligned correctly; expected 16 space(s), but found 8.
Loading history...
85
86 3
        return $data;
87
    }
0 ignored issues
show
Expected 2 blank lines after function; 1 found
Loading history...
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected //end getData()
Loading history...
88
89
    /**
90
     * Sets the default headers to use for CURL request.
91
     *
92
     * @return void
93
     */
94 4
    private function _setDefaultHeaders(): void
95
    {
0 ignored issues
show
Opening brace should be on the same line as the declaration
Loading history...
96 4
        $this->_defaultHeaders = [
0 ignored issues
show
Short array syntax is not allowed
Loading history...
97
            'Content-Type: application/json',
0 ignored issues
show
This array value does not seem to be aligned correcty; expected 34 spaces, but found 12.
Loading history...
98
            'Connection: Keep-Alive',
0 ignored issues
show
This array value does not seem to be aligned correcty; expected 34 spaces, but found 12.
Loading history...
99
        ];
0 ignored issues
show
The closing parenthesis does not seem to be aligned correctly; expected 33 space(s), but found 8.
Loading history...
100 4
    }
0 ignored issues
show
Expected 2 blank lines after function; 0 found
Loading history...
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected //end _setDefaultHeaders()
Loading history...
101
}
0 ignored issues
show
Expected //end class
Loading history...
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
102