Issues (5)

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.

Tests/Units/SelectorsTests.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
 * This file is part of the Cubiche package.
4
 *
5
 * Copyright (c) Cubiche
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace Cubiche\Core\Selector\Tests\Units;
11
12
use Cubiche\Core\Selector\Callback;
13
use Cubiche\Core\Selector\Composite;
14
use Cubiche\Core\Selector\Count;
15
use Cubiche\Core\Selector\Key;
16
use Cubiche\Core\Selector\Method;
17
use Cubiche\Core\Selector\Property;
18
use Cubiche\Core\Selector\Selectors;
19
use Cubiche\Core\Selector\Value;
20
use Cubiche\Core\Visitor\VisitorInterface;
21
22
/**
23
 * Selector Builder Tests Class.
24
 *
25
 * @author Ivannis Suárez Jerez <[email protected]>
26
 */
27
class SelectorsTests extends SelectorTestCase
28
{
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function newDefaultTestedInstance()
33
    {
34
        return Selectors::key('foo')->key('bar');
35
    }
36
37
    /**
38
     * Test apply.
39
     */
40
    public function testSelector()
41
    {
42
        $this
43
            /* @var \Cubiche\Core\Selector\Selectors $builder */
44
            ->given($builder = $this->newDefaultTestedInstance())
45
            ->then()
46
                /* @var \Cubiche\Core\Selector\Composite $selector */
47
                ->object($selector = $builder->selector())
48
                    ->isInstanceOf(Composite::class)
49
                /* @var \Cubiche\Core\Selector\Key $foo */
50
                ->object($foo = $selector->valueSelector())
0 ignored issues
show
The method valueSelector() does not exist on Cubiche\Core\Selector\SelectorInterface. Did you maybe mean select()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
51
                    ->isInstanceOf(Key::class)
52
                ->string($foo->name())
53
                    ->isEqualTo('foo')
54
                    /* @var \Cubiche\Core\Selector\Key $foo */
55
                ->object($bar = $selector->applySelector())
0 ignored issues
show
The method applySelector() does not exist on Cubiche\Core\Selector\SelectorInterface. Did you maybe mean select()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
56
                    ->isInstanceOf(Key::class)
57
                ->string($bar->name())
58
                    ->isEqualTo('bar')
59
        ;
60
    }
61
62
    /**
63
     * Test apply.
64
     */
65
    public function testApply()
66
    {
67
        $this
68
            /* @var \Cubiche\Core\Selector\Selectors $builder */
69
            ->given($builder = $this->newDefaultTestedInstance())
70
            ->then()
71
                ->string($builder->apply(array('foo' => array('bar' => 'baz'))))
72
                    ->isEqualTo('baz')
73
        ;
74
    }
75
76
    /**
77
     * Test __staticCall.
78
     *
79
     * @dataProvider staticCallDataProvider
80
     */
81
    public function testStaticCall(Selectors $builder, $expectedClass)
82
    {
83
        $this
84
            ->given($builder, $expectedClass)
85
            ->then()
86
                ->object($builder->selector())
87
                    ->isInstanceOf($expectedClass)
88
        ;
89
    }
90
91
    /**
92
     * @return string[][]
93
     */
94
    protected function staticCallDataProvider()
95
    {
96
        return array(
97
            array(Selectors::key('foo'), Key::class),
98
            array(Selectors::property('foo'), Property::class),
99
            array(Selectors::method('foo'), Method::class),
100
            array(Selectors::callback(function () {
101
102
            }), Callback::class),
103
            array(Selectors::count(), Count::class),
104
            array(Selectors::value('foo'), Value::class),
105
            array(Selectors::composite(
106
                Selectors::value(array()),
107
                Selectors::count()
108
            ), Composite::class),
109
        );
110
    }
111
112
    /**
113
     * {@inheritdoc}
114
     */
115
    protected function acceptVisitorDataProvider()
116
    {
117
        /** @var \Cubiche\Core\Selector\Selectors $visitee */
118
        $visitee = $this->newDefaultTestedInstance();
119
120
        return array(
121
            array($visitee, $this->newMockInstance(VisitorInterface::class), 'visit', $visitee->selector()),
122
        );
123
    }
124
}
125