Issues (25)

Security Analysis    no request data  

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/BigFileTools.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
namespace BigFileTools;
4
use BigFileTools\Driver\SizeDriverAggregator;
5
use BigFileTools\Driver\ComDriver;
6
use BigFileTools\Driver\CurlDriver;
7
use BigFileTools\Driver\ExecDriver;
8
use BigFileTools\Driver\ISizeDriver;
9
use BigFileTools\Driver\NativeSeekDriver;
10
use BigFileTools\Driver\SizeDriverFactory;
11
12
/**
13
 * @author Honza Kuchař
14
 * @license New BSD
15
 * @encoding UTF-8
16
 * @copyright Copyright (c) 2016, Jan Kuchař
17
 */
18
class BigFileTools {
19
20
	/**
21
	 * Create BigFileTools from $path
22
	 * @param string $path
23
	 * @return File
24
	 * @deprecated
25
	 */
26
	static function fromPath($path) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
27
		return static::createDefault()->getFile($path);
28
	}
29
30
	/**
31
	 * @var SizeDriverAggregator
32
	 */
33
	private $sizeDriver;
34
35
	/**
36
	 * Create new instance of BigFileTools by providing list of drivers.
37
	 * Those that cannot be initialized on given platform will be skipped.
38
	 * @param string[] $drivers
39
	 * @return static
40
	 */
41
	public static function createFrom(array $drivers) {
42
		return new static(
43
			new SizeDriverAggregator(
44
				(new SizeDriverFactory($drivers))->getInitializedDrivers()
45
			)
46
		);
47
	}
48
49
	/**
50
	 * Create new instance of BigFileTools using default configuration.
51
	 * This uses default drivers ordered by speed.
52
	 * @return static
53
	 */
54
	public static function createDefault() {
55
		return static::createFrom([
56
			CurlDriver::class,
57
			NativeSeekDriver::class,
58
			ComDriver::class,
59
			ExecDriver::class,
60
			//NativeReadDriver::class,
61
		]);
62
	}
63
64
	/**
65
	 * Constructor - do not call directly
66
	 * @param ISizeDriver $sizeDriver
67
	 */
68
	function __construct(ISizeDriver $sizeDriver)
69
	{
70
		$this->sizeDriver = $sizeDriver;
0 ignored issues
show
Documentation Bug introduced by
$sizeDriver is of type object<BigFileTools\Driver\ISizeDriver>, but the property $sizeDriver was declared to be of type object<BigFileTools\Driver\SizeDriverAggregator>. Are you sure that you always receive this specific sub-class here, or does it make sense to add an instanceof check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.

Either this assignment is in error or an instanceof check should be added for that assignment.

class Alien {}

class Dalek extends Alien {}

class Plot
{
    /** @var  Dalek */
    public $villain;
}

$alien = new Alien();
$plot = new Plot();
if ($alien instanceof Dalek) {
    $plot->villain = $alien;
}
Loading history...
71
	}
72
73
	/**
74
	 * Get file resource for further manipulation
75
	 * @param string $path **full** path to file
76
	 * @return File
77
	 */
78
	public function getFile($path)
79
	{
80
		return new File($path, $this->sizeDriver);
81
	}
82
}
83