Issues (1704)

Branch: master

Security Analysis    not enabled

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/Features/Context/MinkContext.php (13 issues)

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
namespace Victoire\Tests\Features\Context;
4
5
use Behat\Mink\Element\Element;
6
use Behat\Mink\Exception\ExpectationException;
7
use Knp\FriendlyContexts\Context\MinkContext as KFMinkContext;
8
9
/**
10
 * Feature context.
11
 */
12
class MinkContext extends KFMinkContext
13
{
14
    /**
0 ignored issues
show
Doc comment for parameter "$text" missing
Loading history...
Doc comment for parameter "$timeout" missing
Loading history...
15
     * Checks, that page contains specified text
16
     * Example: Then I should see "Who is the Batman?"
17
     * Example: And I should see "Who is the Batman?".
18
     */
19 View Code Duplication
    public function assertPageContainsText($text, $timeout = 10000)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
20
    {
21
        $element = $this->findOrRetry($this->getSession()->getPage(), $text, $timeout);
22
        if (!$element) {
23
            $message = sprintf('The text "%s" was not found anywhere in the text of the current page.', $text);
24
            throw new \Behat\Mink\Exception\ResponseTextException($message, $this->getSession());
25
        }
26
    }
27
28
    /**
0 ignored issues
show
Doc comment for parameter "$text" missing
Loading history...
Doc comment for parameter "$timeout" missing
Loading history...
29
     * Checks, that page doesn't contain specified text
30
     * Example: Then I should not see "Batman is Bruce Wayne"
31
     * Example: And I should not see "Batman is Bruce Wayne".
32
     */
33 View Code Duplication
    public function assertPageNotContainsText($text, $timeout = 10000)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
34
    {
35
        $element = $this->findOrRetry($this->getSession()->getPage(), $text, $timeout);
36
        if ($element && $element->isVisible()) {
37
            $message = sprintf('The text "%s" was found in the text of the current page although it should not.', $text);
38
            throw new \Behat\Mink\Exception\ResponseTextException($message, $this->getSession());
39
        }
40
    }
41
42
    /**
0 ignored issues
show
Doc comment for parameter "$element" missing
Loading history...
Doc comment for parameter "$text" missing
Loading history...
Doc comment for parameter "$timeout" missing
Loading history...
43
     * Checks, that element with specified CSS contains specified text
44
     * Example: Then I should see "Batman" in the "heroes_list" element
45
     * Example: And I should see "Batman" in the "heroes_list" element.
46
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
47
    public function assertElementContainsText($element, $text, $timeout = 10000)
48
    {
49
        if ($timeout <= 0) {
50
            $message = sprintf('The element "%s" was not found in the page.', $element);
51
            throw new \Behat\Mink\Exception\ResponseTextException($message, $this->getSession());
52
        }
53
        $selectorType = 'css';
54
55
        $node = $this->getSession()->getPage()->find($selectorType, $element);
56
57
        if (is_object($node)) {
58
            $item = $this->findOrRetry($node, $text);
59
            if (!$item) {
60
                $this->assertElementContainsText($element, $text, 0);
61
            }
62
        } else {
63
            $this->getSession()->wait(100);
64
65
            return $this->assertElementContainsText($element, $text, $timeout - 100);
66
        }
67
    }
68
69
    /**
70
     * @param Element   $page
71
     * @param float|int $timeout
72
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
73
    public function assertPageAddress($page, $timeout = 10000)
74
    {
75
        try {
76
            $this->assertSession()->addressEquals($this->locatePath($page));
0 ignored issues
show
$page is of type object<Behat\Mink\Element\Element>, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
77
        } catch (ExpectationException $e) {
78
            if ($timeout >= 0) {
79
                $this->getSession()->wait(100);
80
81
                return $this->assertPageAddress($page, $timeout - 100);
82
            }
83
        }
84
    }
85
86
    /**
87
     * Try to find value in element and retry for a given time.
88
     *
89
     * @param Element $element
90
     * @param string  $value
91
     * @param int     $timeout
92
     */
93
    protected function findOrRetry(Element $element, $value, $timeout = 10000)
94
    {
95
        if ($timeout <= 0) {
96
            return false;
97
        }
98
99
        // Sensitive case search
100
        /** @see http://stackoverflow.com/questions/3655549/xpath-containstext-some-string-doesnt-work-when-used-with-node-with-more/3655588#3655588 */
101
        $item = $element->find('xpath', '//*[text()[contains(., "'.$value.'")]]');
102
103 View Code Duplication
        if ($item) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
104
            return $item;
105
        } else {
106
            $this->getSession()->wait(100);
107
108
            return $this->findOrRetry($element, $value, $timeout - 100);
109
        }
110
    }
111
}
112