Issues (12)

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/Palladium/Mapper/IdentityCollection.php (2 issues)

Labels
Severity
1
<?php
2
3
namespace Palladium\Mapper;
4
5
/**
6
 * SQL code responsible for locating all of the identities, that have been associated
7
 * to a given account and discarding them in bulk.
8
 * Used mostly in case of password reset or, if cookie has been compromised.
9
 */
10
11
12
use Palladium\Component\DataMapper;
13
use Palladium\Entity as Entity;
14
use PDOStatement;
15
use PDO;
16
17
class IdentityCollection extends DataMapper
18
{
19
20
    /**
21
     * @param Entity\IdentityCollection $collection
22
     */
23 1
    public function store(Entity\IdentityCollection $collection)
24
    {
25 1
        $sql = "UPDATE {$this->table}
26
                   SET status = :status
27
                 WHERE identity_id = :id";
28 1
        $statement = $this->connection->prepare($sql);
29
30 1
        foreach ($collection as $entity) {
31 1
            $statement->execute([
32 1
                ':id' => $entity->getId(),
33 1
                ':status' => $entity->getStatus(),
34
            ]);
35
        }
36 1
    }
37
38
39
    /**
40
     * @param Entity\IdentityCollection $collection
41
     */
42 2
    public function fetch(Entity\IdentityCollection $collection)
43
    {
44 2
        if ($collection->getParentId() !== null) {
45 1
            $this->fetchByParent($collection);
46 1
            return;
47
        }
48
49 1
        $this->fetchByAccount($collection);
50 1
    }
51
52
53 1
    private function fetchByAccount(Entity\IdentityCollection $collection)
54
    {
55
        $sql = "SELECT identity_id  AS id
56 1
                  FROM {$this->table}
57
                 WHERE status = :status
58
                   AND account_id = :account
59
                   AND type = :type";
60
61 1
        $statement = $this->connection->prepare($sql);
62
63 1
        $statement->bindValue(':account', $collection->getAccountId());
64 1
        $statement->bindValue(':type', $collection->getType());
65
66 1
        $this->populateCollection($collection, $statement);
0 ignored issues
show
It seems like $statement can also be of type boolean; however, parameter $statement of Palladium\Mapper\Identit...n::populateCollection() does only seem to accept PDOStatement, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

66
        $this->populateCollection($collection, /** @scrutinizer ignore-type */ $statement);
Loading history...
67 1
    }
68
69
70 1
    private function fetchByParent(Entity\IdentityCollection $collection)
71
    {
72
        $sql = "SELECT identity_id  AS id
73 1
                  FROM {$this->table}
74
                 WHERE status = :status
75
                   AND parent_id = :parent";
76
77 1
        $statement = $this->connection->prepare($sql);
78
79 1
        $statement->bindValue(':parent', $collection->getParentId());
80
81 1
        $this->populateCollection($collection, $statement);
0 ignored issues
show
It seems like $statement can also be of type boolean; however, parameter $statement of Palladium\Mapper\Identit...n::populateCollection() does only seem to accept PDOStatement, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

81
        $this->populateCollection($collection, /** @scrutinizer ignore-type */ $statement);
Loading history...
82 1
    }
83
84
85 2
    private function populateCollection(Entity\IdentityCollection $collection, PDOStatement $statement)
86
    {
87 2
        $statement->bindValue(':status', $collection->getStatus());
88
89 2
        $statement->execute();
90
91 2
        foreach ($statement->fetchAll(PDO::FETCH_ASSOC) as $parameters) {
92 2
            $collection->addBlueprint($parameters);
93
        }
94 2
    }
95
}
96