Issues (93)

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/Jobs/ContentReviewNotificationJob.php (5 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
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 25 and the first side effect is on line 13.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
3
namespace SilverStripe\ContentReview\Jobs;
4
5
use SilverStripe\ContentReview\Tasks\ContentReviewEmails;
6
use SilverStripe\Control\HTTPRequest;
7
use SilverStripe\Core\Config\Config;
8
use Symbiote\QueuedJobs\Services\AbstractQueuedJob;
9
use Symbiote\QueuedJobs\Services\QueuedJob;
10
use Symbiote\QueuedJobs\Services\QueuedJobService;
11
12
if (!class_exists(AbstractQueuedJob::class)) {
13
    return;
14
}
15
16
/**
17
 * Allows the content review module to use the optional queued jobs module to automatically
18
 * process content review emails. If the module isn't installed, nothing is done - SilverStripe
19
 * will never include this class declaration.
20
 *
21
 * If the module is installed, it will create a new job to be processed once every day by default.
22
 *
23
 * @see https://github.com/silverstripe-australia/silverstripe-queuedjobs
24
 */
25
class ContentReviewNotificationJob extends AbstractQueuedJob implements QueuedJob
26
{
27
    /**
28
     * The hour that the first job will be created at (for the next day). All other jobs should
29
     * be triggered around this time too, as the next generation is queued when this job is run.
30
     *
31
     * @var int
32
     *
33
     * @config
34
     */
35
    private static $first_run_hour = 9;
0 ignored issues
show
The property $first_run_hour is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
36
37
    /**
38
     * The hour at which to run these jobs.
39
     *
40
     * @var int
41
     *
42
     * @config
43
     */
44
    private static $next_run_hour = 9;
0 ignored issues
show
The property $next_run_hour is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
45
46
    /**
47
     * The minutes past the hour (see above) at which to run these jobs.
48
     *
49
     * @var int
50
     *
51
     * @config
52
     */
53
    private static $next_run_minute = 0;
0 ignored issues
show
The property $next_run_minute is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
54
55
    /**
56
     * The number of days to skip between job runs (1 means run this job every day,
57
     * 2 means run it every second day etc).
58
     *
59
     * @var int
60
     *
61
     * @config
62
     */
63
    private static $next_run_in_days = 1;
0 ignored issues
show
The property $next_run_in_days is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
64
65
    /**
66
     * @return string
67
     */
68
    public function getTitle()
69
    {
70
        return "Content Review Notification Job";
71
    }
72
73
    /**
74
     * @return string
75
     */
76
    public function getJobType()
77
    {
78
        $this->totalSteps = 1;
79
80
        return QueuedJob::QUEUED;
81
    }
82
83
    public function process()
84
    {
85
        $this->queueNextRun();
86
87
        $task = new ContentReviewEmails();
88
        $task->run(new HTTPRequest("GET", "/dev/tasks/ContentReviewEmails"));
89
90
        $this->currentStep = 1;
91
        $this->isComplete = true;
92
    }
93
94
    /**
95
     * Queue up the next job to run.
96
     */
97
    protected function queueNextRun()
98
    {
99
        $nextRun = new ContentReviewNotificationJob();
100
101
        $nextRunTime = mktime(
102
            Config::inst()->get(__CLASS__, 'next_run_hour'),
103
            Config::inst()->get(__CLASS__, 'next_run_minute'),
104
            0,
105
            date("m"),
106
            date("d") + Config::inst()->get(__CLASS__, 'next_run_in_days'),
107
            date("Y")
108
        );
109
110
        singleton(QueuedJobService::class)->queueJob(
111
            $nextRun,
112
            date("Y-m-d H:i:s", $nextRunTime)
113
        );
114
    }
115
}
116