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.

Apps/Model/Front/Sitemap/EntityBuildMap.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Apps\Model\Front\Sitemap;
4
5
use Ffcms\Core\App;
6
use Ffcms\Core\Arch\Model;
7
use Ffcms\Core\Helper\Date;
8
use Ffcms\Core\Helper\FileSystem\File;
9
use Ffcms\Core\Helper\Type\Any;
10
use Ffcms\Templex\Url\Url;
11
12
/**
13
 * Class EntityBuildMap. Build sitemap data and save to file in xml format
14
 * @package Apps\Model\Front\Sitemap
15
 */
16
class EntityBuildMap extends Model
17
{
18
    private $data;
19
    private $langs;
20
21
    /**
22
     * EntityBuildMap constructor. Pass available languages and data as array inside.
23
     * @param array|null $langs
24
     * @param array|null $data
25
     */
26
    public function __construct(?array $langs = null, ?array $data = null)
27
    {
28
        $this->langs = $langs;
29
30
        if (!$data && count($data) > 0) {
31
            foreach ($data as $item) {
32
                if (!Any::isArray($item) || !isset($item['uri'], $item['lastmod'])) {
33
                    continue;
34
                }
35
36
                $this->add($item['uri'], $item['lastmod'], $item['freq'], $item['priority']);
37
            }
38
        }
39
        parent::__construct();
40
    }
41
42
    /**
43
     * Add uri/url item to sitemap builder
44
     * @param string $uri
45
     * @param int|string $lastmod
46
     * @param string $freq
47
     * @param float $priority
48
     */
49
    public function add(?string $uri, $lastmod, string $freq = 'weekly', $priority = 0.5)
50
    {
51
        // generate multi-language files
52
        if ($this->langs && Any::isArray($this->langs) && count($this->langs) > 0) {
53
            foreach ($this->langs as $lang) {
54
                // set data to local attribute
55
                $this->data[$lang][] = [
56
                    'uri' => Url::stringUrl($uri, $lang),
0 ignored issues
show
It seems like $uri can also be of type null; however, parameter $uri of Ffcms\Templex\Url\Url::stringUrl() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

56
                    'uri' => Url::stringUrl(/** @scrutinizer ignore-type */ $uri, $lang),
Loading history...
57
                    'lastmod' => Date::convertToDatetime($lastmod, 'c'),
58
                    'freq' => (string)$freq,
59
                    'priority' => (float)$priority
60
                ];
61
            }
62
        } else { // only one language, multilanguage is disabled
63
            $this->data[App::$Properties->get('singleLanguage')][] = [
64
                'uri' => Url::stringUrl($uri),
65
                'lastmod' => Date::convertToDatetime($lastmod, 'c'),
66
                'freq' => (string)$freq,
67
                'priority' => (float)$priority
68
            ];
69
        }
70
    }
71
72
    /**
73
     * Build xml output and save it into sitemap folder
74
     * @param string $uniqueName
75
     * @return bool
76
     */
77
    public function save(string $uniqueName): bool
78
    {
79
        // check if data exists
80
        if (!$this->data || !Any::isArray($this->data)) {
81
            return false;
82
        }
83
84
        // list data each every language, render xml output and write into file
85
        foreach ($this->data as $lang => $items) {
86
            $xml = App::$View->render('sitemap/urlset', [
87
                'items' => $items
88
            ]);
89
            
90
            File::write(EntityIndexList::INDEX_PATH . '/' . $uniqueName . '.' . $lang . '.xml', $xml);
91
        }
92
        return true;
93
    }
94
}
95