Issues (1208)

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.

src/LightSaml/Criteria/CriteriaSet.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 LightSAML-Core package.
5
 *
6
 * (c) Milos Tomic <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace LightSaml\Criteria;
13
14
class CriteriaSet
15
{
16
    /** @var array|CriteriaInterface[] */
17
    protected $criterions = array();
18
19
    /**
20
     * @param CriteriaInterface[] $criterions
21
     */
22 32
    public function __construct(array $criterions = array())
23
    {
24 32
        foreach ($criterions as $criterion) {
25 14
            $this->add($criterion);
26
        }
27 32
    }
28
29
    /**
30
     * @param CriteriaInterface $criteria
31
     *
32
     * @return CriteriaSet
33
     */
34 43
    public function add(CriteriaInterface $criteria)
35
    {
36 43
        $this->criterions[] = $criteria;
37
38 43
        return $this;
39
    }
40
41
    /**
42
     * @param CriteriaInterface $criteria
43
     *
44
     * @return CriteriaSet
45
     */
46 1
    public function addIfNone(CriteriaInterface $criteria)
47
    {
48 1
        if (false == $this->has(get_class($criteria))) {
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
49 1
            $this->add($criteria);
50
        }
51
52 1
        return $this;
53
    }
54
55
    /**
56
     * @param CriteriaSet $criteriaSet
57
     *
58
     * @return CriteriaSet
59
     */
60 1
    public function addAll(CriteriaSet $criteriaSet)
61
    {
62 1
        foreach ($criteriaSet->all() as $criteria) {
63 1
            $this->add($criteria);
64
        }
65
66 1
        return $this;
67
    }
68
69
    /**
70
     * @param mixed    $condition
71
     * @param callable $callback
72
     *
73
     * @return CriteriaSet
74
     */
75 7
    public function addIf($condition, $callback)
76
    {
77 7
        if ($condition) {
78 7
            $criteria = call_user_func($callback);
79 7
            if ($criteria) {
80 7
                $this->add($criteria);
81
            }
82
        }
83
84 7
        return $this;
85
    }
86
87
    /**
88
     * @return CriteriaInterface[]|array
89
     */
90 3
    public function all()
91
    {
92 3
        return $this->criterions;
93
    }
94
95
    /**
96
     * @param string $class
97
     *
98
     * @return array|CriteriaInterface[]
99
     */
100 15
    public function get($class)
101
    {
102 15
        $result = array();
103 15
        foreach ($this->criterions as $criteria) {
104 15
            if ($criteria instanceof $class) {
105 15
                $result[] = $criteria;
106
            }
107
        }
108
109 15
        return $result;
110
    }
111
112
    /**
113
     * @param string $class
114
     *
115
     * @return CriteriaInterface|null
116
     */
117 14
    public function getSingle($class)
118
    {
119 14
        foreach ($this->criterions as $criteria) {
120 14
            if ($criteria instanceof $class) {
121 14
                return $criteria;
122
            }
123
        }
124
125
        return null;
126
    }
127
128
    /**
129
     * @param string $class
130
     *
131
     * @return bool
132
     */
133 32
    public function has($class)
134
    {
135 32
        foreach ($this->criterions as $criteria) {
136 31
            if ($criteria instanceof $class) {
137 31
                return true;
138
            }
139
        }
140
141 13
        return false;
142
    }
143
}
144