Issues (632)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  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.
  Header Injection
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.

Widgets/Front/Newcomment/Newcomment.php (1 issue)

Severity
1
<?php
2
3
namespace Widgets\Front\Newcomment;
4
5
use Apps\Model\Api\Comments\EntityCommentData;
6
use Apps\ActiveRecord\App as AppRecord;
7
use Ffcms\Core\App;
8
use Extend\Core\Arch\FrontWidget as AbstractWidget;
9
use Ffcms\Core\Traits\ClassTools;
10
use Apps\ActiveRecord\CommentPost;
11
12
/**
13
 * Class Newcomment. New comments widget. Show new comments in system.
14
 * @package Widgets\Front\Newcomment
15
 */
16
class Newcomment extends AbstractWidget
17
{
18
    use ClassTools;
19
20
    public $snippet;
21
    public $count;
22
    public $cache;
23
    public $lang;
24
25
    private $_cacheName;
26
27
    /**
28
     * Set default configs if not passed
29
     * {@inheritDoc}
30
     * @see \Ffcms\Core\Arch\Widget::init()
31
     */
32
    public function init(): void
33
    {
34
        $cfg = $this->getConfigs();
35
        if (!$this->snippet) {
36
            $this->snippet = $cfg['snippet'];
37
        }
38
39
        if (!$this->count) {
40
            $this->count = (int)$cfg['count'];
41
        }
42
43
        if (!$this->cache) {
44
            $this->cache = (int)$cfg['cache'];
45
        }
46
47
        if (!$this->lang) {
48
            $this->lang = App::$Request->getLanguage();
49
        }
50
51
52
        $this->_cacheName = 'widget.newcomment.' . $this->createStringClassSnapshotHash();
53
    }
54
55
    /**
56
     * Show latest comments
57
     * @return string
58
     * @throws \Ffcms\Core\Exception\JsonException
59
     * @throws \Psr\Cache\InvalidArgumentException
60
     */
61
    public function display(): ?string
62
    {
63
        // work with cache and make query
64
        $records = null;
65
        if ((int)$this->cache > 0) {
66
            // process caching data
67
            $cache = App::$Cache->getItem($this->_cacheName);
68
            if (!$cache->isHit()) {
69
                $cache->set($this->makeQuery());
70
                $cache->expiresAfter((int)$this->cache);
71
                App::$Cache->save($cache);
72
            }
73
74
            $records = $cache->get();
75
        } else {
76
            $records = $this->makeQuery();
77
        }
78
79
        // check if records is found
80
        if (!$records) {
81
            return __('Comments not yet found');
82
        }
83
84
        $commentEntity = null;
85
        foreach ($records as $record) {
86
            $commentEntity[] = (new EntityCommentData($record, false))->make();
87
        }
88
89
        // render view
90
        return App::$View->render('widgets/newcomment/default', [
91
            'comments' => $commentEntity,
92
            'snippet' => $this->snippet
93
        ]);
94
    }
95
96
    /**
97
     * Make database query and return results
98
     * @return object
99
     */
100
    private function makeQuery()
101
    {
102
        $records = CommentPost::with(['user', 'user.profile', 'user.role'])
103
            ->where('moderate', false);
104
105
        $cfg = AppRecord::getConfigs('widget', 'Comments');
106
        if ((bool)$cfg['onlyLocale']) {
107
            $records->where('lang', $this->lang);
108
        }
109
110
        if (!$records || $records->count() < 1) {
0 ignored issues
show
$records is of type Illuminate\Database\Eloquent\Builder, thus it always evaluated to true.
Loading history...
111
            return null;
112
        }
113
114
        return $records->orderBy('id', 'DESC')
115
        ->take($this->count)
116
        ->get();
117
    }
118
}
119