Issues (5)

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/Traits/HasVisibilityList.php (1 issue)

Labels
Severity

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 seregazhuk\HeadHunterApi\Traits;
4
5
trait HasVisibilityList
6
{
7
    /**
8
     * @param string $verb
9
     * @param array $params
10
     * @return mixed
11
     */
12
    abstract public function getResource($verb = '', array $params = []);
13
14
    /**
15
     * @param string $verb
16
     * @param array $params
17
     * @return mixed
18
     */
19
    abstract protected function postResourceJson($verb = '', array $params = []);
20
21
    /**
22
     * @param string $verb
23
     * @param array $params
24
     * @return array|null
25
     */
26
    abstract protected function deleteResource($verb = '', $params = []);
27
28
    /**
29
     * @param string $id
30
     * @return array
31
     */
32
    public function getWhiteList($id)
33
    {
34
        return $this->getResource($id .'/whitelist');
35
    }
36
37
    /**
38
     * @param string $id
39
     * @return array
40
     */
41
    public function getBlackList($id)
42
    {
43
        return $this->getResource($id .'/blacklist');
44
    }
45
46
    /**
47
     * @param string $resumeId
48
     * @param string|array $companyId
49
     * @return mixed
50
     */
51
    public function addToWhiteList($resumeId, $companyId)
52
    {
53
        return $this->addVisibilityItem($resumeId, $companyId, 'whitelist');
54
    }
55
56
    /**
57
     * @param string $resumeId
58
     * @param string|array $companyId
59
     * @return mixed
60
     */
61
    public function addToBlackList($resumeId, $companyId)
62
    {
63
        return $this->addVisibilityItem($resumeId, $companyId, 'blacklist');
64
    }
65
66
    /**
67
     * @param string $resumeId
68
     * @param string|array $companyId
69
     * @param string $list
70
     * @return array
71
     */
72
    protected function addVisibilityItem($resumeId, $companyId, $list)
73
    {
74
        $companyId = (array)$companyId;
75
76
        $companies = array_map(
77
            function ($company) {
78
                return ['id' => (string)$company];
79
            }, $companyId
80
        );
81
82
        return $this->postResourceJson($resumeId. "/" . $list, ['items' => $companies]);
83
    }
84
85
    /**
86
     * @param string $resumeId
87
     * @param string $companyId
88
     * @return array|null
89
     */
90
    public function removeFromWhiteList($resumeId, $companyId)
91
    {
92
        return $this->deleteResource(
93
            $resumeId . '/whitelist/employer',
94
            ['id' => $companyId]
95
        );
96
    }
97
98
    /**
99
     * @param string $resumeId
100
     * @return array|null
101
     */
102
    public function clearWhiteList($resumeId)
103
    {
104
        return $this->deleteResource($resumeId . '/whitelist/');
105
    }
106
107
    /**
108
     * @param string $resumeId
109
     * @param string $companyId
110
     * @return array|null
111
     */
112
    public function removeFromBlackList($resumeId, $companyId)
113
    {
114
        return $this->deleteResource(
115
            $resumeId . '/blacklist/employer',
116
            ['id' => $companyId]
117
        );
118
    }
119
120
    /**
121
     * @param string $resumeId
122
     * @return array|null
123
     */
124
    public function clearBlackList($resumeId)
125
    {
126
        return $this->delete($resumeId . '/blacklist/');
0 ignored issues
show
The method delete() does not exist on seregazhuk\HeadHunterApi\Traits\HasVisibilityList. Did you maybe mean deleteResource()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
127
    }
128
129
    /**
130
     * @param string $resumeId
131
     * @param string $text
132
     * @return mixed
133
     */
134
    public function searchInBlackList($resumeId, $text)
135
    {
136
        return $this->searchInList($resumeId, 'blacklist', $text);
137
    }
138
139
    /**
140
     * @param string $resumeId
141
     * @param string $text
142
     * @return mixed
143
     */
144
    public function searchInWhiteList($resumeId, $text)
145
    {
146
        return $this->searchInList($resumeId, 'whitelist', $text);
147
    }
148
149
    /**
150
     * @param string $resumeId
151
     * @param string $text
152
     * @param string $type
153
     * @return mixed
154
     */
155
    protected function searchInList($resumeId, $type, $text)
156
    {
157
        return $this->getResource($resumeId . "/$type/search", ['text' => $text]);
158
    }
159
}
160