Issues (3099)

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.

Helper/Services/ACLPermissionCreatorService.php (4 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 Kunstmaan\NodeBundle\Helper\Services;
4
5
use Kunstmaan\AdminBundle\Helper\Security\Acl\Permission\MaskBuilder;
6
use Symfony\Component\DependencyInjection\ContainerInterface;
7
use Symfony\Component\Security\Acl\Domain\RoleSecurityIdentity;
8
use Symfony\Component\Security\Acl\Exception\AclNotFoundException;
9
use Symfony\Component\Security\Acl\Model\MutableAclProviderInterface;
10
use Symfony\Component\Security\Acl\Model\ObjectIdentityRetrievalStrategyInterface;
11
12
/**
13
 * Service to add the correct permissions to new HasNodeInterface objects.
14
 */
15
class ACLPermissionCreatorService
16
{
17
    /* @var MutableAclProviderInterface $aclProvider */
18
    protected $aclProvider;
19
    /* @var ObjectIdentityRetrievalStrategyInterface $oidStrategy */
20
    protected $oidStrategy;
21
22
    public function __construct(MutableAclProviderInterface $aclProvider = null, ObjectIdentityRetrievalStrategyInterface $oidStrategy = null)
23
    {
24
        if (null === $aclProvider) {
25
            @trigger_error(sprintf('Not injecting the required dependencies in the constructor of "%s" is deprecated since KunstmaanNodeBundle 5.7 and will be required in KunstmaanNodeBundle 6.0.', __CLASS__), E_USER_DEPRECATED);
26
        }
27
28
        $this->aclProvider = $aclProvider;
29
        $this->oidStrategy = $oidStrategy;
30
    }
31
32
    /**
33
     * @deprecated since KunstmaanNodeBundle 5.7 and will be removed in KunstmaanNodeBundle 6.0. Inject the required dependencies in the constructor instead.
34
     */
35
    public function setAclProvider($aclProvider)
36
    {
37
        @trigger_error(sprintf('Using the "%s" method is deprecated since KunstmaanNodeBundle 5.7 and will be removed in KunstmaanNodeBundle 6.0. Inject the required dependencies in the constructor instead.', __METHOD__), E_USER_DEPRECATED);
38
39
        $this->aclProvider = $aclProvider;
40
    }
41
42
    /**
43
     * @deprecated since KunstmaanNodeBundle 5.7 and will be removed in KunstmaanNodeBundle 6.0. Inject the required dependencies in the constructor instead.
44
     */
45
    public function setObjectIdentityRetrievalStrategy($oidStrategy)
46
    {
47
        @trigger_error(sprintf('Using the "%s" method is deprecated since KunstmaanNodeBundle 5.7 and will be removed in KunstmaanNodeBundle 6.0. Inject the required dependencies in the constructor instead.', __METHOD__), E_USER_DEPRECATED);
48
49
        $this->oidStrategy = $oidStrategy;
50
    }
51
52
    /**
53
     * Sets the Container. This is still here for backwards compatibility.
54
     * The ContainerAwareInterface has been removed so the container won't be injected automatically.
55
     * This function is just there for code that calls it manually.
56
     *
57
     * @param ContainerInterface $container a ContainerInterface instance
0 ignored issues
show
Should the type for parameter $container not be null|ContainerInterface?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
58
     *
59
     * @deprecated since KunstmaanNodeBundle 5.7 and will be removed in KunstmaanNodeBundle 6.0. Inject the required dependencies in the constructor instead.
60
     *
61
     * @api
62
     */
63
    public function setContainer(ContainerInterface $container = null)
64
    {
65
        @trigger_error(sprintf('Using the "%s" method is deprecated since KunstmaanNodeBundle 5.7 and will be removed in KunstmaanNodeBundle 6.0. Inject the required dependencies in the constructor instead.', __METHOD__), E_USER_DEPRECATED);
66
67
        $this->setAclProvider($container->get('security.acl.provider'));
0 ignored issues
show
It seems like $container is not always an object, but can also be of type null. Maybe add an additional type check?

If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe:

function someFunction(A $objectMaybe = null)
{
    if ($objectMaybe instanceof A) {
        $objectMaybe->doSomething();
    }
}
Loading history...
Deprecated Code introduced by
The method Kunstmaan\NodeBundle\Hel...rvice::setAclProvider() has been deprecated with message: since KunstmaanNodeBundle 5.7 and will be removed in KunstmaanNodeBundle 6.0. Inject the required dependencies in the constructor instead.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
68
        $this->setObjectIdentityRetrievalStrategy($container->get('security.acl.object_identity_retrieval_strategy'));
0 ignored issues
show
Deprecated Code introduced by
The method Kunstmaan\NodeBundle\Hel...tityRetrievalStrategy() has been deprecated with message: since KunstmaanNodeBundle 5.7 and will be removed in KunstmaanNodeBundle 6.0. Inject the required dependencies in the constructor instead.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
69
    }
70
71
    /**
72
     * @param object $object
73
     *
74
     * Create ACL permissions for an object
75
     */
76
    public function createPermission($object)
77
    {
78
        $aclProvider = $this->aclProvider;
79
80
        $oidStrategy = $this->oidStrategy;
81
82
        $objectIdentity = $oidStrategy->getObjectIdentity($object);
83
84
        try {
85
            $aclProvider->deleteAcl($objectIdentity);
86
        } catch (AclNotFoundException $e) {
87
            // Don't fail when the ACL didn't exist yet.
88
        }
89
        $acl = $aclProvider->createAcl($objectIdentity);
90
91
        $securityIdentity = new RoleSecurityIdentity('IS_AUTHENTICATED_ANONYMOUSLY');
92
        $acl->insertObjectAce($securityIdentity, MaskBuilder::MASK_VIEW);
93
94
        $securityIdentity = new RoleSecurityIdentity('ROLE_ADMIN');
95
        $acl->insertObjectAce(
96
            $securityIdentity,
97
            MaskBuilder::MASK_VIEW | MaskBuilder::MASK_EDIT | MaskBuilder::MASK_DELETE | MaskBuilder::MASK_PUBLISH | MaskBuilder::MASK_UNPUBLISH
98
        );
99
100
        $securityIdentity = new RoleSecurityIdentity('ROLE_SUPER_ADMIN');
101
        $acl->insertObjectAce($securityIdentity, MaskBuilder::MASK_IDDQD);
102
        $aclProvider->updateAcl($acl);
103
    }
104
}
105