Issues (3)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  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.
  Header Injection
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/Policy/ResolverCollection.php (1 issue)

1
<?php
2
3
/**
4
 * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
5
 * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
6
 *
7
 * Licensed under The MIT License
8
 * For full copyright and license information, please see the LICENSE.txt
9
 * Redistributions of files must retain the above copyright notice.
10
 *
11
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
12
 * @link          https://cakephp.org CakePHP(tm) Project
13
 * @since         1.0.0
14
 * @license       https://opensource.org/licenses/mit-license.php MIT License
15
 */
16
17
declare(strict_types=1);
18
19
namespace Phauthentic\Authorization\Policy;
20
21
use ArrayIterator;
22
use Phauthentic\Authorization\Policy\Exception\MissingPolicyException;
23
24
/**
25
 * `ResolverCollection` is used for aggregating multiple resolvers when more than
26
 * one resolver is necessary. The collection will iterate over configured resolvers
27
 * and try to resolve a policy on each one. The first successfully resolved policy
28
 * will be returned.
29
 *
30
 * Configured resolvers must throw `Authorization\Policy\Exception\MissingPolicyException`
31
 * if a policy cannot be resolved.
32
 *
33
 * Example configuration:
34
 *
35
 * ```
36
 * $collection = new ResolverCollection([
37
 *     new OrmResolver(),
38
 *     new MapResolver([
39
 *         Service::class => ServicePolicy::class
40
 *     ])
41
 * ]);
42
 *
43
 * $service = new AuthenticationService($collection);
44
 * ```
45
 */
46
class ResolverCollection implements ResolverInterface, ResolverCollectionInterface
47
{
48
    /**
49
     * Policy resolver instances.
50
     *
51
     * @var \Phauthentic\Authorization\Policy\ResolverInterface[]
52
     */
53
    protected $resolvers = [];
54
/**
55
     * Constructor. Takes an array of policy resolver instances.
56
     *
57
     * @param \Phauthentic\Authorization\Policy\ResolverInterface[] $resolvers An array of policy resolver instances.
58
     */
59 4
    public function __construct(array $resolvers = [])
60
    {
61 4
        foreach ($resolvers as $resolver) {
62 4
            $this->add($resolver);
63
        }
64 4
    }
65
66
    /**
67
     * Adds a resolver to the collection.
68
     *
69
     * @param \Phauthentic\Authorization\Policy\ResolverInterface $resolver Resolver instance.
70
     * @return $this
71
     */
72 4
    public function add(ResolverInterface $resolver): ResolverCollectionInterface
73
    {
74 4
        $this->resolvers[] = $resolver;
75 4
        return $this;
76
    }
77
78
    /**
79
     * @inheritDoc
80
     */
81
    public function count(): int
82
    {
83
        return count($this->resolvers);
84
    }
85
86
    /**
87
     * Gets the iterator
88
     *
89
     * @return \Iterator
90
     */
91 4
    public function getIterator()
92
    {
93 4
        return new ArrayIterator($this->resolvers);
94
    }
95
96
    /**
97
     * @inheritDoc
98
     */
99
    public function getPolicy($resource)
100
    {
101
        foreach ($this->resolvers as $resolver) {
102
            try {
103
                return $resolver->getPolicy($resource);
104
            } catch (MissingPolicyException $e) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
105
            }
106
        }
107
108
        $exception = new MissingPolicyException();
109
        throw $exception->setMessageVars([get_class($resource)]);
110
    }
111
}
112