Issues (302)

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/Yandex/Common/AbstractPackage.php (2 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
 * Yandex PHP Library
4
 *
5
 * @copyright NIX Solutions Ltd.
6
 * @link https://github.com/nixsolutions/yandex-php-library
7
 */
8
9
/**
10
 * @namespace
11
 */
12
namespace Yandex\Common;
13
14
use Yandex\Common\Exception\InvalidSettingsException;
15
use Yandex\Common\Exception\RealizationException;
16
17
/**
18
 * Package
19
 *
20
 * @category Yandex
21
 * @package  Common
22
 *
23
 * @author   Anton Shevchuk
24
 * @created  07.08.13 10:12
25
 */
26
abstract class AbstractPackage
27
{
28
    /**
29
     * __set
30
     *
31
     * @param string $key
32
     * @param mixed $value
33
     * @throws Exception\RealizationException
34
     * @throws Exception\InvalidSettingsException
35
     * @return self
36
     */
37 5 View Code Duplication
    public function __set($key, $value)
0 ignored issues
show
This method seems to be duplicated in 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...
38
    {
39 5
        $method = 'set' . ucfirst($key);
40
41 5
        if (method_exists($this, $method)) {
42 3
            $this->$method($value);
43 2
        } elseif (property_exists($this, $key)) {
44 1
            throw new RealizationException("Property `$key` required realization setter method `$method`");
45
        } else {
46 1
            throw new InvalidSettingsException("Configuration option `$key`` is undefined");
47
        }
48 3
        return $this;
49
    }
50
51
    /**
52
     * __get
53
     *
54
     * @param string $key
55
     * @throws Exception\RealizationException
56
     * @throws Exception\InvalidSettingsException
57
     * @return self
58
     */
59 4 View Code Duplication
    public function __get($key)
0 ignored issues
show
This method seems to be duplicated in 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...
60
    {
61 4
        $method = 'get' . ucfirst($key);
62
63 4
        if (method_exists($this, $method)) {
64 3
            return $this->$method($key);
65 1
        } elseif (property_exists($this, $key)) {
66 1
            throw new RealizationException("Property `$key` required realization getter method `$method`");
67
        } else {
68
            throw new InvalidSettingsException("Configuration option '$key' is undefined");
69
        }
70
    }
71
72
    /**
73
     * @param array $options
74
     * @return void
75
     */
76 2
    public function setSettings(array $options)
77
    {
78
        // apply options
79 2
        foreach ($options as $key => $value) {
80 2
            $key = $this->normalizeKey($key);
81 2
            $this->$key = $value;
82
        }
83 2
    }
84
85
    /**
86
     * checkOptions
87
     *
88
     * @throws Exception\InvalidSettingsException
89
     * @return void
90
     */
91 8
    public function checkSettings()
92
    {
93 8
        if (!$this->doCheckSettings()) {
94 2
            throw new InvalidSettingsException("Invalid configuration options of '".get_class($this)."' package");
95
        }
96 6
    }
97
98
    /**
99
     * Check package configuration
100
     *
101
     * @return boolean
102
     */
103
    abstract protected function doCheckSettings();
104
105
    /**
106
     * @param string $key
107
     * @return string
108
     */
109 2
    private function normalizeKey($key)
110
    {
111 2
        $option = str_replace('_', ' ', strtolower($key));
112 2
        $option = str_replace(' ', '', ucwords($option));
113 2
        return $option;
114
    }
115
}
116