Issues (38)

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.

app/Notifications/JobsCollected.php (4 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 namespace JobApis\JobsToMail\Notifications;
2
3
use Illuminate\Bus\Queueable;
4
use Illuminate\Notifications\Notification;
5
use Illuminate\Contracts\Queue\ShouldQueue;
6
use Illuminate\Queue\SerializesModels;
7
use JobApis\JobsToMail\Models\Search;
8
use JobApis\JobsToMail\Notifications\Messages\JobMailMessage;
9
10
class JobsCollected extends Notification implements ShouldQueue
11
{
12
    use Queueable, SerializesModels;
13
14
    /**
15
     * @var array of Job objects
16
     */
17
    protected $jobs;
18
19
    /**
20
     * @var Search
21
     */
22
    protected $search;
23
24
    /**
25
     * Create a new notification instance.
26
     *
27
     * @param array $jobs
28
     * @param Search $search
29
     *
30
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
31
     */
32 4
    public function __construct(array $jobs, Search $search)
33
    {
34 4
        $this->jobs = $jobs;
35 4
        $this->search = $search;
36 4
    }
37
38
    /**
39
     * Get the notification's delivery channels.
40
     *
41
     * @param  mixed  $notifiable
42
     * @return array
43
     */
44 1
    public function via($notifiable)
0 ignored issues
show
The parameter $notifiable is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
45
    {
46 1
        return ['mail', 'database'];
47
    }
48
49
    /**
50
     * Get the array representation of the notification for saving to the database.
51
     *
52
     * @param  mixed  $notifiable
53
     * @return array
54
     */
55 1
    public function toArray($notifiable)
0 ignored issues
show
The parameter $notifiable is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
56
    {
57
        return [
58 1
            'search_id' => $this->search->id,
59 1
            'jobs' => $this->jobs,
60
        ];
61
    }
62
63
    /**
64
     * Get the mail representation of the notification.
65
     *
66
     * @param  mixed  $notifiable
67
     * @return \Illuminate\Notifications\Messages\MailMessage
68
     */
69 1
    public function toMail($notifiable)
70
    {
71
        // Instantiate the message
72 1
        $message = new JobMailMessage();
73
74
        // Add user and search ID to view data
75 1
        $message->viewData['user_id'] = $notifiable->id;
76 1
        $message->viewData['search_id'] = $this->search->id;
77
78
        // Update the subject
79 1
        $message->subject(count($this->jobs).' new jobs found especially for you');
80
81
        // Add a jobs-hub ad
82 1
        $message->advertisement('upgrade');
83
84
        // Update the message text
85 1
        $message->greeting('Hello,')
86 1
            ->line('We found the following jobs that we think 
87
                you\'ll be interested in based on your search:')
88 1
            ->line("\"{$this->search->keyword} in {$this->search->location}\"");
89
90
        // Add jobs
91 1
        foreach (array_slice($this->jobs, 0, 10) as $job) {
92 1
            $message->listing($job);
93
        }
94
95
        // Add a link to download the collection
96 1
        $message->action(
97 1
            'View More',
98 1
            url('/notifications/' . $this->id)
0 ignored issues
show
It seems like url('/notifications/' . $this->id) targeting url() can also be of type object<Illuminate\Contracts\Routing\UrlGenerator>; however, Illuminate\Notifications...SimpleMessage::action() does only seem to accept string, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
99
        );
100
101 1
        return $message;
102
    }
103
}
104