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/Query/Specialized/TemplateQuery.php (1 issue)

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\Query\Specialized;
13
14
use ONGR\ElasticsearchDSL\BuilderInterface;
15
use ONGR\ElasticsearchDSL\ParametersTrait;
16
17
/**
18
 * Represents Elasticsearch "template" query.
19
 *
20
 * @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-template-query.html
21
 */
22
class TemplateQuery implements BuilderInterface
23
{
24
    use ParametersTrait;
25
26
    /**
27
     * @var string
28
     */
29
    private $file;
30
31
    /**
32
     * @var string
33
     */
34
    private $inline;
35
36
    /**
37
     * @var array
38
     */
39
    private $params;
40
41
    /**
42
     * @param string $file A template of the query
43
     * @param string $inline A template of the query
44
     * @param array  $params Parameters to insert into template
45
     */
46
    public function __construct($file = null, $inline = null, array $params = [])
47
    {
48
        $this->setFile($file);
49
        $this->setInline($inline);
50
        $this->setParams($params);
51
    }
52
53
    /**
54
     * @return string
55
     */
56
    public function getFile()
57
    {
58
        return $this->file;
59
    }
60
61
    /**
62
     * @param string $file
63
     *
64
     * @return $this;
0 ignored issues
show
The doc-type $this; could not be parsed: Expected "|" or "end of type", but got ";" at position 5. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
65
     */
66
    public function setFile($file)
67
    {
68
        $this->file = $file;
69
70
        return $this;
71
    }
72
73
    /**
74
     * @return string
75
     */
76
    public function getInline()
77
    {
78
        return $this->inline;
79
    }
80
81
    /**
82
     * @param string $inline
83
     *
84
     * @return $this
85
     */
86
    public function setInline($inline)
87
    {
88
        $this->inline = $inline;
89
90
        return $this;
91
    }
92
93
    /**
94
     * @return array
95
     */
96
    public function getParams()
97
    {
98
        return $this->params;
99
    }
100
101
    /**
102
     * @param array $params
103
     *
104
     * @return $this
105
     */
106
    public function setParams($params)
107
    {
108
        $this->params = $params;
109
110
        return $this;
111
    }
112
113
    /**
114
     * {@inheritdoc}
115
     */
116
    public function getType()
117
    {
118
        return 'template';
119
    }
120
121
    /**
122
     * {@inheritdoc}
123
     */
124
    public function toArray()
125
    {
126
        $output = array_filter(
127
            [
128
                'file' => $this->getFile(),
129
                'inline' => $this->getInline(),
130
                'params' => $this->getParams(),
131
            ]
132
        );
133
134
        if (!isset($output['file']) && !isset($output['inline'])) {
135
            throw new \InvalidArgumentException(
136
                'Template query requires that either `inline` or `file` parameters are set'
137
            );
138
        }
139
140
        $output = $this->processArray($output);
141
142
        return [$this->getType() => $output];
143
    }
144
}
145