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/AnonymousNode.php (2 issues)

Labels
Severity

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\FileInfo;
14
use ILess\Node;
15
use ILess\Output\OutputInterface;
16
17
/**
18
 * Anonymous node.
19
 */
20
class AnonymousNode extends Node implements ComparableInterface,
21
    MarkableAsReferencedInterface, ReferencedInterface
22
{
23
    /**
24
     * Node type.
25
     *
26
     * @var string
27
     */
28
    protected $type = 'Anonymous';
29
30
    /**
31
     * Current index.
32
     *
33
     * @var int
34
     */
35
    public $index = 0;
36
37
    /**
38
     * Map lines flag.
39
     *
40
     * @var bool
41
     */
42
    public $mapLines;
43
44
    /**
45
     * @var bool
46
     */
47
    private $rulesetLike = false;
48
49
    /**
50
     * Is referenced?
51
     *
52
     * @var bool
53
     */
54
    public $isReferenced = false;
55
56
    /**
57
     * Constructor.
58
     *
59
     * @param string|ValueNode|null $value
60
     * @param int $index
61
     * @param FileInfo $currentFileInfo
62
     * @param bool $mapLines
63
     * @param bool $rulesetLike
64
     * @param bool $referenced
65
     */
66
    public function __construct(
67
        $value,
68
        $index = 0,
69
        FileInfo $currentFileInfo = null,
70
        $mapLines = false,
71
        $rulesetLike = false,
72
        $referenced = false
73
    ) {
74
        parent::__construct($value);
75
76
        $this->index = $index;
77
        $this->currentFileInfo = $currentFileInfo;
78
        $this->mapLines = $mapLines;
79
        $this->rulesetLike = (boolean) $rulesetLike;
80
        $this->isReferenced = $referenced;
81
    }
82
83
    /**
84
     * {@inheritdoc}
85
     */
86
    public function generateCSS(Context $context, OutputInterface $output)
87
    {
88
        $output->add($this->value, $this->currentFileInfo, $this->index, $this->mapLines);
0 ignored issues
show
It seems like $this->value can also be of type object<ILess\Node>; however, ILess\Output\OutputInterface::add() does only seem to accept string, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
89
    }
90
91
    /**
92
     * Converts to CSS.
93
     *
94
     * @param Context $context
95
     *
96
     * @return string
97
     */
98
    public function toCSS(Context $context)
99
    {
100
        return $this->value;
101
    }
102
103
    /**
104
     * Compiles the node.
105
     *
106
     * @param Context $context The context
107
     * @param array|null $arguments Array of arguments
108
     * @param bool|null $important Important flag
109
     *
110
     * @return AnonymousNode
111
     */
112
    public function compile(Context $context, $arguments = null, $important = null)
113
    {
114
        return new self($this->value, $this->index, $this->currentFileInfo, $this->mapLines,
0 ignored issues
show
It seems like $this->value can also be of type object<ILess\Node>; however, ILess\Node\AnonymousNode::__construct() does only seem to accept string|object<ILess\Node\ValueNode>|null, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
115
            $this->rulesetLike, $this->isReferenced);
116
    }
117
118
    /**
119
     * {@inheritdoc}
120
     */
121
    public function compare(Node $other)
122
    {
123
        // we need to provide The context for those
124
        $context = new Context();
125
        if ($this->toCSS($context) === $other->toCSS($context)) {
126
            return 0;
127
        }
128
    }
129
130
    /**
131
     * @return bool
132
     */
133
    public function isRulesetLike()
134
    {
135
        return $this->rulesetLike;
136
    }
137
138
    /**
139
     * @return bool
140
     */
141
    public function getIsReferenced()
142
    {
143
        return !$this->currentFileInfo || !$this->currentFileInfo->reference || $this->isReferenced;
144
    }
145
146
    /**
147
     * Marks as referenced.
148
     */
149
    public function markReferenced()
150
    {
151
        $this->isReferenced = true;
152
    }
153
}
154