Issues (3099)

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/Kunstmaan/SearchBundle/Search/Search.php (3 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 Kunstmaan\SearchBundle\Search;
4
5
use Kunstmaan\SearchBundle\Provider\SearchProviderChainInterface;
6
use Kunstmaan\SearchBundle\Provider\SearchProviderInterface;
7
8
/**
9
 * Search class which will delegate to the active SearchProvider
10
 * The active SearchProvider can be overridden by overriding the "kunstmaan_search.search" parameter
11
 */
12
class Search implements SearchProviderInterface
13
{
14
    /**
15
     * @var SearchProviderChainInterface
16
     */
17
    private $searchProviderChain;
18
19
    /**
20
     * @var string
21
     */
22
    private $indexNamePrefix;
23
24
    /**
25
     * @var string
26
     */
27
    private $activeProvider;
28
29
    /**
30
     * @param SearchProviderChainInterface $searchProviderChain
31
     * @param string                       $indexNamePrefix
32
     * @param string                       $activeProvider
33
     */
34
    public function __construct(SearchProviderChainInterface $searchProviderChain, $indexNamePrefix, $activeProvider)
35
    {
36
        $this->searchProviderChain = $searchProviderChain;
37
        $this->indexNamePrefix = $indexNamePrefix;
38
        $this->activeProvider = $activeProvider;
39
    }
40
41
    /**
42
     * Get the current active SearchProvider
43
     *
44
     * @return SearchProviderInterface
0 ignored issues
show
Should the return type not be SearchProviderInterface|null?

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...
45
     */
46
    public function getActiveProvider()
47
    {
48
        return $this->searchProviderChain->getProvider($this->activeProvider);
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     */
54
    public function createIndex($indexName)
0 ignored issues
show
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
55
    {
56
        return $this->getActiveProvider()->createIndex($this->indexNamePrefix . $indexName);
57
    }
58
59
    /**
60
     * {@inheritdoc}
61
     */
62
    public function getIndex($indexName)
63
    {
64
        return $this->getActiveProvider()->getIndex($this->indexNamePrefix . $indexName);
65
    }
66
67
    /**
68
     * {@inheritdoc}
69
     */
70
    public function getClient()
71
    {
72
        return $this->getActiveProvider()->getClient();
73
    }
74
75
    /**
76
     * {@inheritdoc}
77
     */
78 View Code Duplication
    public function createDocument($uid, $document, $indexName = '', $indexType = '')
79
    {
80
        $indexName = strtolower($indexName);
81
82
        return $this->getActiveProvider()->createDocument(
83
            $uid,
84
            $document,
85
            $this->indexNamePrefix . $indexName,
86
            $indexType
87
        );
88
    }
89
90
    /**
91
     * {@inheritdoc}
92
     */
93 View Code Duplication
    public function addDocument($uid, $document, $indexType, $indexName)
94
    {
95
        $indexName = strtolower($indexName);
96
97
        return $this->getActiveProvider()->addDocument(
98
            $this->indexNamePrefix . $indexName,
99
            $indexType,
100
            $document,
101
            $uid
102
        );
103
    }
104
105
    /**
106
     * {@inheritdoc}
107
     */
108
    public function addDocuments($documents, $indexName = '', $indexType = '')
109
    {
110
        $indexName = strtolower($indexName);
111
112
        return $this->getActiveProvider()->addDocuments($documents, $indexName, $indexType);
113
    }
114
115
    /**
116
     * {@inheritdoc}
117
     */
118
    public function deleteDocument($indexName, $indexType, $uid)
0 ignored issues
show
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
119
    {
120
        $indexName = strtolower($indexName);
121
122
        return $this->getActiveProvider()->deleteDocument($this->indexNamePrefix . $indexName, $indexType, $uid);
123
    }
124
125
    /**
126
     * {@inheritdoc}
127
     */
128
    public function deleteDocuments($indexName, $indexType, array $ids)
129
    {
130
        $indexName = strtolower($indexName);
131
132
        return $this->getActiveProvider()->deleteDocuments($this->indexNamePrefix . $indexName, $indexType, $ids);
133
    }
134
135
    /**
136
     * {@inheritdoc}
137
     */
138
    public function deleteIndex($indexName)
139
    {
140
        $indexName = strtolower($indexName);
141
142
        return $this->getActiveProvider()->deleteIndex($this->indexNamePrefix . $indexName);
143
    }
144
145
    /**
146
     * {@inheritdoc}
147
     */
148
    public function getName()
149
    {
150
        return 'Search';
151
    }
152
153
    /**
154
     * Get the prefix for the index' name
155
     *
156
     * @return string
157
     */
158
    public function getIndexNamePrefix()
159
    {
160
        return $this->indexNamePrefix;
161
    }
162
}
163