Issues (287)

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.

app/bootstrap.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 declare(strict_types=1);
2
/**
3
 * Anime List Client
4
 *
5
 * An API client for Kitsu and MyAnimeList to manage anime and manga watch lists
6
 *
7
 * PHP version 7
8
 *
9
 * @package     AnimeListClient
10
 * @author      Timothy J. Warren <[email protected]>
11
 * @copyright   2015 - 2017  Timothy J. Warren
12
 * @license     http://www.opensource.org/licenses/mit-license.html  MIT License
13
 * @version     4.0
14
 * @link        https://github.com/timw4mail/HummingBirdAnimeClient
15
 */
16
17
namespace Aviat\AnimeClient;
18
19
use Aura\Html\HelperLocatorFactory;
20
use Aura\Router\RouterContainer;
21
use Aura\Session\SessionFactory;
22
use Aviat\AnimeClient\API\{Kitsu, MAL};
23
use Aviat\AnimeClient\API\Kitsu\KitsuRequestBuilder;
24
use Aviat\AnimeClient\API\MAL\MALRequestBuilder;
25
use Aviat\AnimeClient\Model;
26
use Aviat\Banker\Pool;
27
use Aviat\Ion\Config;
28
use Aviat\Ion\Di\Container;
29
use Monolog\Handler\RotatingFileHandler;
30
use Monolog\Logger;
31
use Zend\Diactoros\{Response, ServerRequestFactory};
32
33
// -----------------------------------------------------------------------------
34
// Setup DI container
35
// -----------------------------------------------------------------------------
36
return function(array $config_array = []) {
37
	$container = new Container();
38
39
	// -------------------------------------------------------------------------
40
	// Logging
41
	// -------------------------------------------------------------------------
42
43
	$app_logger = new Logger('animeclient');
44
	$app_logger->pushHandler(new RotatingFileHandler(__DIR__ . '/logs/app.log', Logger::NOTICE));
45
	$kitsu_request_logger = new Logger('kitsu-request');
46
	$kitsu_request_logger->pushHandler(new RotatingFileHandler(__DIR__ . '/logs/kitsu_request.log', Logger::NOTICE));
47
	$mal_request_logger = new Logger('mal-request');
48
	$mal_request_logger->pushHandler(new RotatingFileHandler(__DIR__ . '/logs/mal_request.log', Logger::NOTICE));
49
	$container->setLogger($app_logger, 'default');
50
	$container->setLogger($kitsu_request_logger, 'kitsu-request');
51
	$container->setLogger($mal_request_logger, 'mal-request');
52
53
	// -------------------------------------------------------------------------
54
	// Injected Objects
55
	// -------------------------------------------------------------------------
56
57
	// Create Config Object
58
	$container->set('config', function() use ($config_array) {
59
		return new Config($config_array);
60
	});
61
62
	// Create Cache Object
63 View Code Duplication
	$container->set('cache', function($container) {
0 ignored issues
show
This code seems to be duplicated across 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...
64
		$logger = $container->getLogger();
65
		$config = $container->get('config')->get('cache');
66
		return new Pool($config, $logger);
67
	});
68
69
	// Create Aura Router Object
70
	$container->set('aura-router', function() {
71
		return new RouterContainer;
72
	});
73
74
	// Create Html helper Object
75
	$container->set('html-helper', function($container) {
76
		$html_helper = (new HelperLocatorFactory)->newInstance();
77
		$html_helper->set('menu', function() use ($container) {
78
			$menu_helper = new Helper\Menu();
79
			$menu_helper->setContainer($container);
80
			return $menu_helper;
81
		});
82
83
		return $html_helper;
84
	});
85
86
	// Create Request/Response Objects
87
	$container->set('request', function() {
88
		return ServerRequestFactory::fromGlobals(
89
			$_SERVER,
90
			$_GET,
91
			$_POST,
92
			$_COOKIE,
93
			$_FILES
94
		);
95
	});
96
	$container->set('response', function() {
97
		return new Response;
98
	});
99
100
	// Create session Object
101
	$container->set('session', function() {
102
		return (new SessionFactory())->newInstance($_COOKIE);
103
	});
104
105
	// Miscellaneous helper methods
106
	$container->set('util', function($container) {
107
		return new Util($container);
108
	});
109
110
	// Models
111
	$container->set('kitsu-model', function($container) {
112
		$requestBuilder = new KitsuRequestBuilder();
113
		$requestBuilder->setLogger($container->getLogger('kitsu-request'));
114
115
		$listItem = new Kitsu\ListItem();
116
		$listItem->setContainer($container);
117
		$listItem->setRequestBuilder($requestBuilder);
118
119
		$model = new Kitsu\Model($listItem);
120
		$model->setContainer($container);
121
		$model->setRequestBuilder($requestBuilder);
122
123
		$cache = $container->get('cache');
124
		$model->setCache($cache);
125
		return $model;
126
	});
127
	$container->set('mal-model', function($container) {
128
		$requestBuilder = new MALRequestBuilder();
129
		$requestBuilder->setLogger($container->getLogger('mal-request'));
130
131
		$listItem = new MAL\ListItem();
132
		$listItem->setContainer($container);
133
		$listItem->setRequestBuilder($requestBuilder);
0 ignored issues
show
$requestBuilder is of type object<Aviat\AnimeClient...\MAL\MALRequestBuilder>, but the function expects a object<Aviat\AnimeClient\API\MALRequestBuilder>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
134
135
		$model = new MAL\Model($listItem);
136
		$model->setContainer($container);
137
		$model->setRequestBuilder($requestBuilder);
0 ignored issues
show
$requestBuilder is of type object<Aviat\AnimeClient...\MAL\MALRequestBuilder>, but the function expects a object<Aviat\AnimeClient\API\MALRequestBuilder>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
138
		return $model;
139
	});
140
141
	$container->set('api-model', function($container) {
142
		return new Model\API($container);
143
	});
144
	$container->set('anime-model', function($container) {
145
		return new Model\Anime($container);
146
	});
147
	$container->set('manga-model', function($container) {
148
		return new Model\Manga($container);
149
	});
150
	$container->set('anime-collection-model', function($container) {
151
		return new Model\AnimeCollection($container);
152
	});
153
154
	// Miscellaneous Classes
155
	$container->set('auth', function($container) {
156
		return new Kitsu\Auth($container);
157
	});
158
	$container->set('url-generator', function($container) {
159
		return new UrlGenerator($container);
160
	});
161
162
	// -------------------------------------------------------------------------
163
	// Dispatcher
164
	// -------------------------------------------------------------------------
165
	$container->set('dispatcher', function($container) {
166
		return new Dispatcher($container);
167
	});
168
169
	return $container;
170
};
171
172
// End of bootstrap.php