Issues (57)

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.

Grafizzi/Graph/Tests/IG17Test.php (3 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
/**
4
 * @file
5
 * Grafizzi\Graph\Tests\IG17Test: a component of the Grafizzi library.
6
 *
7
 * (c) 2012 Frédéric G. MARAND <[email protected]>
8
 *
9
 * Grafizzi is free software: you can redistribute it and/or modify it under the
10
 * terms of the GNU Lesser General Public License as published by the Free
11
 * Software Foundation, either version 3 of the License, or (at your option) any
12
 * later version.
13
 *
14
 * Grafizzi is distributed in the hope that it will be useful, but WITHOUT ANY
15
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16
 * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
17
 * details.
18
 *
19
 * You should have received a copy of the GNU Lesser General Public License
20
 * along with Grafizzi, in the COPYING.LESSER.txt file.  If not, see
21
 * <http://www.gnu.org/licenses/>
22
 */
23
24
namespace Grafizzi\Graph\Tests;
25
26
use Grafizzi\Graph\Attribute;
27
use Grafizzi\Graph\Cluster;
28
use Grafizzi\Graph\Edge;
29
use Grafizzi\Graph\Node;
30
31
require 'vendor/autoload.php';
32
33
/**
34
 * A recreation of Image_GraphViz test17.phpt
35
 *
36
 * Image_GraphViz version author: Philippe Jausions <[email protected]>
37
 *
38
 * Test 17: "Process diagram with clusters"
39
 *
40
 * "Graph definition taken from GraphViz documentation"
41
 *
42
 * Note: ordering of insertions differs from Image_GraphViz, since Grafizzi
43
 * orders output by insertion order to allow customizing output order.
44
 */
45
class IG17Test extends BaseGraphTest {
46
47
  public function setUp() : void {
48
    // not strict by default.
49
    parent::setUpExtended();
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (setUpExtended() instead of setUp()). Are you sure this is correct? If so, you might want to change this to $this->setUpExtended().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
50
    $g = $this->Graph;
51
    $dic = $this->dic;
52
    $g->setDirected(true);
53
54
    $nullTitle = array(new Attribute($dic, 'title', NULL));
55
56
    // Global
57
    $g->addChild($start = new Node($dic, 'start', array(
58
      new Attribute($dic, 'shape', 'Mdiamond'),
59
    )));
60
    $g->addChild($end = new Node($dic, 'end', array(
61
      new Attribute($dic, 'shape', 'Msquare'),
62
    )));
63
64
    $nodes = array();
65
66
    // cluster0
67
    $g->addChild($cluster0 = new Cluster($dic, 0, array(
68
      new Attribute($dic, 'style', 'filled'),
69
      new Attribute($dic, 'color', 'lightgrey'),
70
      new Attribute($dic, 'label', 'process #1'),
71
    )));
72 View Code Duplication
    for ($i = 0 ; $i < 4 ; $i++) {
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...
73
      $nodeName = "a$i";
74
      $cluster0->addChild($nodes[$nodeName] = new Node($dic, $nodeName, $nullTitle));
75
    }
76
77
    // cluster1
78
    $g->addChild($cluster1 = new Cluster($dic, 1, array(
79
      new Attribute($dic, 'color', 'blue'),
80
      new Attribute($dic, 'label', 'process #2'),
81
    )));
82 View Code Duplication
    for ($i = 0 ; $i < 4 ; $i++) {
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...
83
      $nodeName = "b$i";
84
      $cluster1->addChild($nodes[$nodeName] = new Node($dic, $nodeName, $nullTitle));
85
    }
86
87
    $g->addChild(new Edge($dic, $nodes['a0'], $nodes['a1']));
88
    $g->addChild(new Edge($dic, $nodes['a1'], $nodes['a2']));
89
    $g->addChild(new Edge($dic, $nodes['a1'], $nodes['b3']));
90
    $g->addChild(new Edge($dic, $nodes['a2'], $nodes['a3']));
91
    $g->addChild(new Edge($dic, $nodes['b0'], $nodes['b1']));
92
    $g->addChild(new Edge($dic, $nodes['b1'], $nodes['b2']));
93
    $g->addChild(new Edge($dic, $nodes['b2'], $nodes['b3']));
94
    $g->addChild(new Edge($dic, $nodes['b2'], $nodes['a3']));
95
96
    $g->addChild(new Edge($dic, $start, $nodes['a0']));
97
    $g->addChild(new Edge($dic, $start, $nodes['b0']));
98
99
    $g->addChild(new Edge($dic, $nodes['a3'], $nodes['a0']));
100
    $g->addChild(new Edge($dic, $nodes['a3'], $end));
101
    $g->addChild(new Edge($dic, $nodes['b3'], $end));
102
  }
103
104
  /**
105
   * Tests g->build()
106
   */
107
  public function testBuild() {
108
    $expected = <<<'EOT'
109
digraph G {
110
  start [ shape=Mdiamond ];
111
  end [ shape=Msquare ];
112
  subgraph cluster_0 {
113
    style=filled;
114
    color=lightgrey;
115
    label="process #1";
116
117
    a0;
118
    a1;
119
    a2;
120
    a3;
121
  } /* /subgraph cluster_0 */
122
  subgraph cluster_1 {
123
    color=blue;
124
    label="process #2";
125
126
    b0;
127
    b1;
128
    b2;
129
    b3;
130
  } /* /subgraph cluster_1 */
131
  a0 -> a1;
132
  a1 -> a2;
133
  a1 -> b3;
134
  a2 -> a3;
135
  b0 -> b1;
136
  b1 -> b2;
137
  b2 -> b3;
138
  b2 -> a3;
139
  start -> a0;
140
  start -> b0;
141
  a3 -> a0;
142
  a3 -> end;
143
  b3 -> end;
144
} /* /digraph G */
145
146
EOT;
147
    $this->check($expected, "Image_graphViz test 17 passed.");
148
  }
149
}
150