Issues (55)

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/Stubs/RateData.php (5 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
/**
4
 * This file is part of laravel-quota
5
 *
6
 * (c) David Faith <[email protected]>
7
 *
8
 * Full copyright and license information is available
9
 * in the LICENSE file distributed with this source code.
10
 */
11
12
namespace Projectmentor\Quota\Stubs;
13
14
use Projectmentor\Quota\Contracts\PayloadInterface;
15
16
/**
17
 * This is the rate data class.
18
 *
19
 * It stubs constructor parameters for:
20
 * bandwithThottle\tokenBucket\Rate
21
 *
22
 * Initial properties for a new Rate instance via
23
 * Projectmentor\Quota\Factories\FactoryInterface
24
 *
25
 * @author David Faith <[email protected]>
26
 */
27
class RateData implements PayloadInterface
28
{
29
    /**
30
     * The rate limit
31
     * i.e. capacity of the token-bucket
32
     * @var string
33
     */
34
    protected $limit;
35
36
    /**
37
     * The time period constant from Rate
38
     * @var string
39
     */
40
    protected $period;
41
42
    /**
43
     * Initialize $this
44
     * @param int $limit capacity
45
     * @param string $period Rate::<CONSTANT>
46
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
47
     */
48
    public function __construct($limit, $period)
49
    {
50
        $this->limit = $limit;
0 ignored issues
show
Documentation Bug introduced by
The property $limit was declared of type string, but $limit is of type integer. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
Equals sign not aligned with surrounding assignments; expected 2 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...
51
        $this->period = $period;
52
    }
53
54
    /**
55
     * Get the token bucket capacity
56
     * i.e: the maximum number of
57
     * tokens available at any time.
58
     * @return
59
     */
60
    public function getLimit()
61
    {
62
        return $this->limit;
63
    }
64
65
    /**
66
     * Get the constant name for the
67
     * time period between
68
     * bucket refill.
69
     * e.g: 'SECOND' | 'DAY' ...
70
     *
71
     * @return string
72
     */
73
    public function getPeriod()
74
    {
75
        return $this->period;
76
    }
77
78
    /**
79
     * Implements PayloadInterface
80
     * emit json payload.
81
     * @return string
82
     */
83
    public function toJson()
84
    {
85
        return 'Hi';
86
    }
87
88
    /**
89
     * Implements PayloadInterface
90
     * emit array payload.
91
     * @return string
0 ignored issues
show
Should the return type not be string[]?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
92
     */
93
    public function toArray()
94
    {
95
        return ['Hi'];
96
    }
97
}
0 ignored issues
show
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...
98