Issues (4714)

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.

scripts/cleanup_database.php (3 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
require_once '../src/intraface.dk/common.php';
3
4
$mdb2 = $bucket->get('mdb2');
5
6
try {
7
    $opts = new Zend_Console_Getopt(array(
8
        'key|k=s' => 'key',
9
        'foreignkey|fk=s' => 'foreign key',
10
        'table|t=s' => 'table',
11
        'foreigntable|ft=s' => 'foreign table'
12
    ));
13
    $opts->parse();
14
} catch (Zend_Console_Getopt_Exception $e) {
0 ignored issues
show
The class Zend_Console_Getopt_Exception does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
15
    echo $e->getUsageMessage();
16
    exit(1);
17
}
18
19
if (empty($opts->k) OR empty($opts->fk) OR empty($opts->ft) OR empty($opts->t)) {
0 ignored issues
show
Comprehensibility Best Practice introduced by
Using logical operators such as or instead of || is generally not recommended.

PHP has two types of connecting operators (logical operators, and boolean operators):

  Logical Operators Boolean Operator
AND - meaning and &&
OR - meaning or ||

The difference between these is the order in which they are executed. In most cases, you would want to use a boolean operator like &&, or ||.

Let’s take a look at a few examples:

// Logical operators have lower precedence:
$f = false or true;

// is executed like this:
($f = false) or true;


// Boolean operators have higher precedence:
$f = false || true;

// is executed like this:
$f = (false || true);

Logical Operators are used for Control-Flow

One case where you explicitly want to use logical operators is for control-flow such as this:

$x === 5
    or die('$x must be 5.');

// Instead of
if ($x !== 5) {
    die('$x must be 5.');
}

Since die introduces problems of its own, f.e. it makes our code hardly testable, and prevents any kind of more sophisticated error handling; you probably do not want to use this in real-world code. Unfortunately, logical operators cannot be combined with throw at this point:

// The following is currently a parse error.
$x === 5
    or throw new RuntimeException('$x must be 5.');

These limitations lead to logical operators rarely being of use in current PHP code.

Loading history...
As per coding-style, PHP keywords should be in lowercase; expected or, but found OR.
Loading history...
20
    echo 'not used correctly' . "\n";
21
    exit(1);
22
}
23
24
25
$key = $opts->k;
26
$t1 = $opts->ft; // foreing key table
27
$t2 = $opts->t; // master table
28
$foreign_key = $opts->fk;
29
30
$mdb2 = MDB2::singleton('mysql://root:klan1n@localhost/intraface_real_data');
31
32
$sql = "SELECT t1.$key
33
    FROM $t1 AS t1
34
    LEFT JOIN $t2 AS t2
35
    ON t1.$foreign_key = t2.$key
36
    WHERE t2.$key IS NULL";
37
$result = $mdb2->query($sql);
38
39
if (PEAR::isError($result)) {
40
    exit($result->getUserInfo());
41
}
42
43
while ($row = $result->fetchRow(MDB2_FETCHMODE_ASSOC)) {
44
    $mdb2->query("DELETE FROM $t1 WHERE id = $row[id]");
45
    echo "DELETE FROM $t1 WHERE $key = $row[id]\n";
46
}