Issues (4967)

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.

src/wp-admin/customize.php (1 issue)

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
 * Theme Customize Screen.
4
 *
5
 * @package WordPress
6
 * @subpackage Customize
7
 * @since 3.4.0
8
 */
9
10
define( 'IFRAME_REQUEST', true );
11
12
/** Load WordPress Administration Bootstrap */
13
require_once( dirname( __FILE__ ) . '/admin.php' );
14
15
if ( ! current_user_can( 'customize' ) ) {
16
	wp_die(
17
		'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
18
		'<p>' . __( 'Sorry, you are not allowed to customize this site.' ) . '</p>',
19
		403
20
	);
21
}
22
23
/**
24
 * @global WP_Scripts           $wp_scripts
25
 * @global WP_Customize_Manager $wp_customize
26
 */
27
global $wp_scripts, $wp_customize;
28
29
if ( $wp_customize->changeset_post_id() ) {
30
	if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $wp_customize->changeset_post_id() ) ) {
31
		wp_die(
32
			'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
33
			'<p>' . __( 'Sorry, you are not allowed to edit this changeset.' ) . '</p>',
34
			403
35
		);
36
	}
37
	if ( in_array( get_post_status( $wp_customize->changeset_post_id() ), array( 'publish', 'trash' ), true ) ) {
38
		wp_die(
39
			'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
40
			'<p>' . __( 'This changeset has already been published and cannot be further modified.' ) . '</p>' .
41
			'<p><a href="' . esc_url( remove_query_arg( 'changeset_uuid' ) ) . '">' . __( 'Customize New Changes' ) . '</a></p>',
42
			403
43
		);
44
	}
45
}
46
47
48
wp_reset_vars( array( 'url', 'return', 'autofocus' ) );
49
if ( ! empty( $url ) ) {
50
	$wp_customize->set_preview_url( wp_unslash( $url ) );
51
}
52
if ( ! empty( $return ) ) {
53
	$wp_customize->set_return_url( wp_unslash( $return ) );
54
}
55
if ( ! empty( $autofocus ) && is_array( $autofocus ) ) {
56
	$wp_customize->set_autofocus( wp_unslash( $autofocus ) );
57
}
58
59
$registered = $wp_scripts->registered;
60
$wp_scripts = new WP_Scripts;
61
$wp_scripts->registered = $registered;
62
63
add_action( 'customize_controls_print_scripts',        'print_head_scripts', 20 );
64
add_action( 'customize_controls_print_footer_scripts', '_wp_footer_scripts'     );
65
add_action( 'customize_controls_print_styles',         'print_admin_styles', 20 );
66
67
/**
68
 * Fires when Customizer controls are initialized, before scripts are enqueued.
69
 *
70
 * @since 3.4.0
71
 */
72
do_action( 'customize_controls_init' );
73
74
wp_enqueue_script( 'customize-controls' );
75
wp_enqueue_style( 'customize-controls' );
76
77
/**
78
 * Enqueue Customizer control scripts.
79
 *
80
 * @since 3.4.0
81
 */
82
do_action( 'customize_controls_enqueue_scripts' );
83
84
// Let's roll.
85
@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
86
87
wp_user_settings();
88
_wp_admin_html_begin();
89
90
$body_class = 'wp-core-ui wp-customizer js';
91
92
if ( wp_is_mobile() ) :
93
	$body_class .= ' mobile';
94
95
	?><meta name="viewport" id="viewport-meta" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=1.2" /><?php
96
endif;
97
98
if ( $wp_customize->is_ios() ) {
99
	$body_class .= ' ios';
100
}
101
102
if ( is_rtl() ) {
103
	$body_class .= ' rtl';
104
}
105
$body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );
106
107
$admin_title = sprintf( $wp_customize->get_document_title_template(), __( 'Loading&hellip;' ) );
108
109
?><title><?php echo $admin_title; ?></title>
110
111
<script type="text/javascript">
112
var ajaxurl = <?php echo wp_json_encode( admin_url( 'admin-ajax.php', 'relative' ) ); ?>;
113
</script>
114
115
<?php
116
/**
117
 * Fires when Customizer control styles are printed.
118
 *
119
 * @since 3.4.0
120
 */
121
do_action( 'customize_controls_print_styles' );
122
123
/**
124
 * Fires when Customizer control scripts are printed.
125
 *
126
 * @since 3.4.0
127
 */
