Issues (37)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  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.
  Header Injection
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/Controller.php (4 issues)

1
<?php
2
3
namespace GeminiLabs\Pollux;
4
5
use GeminiLabs\Pollux\Application;
6
use GeminiLabs\Pollux\Config\Config;
7
use GeminiLabs\Pollux\Helper;
8
use GeminiLabs\Pollux\PostType\Archive;
9
use GeminiLabs\Pollux\Settings\Settings;
10
use WP_Screen;
11
12
class Controller
13
{
14
	/**
15
	 * @var Application
16
	 */
17
	protected $app;
18
19
	public function __construct( Application $app )
20
	{
21
		$this->app = $app;
22
	}
23
24
	/**
25
	 * @return array
26
	 * @filter plugin_action_links_pollux/pollux.php
27
	 */
28
	public function filterPluginLinks( array $links )
29
	{
30
		$settings_url = admin_url( sprintf( 'options-general.php?page=%s', $this->app->id ));
31
		$links[] = $this->app->config->disable_config
32
			? sprintf( '<span class="network_only">%s</span>', __( 'Settings Disabled', 'pollux' ))
33
			: sprintf( '<a href="%s">%s</a>', $settings_url, __( 'Settings', 'pollux' ));
34
		return $links;
35
	}
36
37
	/**
38
	 * @return void
39
	 * @filter admin_footer_text
40
	 */
41
	public function filterWordPressFooter( $text )
42
	{
43
		if( $this->app->config->remove_wordpress_footer )return;
44
		return $text;
45
	}
46
47
	/**
48
	 * @return void
49
	 * @action admin_enqueue_scripts
50
	 */
51
	public function registerAssets()
52
	{
53
		$screen = Helper::getCurrentScreen();
54
55
		$this->registerArchiveAssets( $screen );
0 ignored issues
show
It seems like $screen can also be of type stdClass; however, parameter $screen of GeminiLabs\Pollux\Contro...registerArchiveAssets() does only seem to accept WP_Screen, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

55
		$this->registerArchiveAssets( /** @scrutinizer ignore-type */ $screen );
Loading history...
56
		$this->registerCodemirrorAssets( $screen );
0 ignored issues
show
It seems like $screen can also be of type stdClass; however, parameter $screen of GeminiLabs\Pollux\Contro...isterCodemirrorAssets() does only seem to accept WP_Screen, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

56
		$this->registerCodemirrorAssets( /** @scrutinizer ignore-type */ $screen );
Loading history...
57
		$this->registerGateKeeperAssets( $screen );
0 ignored issues
show
It seems like $screen can also be of type stdClass; however, parameter $screen of GeminiLabs\Pollux\Contro...isterGateKeeperAssets() does only seem to accept WP_Screen, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

57
		$this->registerGateKeeperAssets( /** @scrutinizer ignore-type */ $screen );
Loading history...
58
		$this->registerSettingsAssets( $screen );
0 ignored issues
show
It seems like $screen can also be of type stdClass; however, parameter $screen of GeminiLabs\Pollux\Contro...egisterSettingsAssets() does only seem to accept WP_Screen, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

58
		$this->registerSettingsAssets( /** @scrutinizer ignore-type */ $screen );
Loading history...
59
60
		wp_enqueue_style( 'pollux/main.css',
61
			$this->app->url( 'assets/main.css' ),
62
			apply_filters( 'pollux/enqueue/css/deps', [] ),
63
			$this->app->version
64
		);
65
		wp_enqueue_script( 'pollux/main.js',
66
			$this->app->url( 'assets/main.js' ),
67
			apply_filters( 'pollux/enqueue/js/deps', [] ),
68
			$this->app->version
69
		);
70
		wp_localize_script( 'pollux/main.js',
71
			apply_filters( 'pollux/enqueue/js/localize/name', $this->app->id ),
72
			['vars' => apply_filters( 'pollux/enqueue/js/localize/variables', [] )]
73
		);
74
	}
75
76
	/**
77
	 * @return void
78
	 * @action admin_init
79
	 */
80
	public function removeDashboardWidgets()
81
	{
82
		if( !$this->app->config->remove_dashboard_widgets )return;
83
		$widgets = apply_filters( 'pollux/dashoard/widgets', [
84
			'dashboard_primary',
85
			'dashboard_quick_press',
86
		]);
87
		foreach( $widgets as $widget ) {
88
			remove_meta_box( $widget, 'dashboard', 'normal' );
89
		}
90
	}
91
92
	/**
93
	 * @return void
94
	 * @action wp_before_admin_bar_render
95
	 */
96
	public function removeWordPressMenu()
97
	{
98
		if( !$this->app->config->remove_wordpress_menu )return;
99
		global $wp_admin_bar;
100
		$wp_admin_bar->remove_menu( 'wp-logo' );
101
	}
102
103
	/**
104
	 * @return void
105
	 */
106
	protected function registerArchiveAssets( WP_Screen $screen )
107
	{
108
		if( Helper::endsWith( '_archive', $screen->id ) && $screen->pagenow == 'edit.php' ) {
109
			wp_enqueue_script( 'common' );
110
			wp_enqueue_script( 'editor-expand' );
111
			wp_enqueue_script( 'post' );
112
			wp_enqueue_script( 'postbox' );
113
			wp_enqueue_script( 'wp-lists' );
114
			if( wp_is_mobile() ) {
115
				wp_enqueue_script( 'jquery-touch-punch' );
116
			}
117
		}
118
	}
119
120
	/**
121
	 * @return void
122
	 */
123
	protected function registerCodemirrorAssets( WP_Screen $screen )
124
	{
125
		if( $screen->id != 'settings_page_pollux' || $screen->pagenow != 'options-general.php' )return;
126
		wp_enqueue_style( 'pollux/codemirror.css',
127
			$this->app->url( 'assets/codemirror.css' ),
128
			[],
129
			$this->app->version
130
		);
131
		wp_enqueue_script( 'pollux/codemirror.js',
132
			$this->app->url( 'assets/codemirror.js' ),
133
			['pollux/main.js'],
134
			$this->app->version
135
		);
136
	}
137
138
	/**
139
	 * @return void
140
	 */
141
	protected function registerGateKeeperAssets( WP_Screen $screen )
142
	{
143
		if( $screen->id == 'settings_page_pollux'
144
			&& $screen->pagenow == 'options-general.php'
145
			&& $this->app->gatekeeper->hasPendingDependencies() ) {
146
			wp_enqueue_script( 'updates' );
147
		}
148
	}
149
150
	/**
151
	 * @return void
152
	 */
153
	protected function registerSettingsAssets( WP_Screen $screen )
154
	{
155
		if( $screen->id == sprintf( 'toplevel_page_%s', Settings::id() )) {
156
			wp_enqueue_script( 'common' );
157
			wp_enqueue_script( 'postbox' );
158
			wp_enqueue_script( 'wp-lists' );
159
		}
160
	}
161
}
162