Issues (661)

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.

class/providers/thumbalizr.php (1 issue)

Labels
Severity

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
 * You may not change or alter any portion of this comment or credits
4
 * of supporting developers from this source code or any supporting source code
5
 * which is considered copyrighted (c) material of the original comment or credit authors.
6
 * This program is distributed in the hope that it will be useful,
7
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9
 *
10
 * to use the provider:
11
 * $shot = new MylinksThumbshots();
12
 * $shot->setProviderPrivateKey(my_key);
13
 * $shot->setShotSize(array('width'=>120));
14
 * $shot->setSiteUrl("http://site_to_capture");
15
 * $mylinks_shotprovider = $shot->getProviderUrl();
16
 *
17
 * Then in the template use something like:
18
 *  <img src='<{$mylinks_shotprovider}>' target='_blank' alt='' style='margin: 3px 7px;'>
19
 *  and at the bottom of the page show the attribution
20
 *  echo $shot->getAttribution();
21
 */
22
23
/**
24
 * MyLinks category.php
25
 *
26
 * Xoops mylinks - a multicategory links module
27
 *
28
 * @copyright ::  {@link http://xoops.org/ XOOPS Project}
29
 * @copyright ::  {@link http://www.zyspec.com ZySpec Incorporated}
30
 * @license   ::    {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License}
31
 * @package   ::    mylinks
32
 * @subpackage:: class
33
 * @author    ::     zyspec <[email protected]>
34
 */
35
require_once XOOPS_ROOT_PATH . '/modules/mylinks/class/thumbplugin.interface.php';
36
37
/**
38
 * Class MylinksThumbalizr
39
 */
40
class MylinksThumbalizr implements MylinksThumbPlugin
41
{
42
    private $image_width   = 0;
43
    private $site_url      = null;
44
    private $key           = null;
45
    private $attribution   = "<a href=\"http://www.thumbalizr.com\" target=\"_blank\" title=\"Thumbnail Screenshots by Thumbalizr\">Thumbnail Screenshots by Thumbalizr</a>";
46
    private $provider_url  = 'http://api.thumbalizr.com';
47
    private $provider_name = 'Thumbalizr';
48
49
    /**
50
     * MylinksThumbalizr constructor.
51
     */
52
    public function __construct()
53
    {
54
    }
55
56
    /**
57
     * @return string
58
     */
59
    public function getProviderUrl()
60
    {
61
        $query_string = array(
62
            'url'      => $this->site_url,
63
            'width'    => $this->image_width,
64
            'encoding' => 'jpg',
65
            'mode'     => 'screen'
66
        );
67
        $api_key      = $this->getProviderPublicKey();
0 ignored issues
show
Are you sure the assignment to $api_key is correct as $this->getProviderPublicKey() (which targets MylinksThumbalizr::getProviderPublicKey()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
68
        if (!empty($api_key)) {
69
            $query_string['api_key'] = $api_key;
70
        }
71
        $query       = http_build_query($query_string);
72
        $query       = empty($query) ? '' : '/?' . $query;
73
        $providerUrl = $this->provider_url . $query;
74
75
        return $providerUrl;
76
    }
77
78
    /**
79
     * @return string
80
     */
81
    public function getProviderName()
82
    {
83
        return $this->provider_name;
84
    }
85
86
    /**
87
     * @param $sz
88
     * @return mixed|void
89
     */
90
    public function setShotSize($sz)
91
    {
92
        if (isset($sz)) {
93
            if (is_array($sz) && array_key_exists('width', $sz)) {
94
                $this->image_width = (int)$sz['width'];
95
            } else {
96
                $this->image_width = (int)$sz;
97
            }
98
        }
99
    }
100
101
    /**
102
     * @return array
103
     */
104
    public function getShotSize()
105
    {
106
        return array('width' => $this->image_width, 'height' => 0);
107
    }
108
109
    /**
110
     * @param $url
111
     * @return mixed|void
112
     */
113
    public function setSiteUrl($url)
114
    {
115
        //@todo: sanitize url;
116
        $this->site_url = formatURL($url);
117
    }
118
119
    /**
120
     * @return string
121
     */
122
    public function getSiteUrl()
123
    {
124
        return urlencode($this->site_url);
125
    }
126
127
    /**
128
     * @param null $attr
129
     */
130
    public function setAttribution($attr = null)
131
    {
132
        $this->attribution = $attr;
133
    }
134
135
    /**
136
     * @param int $allowhtml
137
     * @return string
138
     */
139
    public function getAttribution($allowhtml = 0)
140
    {
141
        if ($allowhtml) {
142
            return $this->attribution;
143
        } else {
144
            $myts = MyTextSanitizer::getInstance();
145
146
            return $myts->htmlSpecialChars($this->attribution);
147
        }
148
    }
149
150
    /**
151
     * @param $key
152
     * @return mixed|void
153
     */
154
    public function setProviderPublicKey($key)
155
    {
156
        $this->key = $key;
157
    }
158
159
    /**
160
     * @return null
161
     */
162
    public function getProviderPublicKey()
163
    {
164
        return $this->key;
165
    }
166
167
    /**
168
     * @param $key
169
     * @return bool
170
     */
171
    public function setProviderPrivateKey($key)
172
    {
173
        return false;
174
    }
175
176
    /**
177
     * @return bool
178
     */
179
    public function getProviderPrivateKey()
180
    {
181
        return false;
182
    }
183
}
184