128
do_action( 'customize_controls_print_scripts' );
129
?>
130
</head>
131
<body class="<?php echo esc_attr( $body_class ); ?>">
132
<div class="wp-full-overlay expanded">
133
	<form id="customize-controls" class="wrap wp-full-overlay-sidebar">
134
		<div id="customize-header-actions" class="wp-full-overlay-header">
135
			<?php
136
			$save_text = $wp_customize->is_theme_active() ? __( 'Save &amp; Publish' ) : __( 'Save &amp; Activate' );
137
			$save_attrs = array();
138
			if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->publish_posts ) ) {
139
				$save_attrs['style'] = 'display: none';
140
			}
141
			submit_button( $save_text, 'primary save', 'save', false, $save_attrs );
142
			?>
143
			<span class="spinner"></span>
144
			<button type="button" class="customize-controls-preview-toggle">
145
				<span class="controls"><?php _e( 'Customize' ); ?></span>
146
				<span class="preview"><?php _e( 'Preview' ); ?></span>
147
			</button>
148
			<a class="customize-controls-close" href="<?php echo esc_url( $wp_customize->get_return_url() ); ?>">
149
				<span class="screen-reader-text"><?php _e( 'Close the Customizer and go back to the previous page' ); ?></span>
150
			</a>
151
		</div>
152
153
		<div id="widgets-right" class="wp-clearfix"><!-- For Widget Customizer, many widgets try to look for instances under div#widgets-right, so we have to add that ID to a container div in the Customizer for compat -->
154
		<div class="wp-full-overlay-sidebar-content" tabindex="-1">
155
			<div id="customize-info" class="accordion-section customize-info">
156
				<div class="accordion-section-title">
157
					<span class="preview-notice"><?php
158
						echo sprintf( __( 'You are customizing %s' ), '<strong class="panel-title site-title">' . get_bloginfo( 'name', 'display' ) . '</strong>' );
159
					?></span>
160
					<button type="button" class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false"><span class="screen-reader-text"><?php _e( 'Help' ); ?></span></button>
161
				</div>
162
				<div class="customize-panel-description"><?php
163
					_e( 'The Customizer allows you to preview changes to your site before publishing them. You can navigate to different pages on your site within the preview. Edit shortcuts are shown for some editable elements.' );
164
				?></div>
165
			</div>
166
167
			<div id="customize-theme-controls">
168
				<ul class="customize-pane-parent"><?php // Panels and sections are managed here via JavaScript ?></ul>
169
			</div>
170
		</div>
171
		</div>
172
173
		<div id="customize-footer-actions" class="wp-full-overlay-footer">
174
			<button type="button" class="collapse-sidebar button" aria-expanded="true" aria-label="<?php echo esc_attr( _x( 'Hide Controls', 'label for hide controls button without length constraints' ) ); ?>">
175
				<span class="collapse-sidebar-arrow"></span>
176
				<span class="collapse-sidebar-label"><?php _ex( 'Hide Controls', 'short (~12 characters) label for hide controls button' ); ?></span>
177
			</button>
178
			<?php $previewable_devices = $wp_customize->get_previewable_devices(); ?>
179
			<?php if ( ! empty( $previewable_devices ) ) : ?>
180
			<div class="devices-wrapper">
181
				<div class="devices">
182
					<?php foreach ( (array) $previewable_devices as $device => $settings ) : ?>
183
						<?php
184
						if ( empty( $settings['label'] ) ) {
185
							continue;
186
						}
187
						$active = ! empty( $settings['default'] );
188
						$class = 'preview-' . $device;
189
						if ( $active ) {
190
							$class .= ' active';
191
						}
192
						?>
193
						<button type="button" class="<?php echo esc_attr( $class ); ?>" aria-pressed="<?php echo esc_attr( $active ) ?>" data-device="<?php echo esc_attr( $device ); ?>">
194
							<span class="screen-reader-text"><?php echo esc_html( $settings['label'] ); ?></span>
195
						</button>
196
					<?php endforeach; ?>
197
				</div>
198
			</div>
199
			<?php endif; ?>
200
		</div>
201
	</form>
202
	<div id="customize-preview" class="wp-full-overlay-main"></div>
203
	<?php
204
205
	/**
206
	 * Prints templates, control scripts, and settings in the footer.
207
	 *
208
	 * @since 3.4.0
209
	 */
210
	do_action( 'customize_controls_print_footer_scripts' );
211
	?>
212
</div>
213
</body>
214
</html>
215