Issues (191)

Security Analysis    no request data  

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.

lib/ILess/Node/ExtendNode.php (1 issue)

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
2
3
/*
4
 * This file is part of the ILess
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace ILess\Node;
11
12
use ILess\Context;
13
use ILess\Node;
14
use ILess\Visitor\VisitorInterface;
15
16
/**
17
 * Extend.
18
 */
19
class ExtendNode extends Node
20
{
21
    /**
22
     * Node type.
23
     *
24
     * @var string
25
     */
26
    protected $type = 'Extend';
27
28
    /**
29
     * The selector.
30
     *
31
     * @var SelectorNode
32
     */
33
    public $selector;
34
35
    /**
36
     * The option (all).
37
     *
38
     * @var string
39
     */
40
    public $option;
41
42
    /**
43
     * Current index.
44
     *
45
     * @var int
46
     */
47
    public $index = 0;
48
49
    /**
50
     * Allow before flag.
51
     *
52
     * @var bool
53
     */
54
    public $allowBefore = false;
55
56
    /**
57
     * Allow after flag.
58
     *
59
     * @var bool
60
     */
61
    public $allowAfter = false;
62
63
    /**
64
     * Array of self selectors.
65
     *
66
     * @var array
67
     */
68
    public $selfSelectors = [];
69
70
    /**
71
     * First extend on this path flag.
72
     *
73
     * @var bool
74
     *
75
     * @see Visitor_ExtendFinder::visitRuleset
76
     */
77
    public $firstExtendOnThisSelectorPath = false;
78
79
    /**
80
     * The ruleset.
81
     *
82
     * @var RulesetNode
83
     */
84
    public $ruleset;
85
86
    /**
87
     * @var int
88
     */
89
    public static $nextId = 0;
90
91
    /**
92
     * @var int
93
     */
94
    public $objectId = 0;
95
96
    /**
97
     * @var bool
98
     */
99
    public $hasFoundMatches = false;
100
101
    /**
102
     * Constructor.
103
     *
104
     * @param SelectorNode $selector The selector
105
     * @param string $option The option
106
     * @param int $index The index
107
     */
108
    public function __construct(SelectorNode $selector, $option, $index = 0)
109
    {
110
        $this->selector = $selector;
111
        $this->option = $option;
112
        $this->index = $index;
113
        $this->objectId = self::$nextId++;
114
        $this->parentIds = [$this->objectId];
115
116
        switch ($option) {
117
            case 'all':
118
                $this->allowBefore = true;
119
                $this->allowAfter = true;
120
                break;
121
            default:
122
                $this->allowBefore = false;
123
                $this->allowAfter = false;
124
                break;
125
        }
126
    }
127
128
    /**
129
     * @var array
130
     */
131
    public $parentIds = [];
132
133
    /**
134
     * {@inheritdoc}
135
     */
136
    public function accept(VisitorInterface $visitor)
137
    {
138
        $this->selector = $visitor->visit($this->selector);
139
    }
140
141
    /**
142
     * Compiles the node.
143
     *
144
     * @param Context $context The context
145
     * @param array|null $arguments Array of arguments
146
     * @param bool|null $important Important flag
147
     *
148
     * @return ExtendNode
149
     */
150
    public function compile(Context $context, $arguments = null, $important = null)
151
    {
152
        return new self($this->selector->compile($context), $this->option, $this->index);
153
    }
154
155
    /**
156
     * Finds selectors.
157
     *
158
     * @param array $selectors Array of ILess\ILess\Node\SelectorNode instances
159
     */
160
    public function findSelfSelectors($selectors)
161
    {
162
        $selfElements = [];
163
        for ($i = 0; $i < count($selectors); ++$i) {
0 ignored issues
show
Performance Best Practice introduced by
It seems like you are calling the size function count() as part of the test condition. You might want to compute the size beforehand, and not on each iteration.

If the size of the collection does not change during the iteration, it is generally a good practice to compute it beforehand, and not on each iteration:

for ($i=0; $i<count($array); $i++) { // calls count() on each iteration
}

// Better
for ($i=0, $c=count($array); $i<$c; $i++) { // calls count() just once
}
Loading history...
164
            $selectorElements = $selectors[$i]->elements;
165
            if ($i > 0 && count($selectorElements) && $selectorElements[0]->combinator->value === '') {
166
                $selectorElements[0]->combinator->value = ' ';
167
            }
168
            $selfElements = array_merge($selfElements, $selectors[$i]->elements);
169
        }
170
171
        $this->selfSelectors = [
172
            (object) ['elements' => (array) $selfElements],
173
        ];
174
    }
175
}
176