Issues (63)

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/Aggregation/Matrix/MatrixStatsAggregation.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
/*
4
 * This file is part of the ONGR package.
5
 *
6
 * (c) NFQ Technologies UAB <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace ONGR\ElasticsearchDSL\Aggregation\Matrix;
13
14
use ONGR\ElasticsearchDSL\Aggregation\AbstractAggregation;
15
use ONGR\ElasticsearchDSL\Aggregation\Type\MetricTrait;
16
17
/**
18
 * Class representing Max Aggregation.
19
 *
20
 * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-max-aggregation.html
21
 */
22
class MaxAggregation extends AbstractAggregation
23
{
24
    use MetricTrait;
25
26
    /**
27
     * @var string Used for multi value aggregation fields to pick a value.
28
     */
29
    private $mode;
30
31
    /**
32
     * @var array Defines how documents that are missing a value should be treated.
33
     */
34
    private $missing;
35
36
    /**
37
     * Inner aggregations container init.
38
     *
39
     * @param string $name
40
     * @param string|array $field Fields list to aggregate.
41
     * @param array $missing
42
     * @param string $mode
43
     */
44
    public function __construct($name, $field, $missing = null, $mode = null)
45
    {
46
        parent::__construct($name);
47
48
        $this->setField($field);
0 ignored issues
show
It seems like $field defined by parameter $field on line 44 can also be of type array; however, ONGR\ElasticsearchDSL\Ag...Aggregation::setField() does only seem to accept string, maybe add an additional type check?

This check looks at variables that have been passed in as parameters and are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
49
        $this->setMode($mode);
50
        $this->missing = $missing;
0 ignored issues
show
Documentation Bug introduced by Simonas Šerlinskas
It seems like $missing can be null. However, the property $missing is declared as array. Maybe change the type of the property to array|null or add a type check?

Our type inference engine has found an assignment of a scalar value (like a string, an integer or null) to a property which is an array.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.

To type hint that a parameter can be either an array or null, you can set a type hint of array and a default value of null. The PHP interpreter will then accept both an array or null for that parameter.

function aContainsB(array $needle = null, array  $haystack) {
    if (!$needle) {
        return false;
    }

    return array_intersect($haystack, $needle) == $haystack;
}

The function can be called with either null or an array for the parameter $needle but will only accept an array as $haystack.

Loading history...
51
    }
52
53
    /**
54
     * @return string
55
     */
56
    public function getMode()
57
    {
58
        return $this->mode;
59
    }
60
61
    /**
62
     * @param string $mode
63
     *
64
     * @return $this
65
     */
66
    public function setMode($mode)
67
    {
68
        $this->mode = $mode;
69
70
        return $this;
71
    }
72
73
    /**
74
     * @return array
75
     */
76
    public function getMissing()
77
    {
78
        return $this->missing;
79
    }
80
81
    /**
82
     * @param array $missing
83
     *
84
     * @return $this
85
     */
86
    public function setMissing($missing)
87
    {
88
        $this->missing = $missing;
89
90
        return $this;
91
    }
92
93
    /**
94
     * {@inheritdoc}
95
     */
96
    public function getType()
97
    {
98
        return 'matrix_stats';
99
    }
100
101
    protected function getArray()
102
    {
103
        $out = [];
104
        if ($this->getField()) {
105
            $out['fields'] = $this->getField();
106
        }
107
108
        if ($this->getMode()) {
109
            $out['mode'] = $this->getMode();
110
        }
111
112
113
        if ($this->getMissing()) {
114
            $out['missing'] = $this->getMissing();
115
        }
116
117
        return $out;
118
    }
119
}
120