Issues (3)

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/Queries/IndeedQuery.php (2 issues)

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 namespace JobApis\Jobs\Client\Queries;
2
3
class IndeedQuery extends AbstractQuery
4
{
5
    /**
6
     * API Version. Should be 2.
7
     *
8
     * @var integer
9
     */
10
    const API_VERSION = 2;
11
12
    /**
13
     * Response format.
14
     *
15
     * @var integer
16
     */
17
    const API_FORMAT = 'json';
18
19
    /**
20
     * User Agent
21
     *
22
     * @var string
23
     */
24
    protected $useragent;
25
26
    /**
27
     * Client IP Address
28
     *
29
     * @var string
30
     */
31
    protected $userip;
32
33
    /**
34
     * Channel group
35
     *
36
     * @var string
37
     */
38
    protected $chnl;
39
40
    /**
41
     * Country
42
     *
43
     * @var string
44
     */
45
    protected $co;
46
47
    /**
48
     * Include latitude and longitude in results
49
     *
50
     * @var boolean
51
     */
52
    protected $latlong;
53
54
    /**
55
     * Filter duplicate results
56
     *
57
     * @var boolean
58
     */
59
    protected $filter;
60
61
    /**
62
     * Highlight results
63
     *
64
     * @var boolean
65
     */
66
    protected $highlight;
67
68
    /**
69
     * Days back to search
70
     *
71
     * @var string
72
     */
73
    protected $fromage;
74
75
    /**
76
     * Max number of results
77
     *
78
     * @var string
79
     */
80
    protected $limit;
81
82
    /**
83
     * Start results from this index
84
     *
85
     * @var string
86
     */
87
    protected $start;
88
89
    /**
90
     * Job type
91
     *
92
     * @var string
93
     */
94
    protected $jt;
95
96
    /**
97
     * Site type
98
     *
99
     * @var string
100
     */
101
    protected $st;
102
103
    /**
104
     * Radius around location to search
105
     *
106
     * @var string
107
     */
108
    protected $radius;
109
110
    /**
111
     * Sort by relevance or date
112
     *
113
     * @var string
114
     */
115
    protected $sort;
116
117
    /**
118
     * Location
119
     *
120
     * @var string
121
     */
122
    protected $l;
123
124
    /**
125
     * Javascript function for callback
126
     *
127
     * @var string
128
     */
129
    protected $callback;
130
131
    /**
132
     * JSON or XML format
133
     *
134
     * @var string
135
     */
136
    protected $format;
137
138
    /**
139
     * Version number
140
     *
141
     * @var string
142
     */
143
    protected $v;
144
145
    /**
146
     * Publisher ID
147
     *
148
     * @var string
149
     */
150
    protected $publisher;
151
152
    /**
153
     * Query
154
     *
155
     * @var string
156
     */
157
    protected $q;
158
159
    /**
160
     * Get baseUrl
161
     *
162
     * @return  string Value of the base url to this api
163
     */
164 6
    public function getBaseUrl()
165
    {
166 6
        return 'http://api.indeed.com/ads/apisearch';
167
    }
168
169
    /**
170
     * Get keyword
171
     *
172
     * @return  string Attribute being used as the search keyword
173
     */
174 4
    public function getKeyword()
175
    {
176 4
        return $this->q;
177
    }
178
179
    /**
180
     * Default parameters
181
     *
182
     * @return array
183
     */
184 20
    protected function defaultAttributes()
185
    {
186
        return [
187 20
            'useragent' => $this->userAgent(),
188 20
            'userip' => $this->userIp(),
189 20
            'v' => static::API_VERSION,
190 20
            'format' => static::API_FORMAT,
191 20
        ];
192
    }
193
194
    /**
195
     * Required parameters
196
     *
197
     * @return array
198
     */
199 6
    protected function requiredAttributes()
200
    {
201
        return [
202 6
            'useragent',
203 6
            'userip',
204 6
            'publisher',
205 6
        ];
206
    }
207
208
    /**
209
     * Return the user agent from server
210
     *
211
     * @return  string
212
     */
213 20
    protected function userAgent()
0 ignored issues
show
userAgent uses the super-global variable $_SERVER which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
214
    {
215 20
        return isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
216
    }
217
218
    /**
219
     * Return the IP address from server
220
     *
221
     * @return  string
222
     */
223 20
    protected function userIp()
0 ignored issues
show
userIp uses the super-global variable $_SERVER which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
224
    {
225 20
        return isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null;
226
    }
227
}
228