Issues (1)

Security Analysis    no request data  

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.

SluggableBehavior.php (1 issue)

Labels
Severity
1
<?php
2
3
/**
4
 * This behavior allows automatically generate slug and store it to the model attribute.
5
 * It necessary for creating user-friendly URL's.
6
 *
7
 * Example of usage:
8
 * Append this code to `behaviors()` in model class
9
 * <pre>
10
 *      'sluggableBehavior' => array(
11
 *          'class'          => 'ext.yii-sluggable-behavior.SluggableBehavior',
12
 *          'delimiter'      => '-',    // words delimiter
13
 *          'sluggable_attr' => 'name', // name of attr what need to be "slugged"
14
 *          'slug_attr'      => 'slug', // attr for store slug
15
 *          'allow_update'   => true,   // allow update slug or not
16
 *          'length'         => 5,      // length of words to place into slug
17
 *      ),
18
 * </pre>
19
 */
20
class SluggableBehavior extends CActiveRecordBehavior
0 ignored issues
show
The type CActiveRecordBehavior was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
21
{
22
    /**
23
     * Delimiter for building slug string, default equal to `-`,
24
     * can be changed whe enable behavior.
25
     *
26
     * @var string
27
     */
28
    public $delimiter = '-';
29
30
    /**
31
     * Holds name of model attribute that need to bee slugged
32
     *
33
     * @var string
34
     */
35
    public $sluggable_attr;
36
37
    /**
38
     * Name of the model attribute what will represent slug
39
     *
40
     * @var string
41
     */
42
    public $slug_attr;
43
44
    /**
45
     * Allow change slug attribute when update model
46
     *
47
     * @var bool
48
     */
49
    public $allow_update = false;
50
51
    /**
52
     * Define length of slug, useful when title too long, and you want avoid bulky URL's
53
     *
54
     * @var integer
55
     */
56
    public $length;
57
58
    /**
59
     * {@inheritdoc}
60
     */
61
    public function beforeSave()
62
    {
63
        $model = $this->getOwner();
64
65
        if (!($this->allow_update && $model->isNewRecord)) { // check if we could update slug
66
            return;
67
        }
68
69
        $sluggable_attribute = $this->sluggable_attr;
70
        $slugWords           = explode(' ', $model->$sluggable_attribute);
71
        foreach ($slugWords as $key => $word) {
72
            $parsedWord  = preg_replace('/[^A-Za-z0-9\-]/', '', strtolower($word));
73
            $words[$key] = $parsedWord;
74
        }
75
76
        $slugWords = array_slice($slugWords, 0, $this->length);
77
78
        $model->$sluggable_attribute = implode($this->delimiter, $slugWords);
79
    }
80
}
81