Issues (24)

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.

failed/MongoFailedJobProvider.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 yiicod\jobqueue\failed;
4
5
use Carbon\Carbon;
6
use Illuminate\Queue\Failed\FailedJobProviderInterface;
7
8
/**
9
 * Mongo provider for failed jobs
10
 *
11
 * @author Virchenko Maksim <[email protected]>
12
 */
13
class MongoFailedJobProvider implements FailedJobProviderInterface
14
{
15
    /**
16
     * The database connection name.
17
     *
18
     * @var string
19
     */
20
    protected $database;
21
22
    /**
23
     * The database table.
24
     *
25
     * @var string
26
     */
27
    protected $table;
28
29
    /**
30
     * Create a new database failed job provider.
31
     *
32
     * @param  string $database
33
     * @param  string $table
34
     */
35
    public function __construct($database, $table)
36
    {
37
        $this->database = $database;
38
        $this->table = $table;
39
    }
40
41
    /**
42
     * Log a failed job into storage.
43
     *
44
     * @param  string $connection
45
     * @param  string $queue
46
     * @param  string $payload
47
     * @param \Exception $exception
48
     *
49
     * @return int|null|void
50
     */
51
    public function log($connection, $queue, $payload, $exception)
52
    {
53
        $this->getCollection()->insert([
54
            'connection' => $connection,
55
            'queue' => $queue,
56
            'payload' => $payload,
57
            'exception' => $exception->getMessage(),
58
            'failed_at' => Carbon::now(),
59
        ]);
60
    }
61
62
    /**
63
     * Get a list of all of the failed jobs.
64
     *
65
     * @return array
66
     */
67
    public function all()
68
    {
69
        $result = [];
70
        $data = $this->getCollection()->find([])->sort(['_id' => -1]);
71
        foreach ($data as $item) {
72
            $result[] = $item;
73
        }
74
75
        return $result;
76
    }
77
78
    /**
79
     * Get a single failed job.
80
     *
81
     * @param  mixed $id
82
     *
83
     * @return array
84
     */
85
    public function find($id)
86
    {
87
        return $this->getCollection()->find(['_id' => new \MongoDB\BSON\ObjectID($id)]);
88
    }
89
90
    /**
91
     * Delete a single failed job from storage.
92
     *
93
     * @param  mixed $id
94
     *
95
     * @return bool
96
     */
97
    public function forget($id)
98
    {
99
        return $this->getCollection()->remove(['_id' => new \MongoDB\BSON\ObjectID($id)]);
100
    }
101
102
    /**
103
     * Flush all of the failed jobs from storage.
104
     */
105
    public function flush()
106
    {
107
        $this->getCollection()->remove();
108
    }
109
110
    /**
111
     * Get a new query builder instance for the table.
112
     *
113
     * @return object mongo collection
114
     */
115
    protected function getCollection()
116
    {
117
        return $this->database->getDatabase()->getCollection($this->table);
0 ignored issues
show
The method getDatabase cannot be called on $this->database (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
118
    }
119
}
120