Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/password-protect-page/admin/class-ppw-admin.php
+++ b/password-protect-page/admin/class-ppw-admin.php
@@ -1329,7 +1329,7 @@
$query = $wpdb->prepare(
"SELECT DISTINCT post_id
FROM {$wpdb->postmeta}
- WHERE meta_key = %s",
+ WHERE meta_key = %s AND meta_value != '' AND meta_value != 'a:0:{}'",
PPW_Constants::GLOBAL_PASSWORDS
);
@@ -1451,7 +1451,18 @@
wp_die();
}
$request = wp_unslash( $_REQUEST ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- We already verify nonce in above.
- $result = $this->subscribe_services->handle_subscribe_request( $request['settings']['ppw_email'] );
+ $email = isset( $request['settings']['ppw_email'] ) ? sanitize_email( $request['settings']['ppw_email'] ) : '';
+ if ( ! is_email( $email ) ) {
+ wp_send_json(
+ array(
+ 'is_error' => true,
+ 'message' => __( 'Invalid email address', 'password-protect-page' ),
+ ),
+ 400
+ );
+ wp_die();
+ }
+ $result = $this->subscribe_services->handle_subscribe_request( $email );
wp_send_json(
array(
'is_error' => isset( $result['error_message'] ) ? true : false,
--- a/password-protect-page/includes/addons/beaver-builder/modules/ppw-individual-page/includes/frontend.php
+++ b/password-protect-page/includes/addons/beaver-builder/modules/ppw-individual-page/includes/frontend.php
@@ -3,7 +3,7 @@
exit;
}
// phpcs:ignoreFile WordPress.NamingConventions.PrefixAllGlobals
-$shortcode = '[ppwp passwords="' . $settings->ppwp_passwords . '"';
+$shortcode = '[ppwp passwords="' . esc_attr( $settings->ppwp_passwords ) . '"';
if ( ! empty( $settings->ppwp_headline ) ) {
$shortcode .= ' headline="' . esc_attr($settings->ppwp_headline) . '"';
--- a/password-protect-page/includes/addons/elementor/widgets/class-ppw-elementor-widget-shortcode.php
+++ b/password-protect-page/includes/addons/elementor/widgets/class-ppw-elementor-widget-shortcode.php
@@ -280,17 +280,17 @@
$shortcode = sprintf(
'[ppwp id="" class="" passwords="%1$s" cookie="%2$s" download_limit="%3$s" whitelisted_roles="%4$s" headline="%5$s" description="%6$s" placeholder="%7$s" button="%8$s" label="%9$s" error_msg="%10$s" loading="%11$s"',
- $passwords,
- $cookie,
- $download_limit,
- $whitelisted_roles,
- esc_html( $headline ),
- esc_html( $description ),
- esc_html( $placeholder ),
- esc_html( $button ),
- esc_html( $label ),
- esc_html( $error_msg ),
- esc_html( $loading )
+ esc_attr( $passwords ),
+ esc_attr( $cookie ),
+ esc_attr( $download_limit ),
+ esc_attr( $whitelisted_roles ),
+ esc_attr( $headline ),
+ esc_attr( $description ),
+ esc_attr( $placeholder ),
+ esc_attr( $button ),
+ esc_attr( $label ),
+ esc_attr( $error_msg ),
+ esc_attr( $loading )
);
$shortcode = apply_filters( PPW_Constants::HOOK_SHORTCODE_ELEMENTOR_ATTRIBUTES, $shortcode, $settings );
--- a/password-protect-page/includes/class-ppw-functions.php
+++ b/password-protect-page/includes/class-ppw-functions.php
@@ -651,7 +651,9 @@
}
function ppw_get_current_user_agent() {
- return ! empty( $server_env['HTTP_USER_AGENT'] ) ? $server_env['HTTP_USER_AGENT'] : 'N/A';
+ $server = wp_unslash( $_SERVER );
+
+ return ! empty( $server['HTTP_USER_AGENT'] ) ? $server['HTTP_USER_AGENT'] : 'N/A';
}
function ppw_get_current_ip_address() {
@@ -767,3 +769,33 @@
return $terms;
}
+
+/**
+ * Sanitize a CSS hex color; preserve empty defaults.
+ *
+ * @param mixed $value Raw theme_mod value.
+ * @return string
+ */
+function ppw_sanitize_css_hex( $value ) {
+ if ( '' === $value || null === $value ) {
+ return '';
+ }
+
+ $sanitized = sanitize_hex_color( $value );
+
+ return $sanitized ? $sanitized : '';
+}
+
+/**
+ * Sanitize a CSS numeric value; preserve empty defaults.
+ *
+ * @param mixed $value Raw theme_mod value.
+ * @return string|int
+ */
+function ppw_sanitize_css_number( $value ) {
+ if ( '' === $value || null === $value ) {
+ return '';
+ }
+
+ return absint( $value );
+}
--- a/password-protect-page/includes/services/class-ppw-content-protection.php
+++ b/password-protect-page/includes/services/class-ppw-content-protection.php
@@ -131,11 +131,6 @@
'query_var' => false,
'show_in_rest' => true,
);
-
- if ( current_user_can( 'administrator' ) ) { // phpcs:ignore WordPress.Security.Capabilities.Restricted
- $args['public'] = true;
- $args['publicly_queryable'] = true;
- }
register_post_type( self::POST_TYPE, $args );
}
--- a/password-protect-page/includes/services/class-ppw-customizer-pcp.php
+++ b/password-protect-page/includes/services/class-ppw-customizer-pcp.php
@@ -679,24 +679,48 @@
* @return void
*/
public function dynamic_styles() {
+ $bg_color = ppw_sanitize_css_hex( get_theme_mod( 'ppwp_pcp_form_background_color', PPW_Constants::DEFAULT_FORM_BACKGROUND_COLOR ) );
+ $padding = ppw_sanitize_css_number( get_theme_mod( 'ppwp_pcp_form_padding', PPW_Constants::DEFAULT_FORM_PADDING ) );
+ $border_radius = ppw_sanitize_css_number( get_theme_mod( 'ppwp_pcp_form_border_radius', PPW_Constants::DEFAULT_FORM_BORDER_RADIUS ) );
+ $headline_font_size = ppw_sanitize_css_number( get_theme_mod( 'ppwp_pcp_form_headline_font_size', PPW_Constants::DEFAULT_HEADLINE_FONT_SIZE ) );
+ $headline_font_weight = ppw_sanitize_css_number( get_theme_mod( 'ppwp_pcp_form_headline_font_weight', PPW_Constants::DEFAULT_HEADLINE_FONT_WEIGHT ) );
+ $headline_color = ppw_sanitize_css_hex( get_theme_mod( 'ppwp_pcp_form_headline_color', PPW_Constants::DEFAULT_HEADLINE_FONT_COLOR ) );
+ $text_font_size = ppw_sanitize_css_number( get_theme_mod( 'ppwp_pcp_form_description_font_size', PPW_Constants::DEFAULT_TEXT_FONT_SIZE ) );
+ $text_font_weight = ppw_sanitize_css_number( get_theme_mod( 'ppwp_pcp_form_description_font_weight', PPW_Constants::DEFAULT_TEXT_FONT_WEIGHT ) );
+ $text_color = ppw_sanitize_css_hex( get_theme_mod( 'ppwp_pcp_form_description_color', PPW_Constants::DEFAULT_TEXT_FONT_COLOR ) );
+ $desc_below_font_size = ppw_sanitize_css_number( get_theme_mod( 'ppwp_pcp_form_description_below_form_font_size', PPW_Constants::DEFAULT_TEXT_FONT_SIZE ) );
+ $desc_below_font_wt = ppw_sanitize_css_number( get_theme_mod( 'ppwp_pcp_form_description_below_form_font_weight', PPW_Constants::DEFAULT_TEXT_FONT_WEIGHT ) );
+ $desc_below_color = ppw_sanitize_css_hex( get_theme_mod( 'ppwp_pcp_form_description_below_form_color', PPW_Constants::DEFAULT_TEXT_FONT_COLOR ) );
+ $label_font_size = ppw_sanitize_css_number( get_theme_mod( 'ppwp_pcp_form_label_font_size', PPW_Constants::DEFAULT_TEXT_FONT_SIZE ) );
+ $label_font_weight = ppw_sanitize_css_number( get_theme_mod( 'ppwp_pcp_form_label_font_weight', PPW_Constants::DEFAULT_TEXT_FONT_WEIGHT ) );
+ $label_color = ppw_sanitize_css_hex( get_theme_mod( 'ppwp_pcp_form_label_color', PPW_Constants::DEFAULT_TEXT_FONT_COLOR ) );
+ $button_text_color = ppw_sanitize_css_hex( get_theme_mod( 'ppwp_pcp_button_text_color', PPW_Constants::DEFAULT_BUTTON_TEXT_FONT_COLOR ) );
+ $button_bg_color = ppw_sanitize_css_hex( get_theme_mod( 'ppwp_pcp_button_background_color', PPW_Constants::DEFAULT_BUTTON_BACKGROUND_COLOR ) );
+ $button_hover_color = ppw_sanitize_css_hex( get_theme_mod( 'ppwp_pcp_button_text_hover_color', PPW_Constants::DEFAULT_BUTTON_TEXT_HOVER_COLOR ) );
+ $button_hover_bg = ppw_sanitize_css_hex( get_theme_mod( 'ppwp_pcp_button_background_hover_color', PPW_Constants::DEFAULT_BUTTON_BACKGROUND_HOVER_COLOR ) );
+ $error_font_size = ppw_sanitize_css_number( get_theme_mod( 'ppwp_pcp_err_msg_text_font_size', PPW_Constants::DEFAULT_ERROR_TEXT_FONT_SIZE ) );
+ $error_font_weight = ppw_sanitize_css_number( get_theme_mod( 'ppwp_pcp_err_msg_text_font_weight', PPW_Constants::DEFAULT_ERROR_TEXT_FONT_WEIGHT ) );
+ $error_color = ppw_sanitize_css_hex( get_theme_mod( 'ppwp_pcp_err_msg_text_color', PPW_Constants::DEFAULT_ERROR_TEXT_FONT_COLOR ) );
+ $error_bg_color = ppw_sanitize_css_hex( get_theme_mod( 'ppwp_pcp_err_msg_background_color', PPW_Constants::DEFAULT_ERROR_TEXT_BACKGROUND_COLOR ) );
+
$ppw_custom_css = "
<style>
.ppw-form {
- background-color: " . get_theme_mod( 'ppwp_pcp_form_background_color', PPW_Constants::DEFAULT_FORM_BACKGROUND_COLOR ) . "!important;
- padding: " . get_theme_mod( 'ppwp_pcp_form_padding', PPW_Constants::DEFAULT_FORM_PADDING ) . "px!important;
- border-radius: " . get_theme_mod( 'ppwp_pcp_form_border_radius', PPW_Constants::DEFAULT_FORM_BORDER_RADIUS ) . "px!important;
+ background-color: " . esc_attr( $bg_color ) . "!important;
+ padding: " . esc_attr( $padding ) . "px!important;
+ border-radius: " . esc_attr( $border_radius ) . "px!important;
}
.ppw-headline.ppw-pcp-pf-headline {
- font-size: " . get_theme_mod( 'ppwp_pcp_form_headline_font_size', PPW_Constants::DEFAULT_HEADLINE_FONT_SIZE ) . "px!important;
- font-weight: " . get_theme_mod( 'ppwp_pcp_form_headline_font_weight', PPW_Constants::DEFAULT_HEADLINE_FONT_WEIGHT ) . "!important;
- color: " . get_theme_mod( 'ppwp_pcp_form_headline_color', PPW_Constants::DEFAULT_HEADLINE_FONT_COLOR ) . "!important;
+ font-size: " . esc_attr( $headline_font_size ) . "px!important;
+ font-weight: " . esc_attr( $headline_font_weight ) . "!important;
+ color: " . esc_attr( $headline_color ) . "!important;
}
.ppw-description.ppw-pcp-pf-desc {
- font-size: " . get_theme_mod( 'ppwp_pcp_form_description_font_size', PPW_Constants::DEFAULT_TEXT_FONT_SIZE ) . "px!important;
- font-weight: " . get_theme_mod( 'ppwp_pcp_form_description_font_weight', PPW_Constants::DEFAULT_TEXT_FONT_WEIGHT ) . "!important;
- color: " . get_theme_mod( 'ppwp_pcp_form_description_color', PPW_Constants::DEFAULT_TEXT_FONT_COLOR ) . "!important;
+ font-size: " . esc_attr( $text_font_size ) . "px!important;
+ font-weight: " . esc_attr( $text_font_weight ) . "!important;
+ color: " . esc_attr( $text_color ) . "!important;
}
.ppw-pcp-pf-desc-above-btn {
@@ -704,32 +728,32 @@
}
.ppw-pcp-pf-desc-below-form {
- font-size: " . get_theme_mod( 'ppwp_pcp_form_description_below_form_font_size', PPW_Constants::DEFAULT_TEXT_FONT_SIZE ) . "px!important;
- font-weight: " . get_theme_mod( 'ppwp_pcp_form_description_below_form_font_weight', PPW_Constants::DEFAULT_TEXT_FONT_WEIGHT ) . "!important;
- color: " . get_theme_mod( 'ppwp_pcp_form_description_below_form_color', PPW_Constants::DEFAULT_TEXT_FONT_COLOR ) . "!important;
+ font-size: " . esc_attr( $desc_below_font_size ) . "px!important;
+ font-weight: " . esc_attr( $desc_below_font_wt ) . "!important;
+ color: " . esc_attr( $desc_below_color ) . "!important;
}
.ppw-input label.ppw-pcp-password-label {
- font-size: " . get_theme_mod( 'ppwp_pcp_form_label_font_size', PPW_Constants::DEFAULT_TEXT_FONT_SIZE ) . "px!important;
- font-weight: " . get_theme_mod( 'ppwp_pcp_form_label_font_weight', PPW_Constants::DEFAULT_TEXT_FONT_WEIGHT ) . "!important;
- color: " . get_theme_mod( 'ppwp_pcp_form_label_color', PPW_Constants::DEFAULT_TEXT_FONT_COLOR ) . "!important;
+ font-size: " . esc_attr( $label_font_size ) . "px!important;
+ font-weight: " . esc_attr( $label_font_weight ) . "!important;
+ color: " . esc_attr( $label_color ) . "!important;
}
.ppw-form input[type='submit'] {
- color: " . get_theme_mod( 'ppwp_pcp_button_text_color', PPW_Constants::DEFAULT_BUTTON_TEXT_FONT_COLOR ) . "!important;
- background: " . get_theme_mod( 'ppwp_pcp_button_background_color', PPW_Constants::DEFAULT_BUTTON_BACKGROUND_COLOR ) . "!important;
+ color: " . esc_attr( $button_text_color ) . "!important;
+ background: " . esc_attr( $button_bg_color ) . "!important;
}
.ppw-form input[type='submit']:hover {
- color: " . get_theme_mod( 'ppwp_pcp_button_text_hover_color', PPW_Constants::DEFAULT_BUTTON_TEXT_HOVER_COLOR ) . "!important;
- background: " . get_theme_mod( 'ppwp_pcp_button_background_hover_color', PPW_Constants::DEFAULT_BUTTON_BACKGROUND_HOVER_COLOR ) . "!important;
+ color: " . esc_attr( $button_hover_color ) . "!important;
+ background: " . esc_attr( $button_hover_bg ) . "!important;
}
div.ppw-error.ppw-pcp-pf-error-msg {
- font-size: " . get_theme_mod( 'ppwp_pcp_err_msg_text_font_size', PPW_Constants::DEFAULT_ERROR_TEXT_FONT_SIZE ) . "px!important;
- font-weight: " . get_theme_mod( 'ppwp_pcp_err_msg_text_font_weight', PPW_Constants::DEFAULT_ERROR_TEXT_FONT_WEIGHT ) . "!important;
- color: " . get_theme_mod( 'ppwp_pcp_err_msg_text_color', PPW_Constants::DEFAULT_ERROR_TEXT_FONT_COLOR ) . "!important;
- background: " . get_theme_mod( 'ppwp_pcp_err_msg_background_color', PPW_Constants::DEFAULT_ERROR_TEXT_BACKGROUND_COLOR ) . "!important;
+ font-size: " . esc_attr( $error_font_size ) . "px!important;
+ font-weight: " . esc_attr( $error_font_weight ) . "!important;
+ color: " . esc_attr( $error_color ) . "!important;
+ background: " . esc_attr( $error_bg_color ) . "!important;
}
</style>
@@ -738,7 +762,7 @@
// compress $ppw_custom_css.
$ppw_custom_css = preg_replace( "/s{2,}/", " ", str_replace( "n", "", str_replace( ', ', ",", $ppw_custom_css ) ) );
- echo $ppw_custom_css; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- custom CSS already sanitized
+ echo $ppw_custom_css; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- values sanitized/escaped above
}
/*
--- a/password-protect-page/includes/services/class-ppw-customizer.php
+++ b/password-protect-page/includes/services/class-ppw-customizer.php
@@ -49,21 +49,22 @@
return '';
}
- $desc_font_size = get_theme_mod( 'ppwp_form_instructions_below_text_font_size' );
- $desc_font_weight = get_theme_mod( 'ppwp_form_instructions_below_text_font_weight' );
- $desc_color = get_theme_mod( 'ppwp_form_instructions_below_text_color' );
+ $desc_font_size = ppw_sanitize_css_number( get_theme_mod( 'ppwp_form_instructions_below_text_font_size' ) );
+ $desc_font_weight = ppw_sanitize_css_number( get_theme_mod( 'ppwp_form_instructions_below_text_font_weight' ) );
+ $desc_color = ppw_sanitize_css_hex( get_theme_mod( 'ppwp_form_instructions_below_text_color' ) );
$customizer_style = "
.ppw-ppf-desc-below {
- font-size: " . $desc_font_size . "px!important;
- font-weight: " . $desc_font_weight . "!important;
- color: " . $desc_color . "!important;
+ font-size: " . esc_attr( $desc_font_size ) . "px!important;
+ font-weight: " . esc_attr( $desc_font_weight ) . "!important;
+ color: " . esc_attr( $desc_color ) . "!important;
}
";
return $customizer_style;
}
+
/**
* Add below description customize.
*
@@ -683,47 +684,69 @@
*/
public function dynamic_styles() {
$below_text_styles = $this->get_below_text_style();
+
+ $bg_color = ppw_sanitize_css_hex( get_theme_mod( 'ppwp_form_instructions_background_color', PPW_Constants::DEFAULT_FORM_BACKGROUND_COLOR ) );
+ $padding = ppw_sanitize_css_number( get_theme_mod( 'ppwp_form_instructions_padding', PPW_Constants::DEFAULT_FORM_PADDING ) );
+ $border_radius = ppw_sanitize_css_number( get_theme_mod( 'ppwp_form_instructions_border_radius', PPW_Constants::DEFAULT_FORM_BORDER_RADIUS ) );
+ $headline_font_size = ppw_sanitize_css_number( get_theme_mod( 'ppwp_form_instructions_headline_font_size', PPW_Constants::DEFAULT_HEADLINE_FONT_SIZE ) );
+ $headline_font_weight = ppw_sanitize_css_number( get_theme_mod( 'ppwp_form_instructions_headline_font_weight', PPW_Constants::DEFAULT_HEADLINE_FONT_WEIGHT ) );
+ $headline_color = ppw_sanitize_css_hex( get_theme_mod( 'ppwp_form_instructions_headline_color', PPW_Constants::DEFAULT_HEADLINE_FONT_COLOR ) );
+ $text_font_size = ppw_sanitize_css_number( get_theme_mod( 'ppwp_form_instructions_text_font_size', PPW_Constants::DEFAULT_TEXT_FONT_SIZE ) );
+ $text_font_weight = ppw_sanitize_css_number( get_theme_mod( 'ppwp_form_instructions_text_font_weight', PPW_Constants::DEFAULT_TEXT_FONT_WEIGHT ) );
+ $text_color = ppw_sanitize_css_hex( get_theme_mod( 'ppwp_form_instructions_text_color', PPW_Constants::DEFAULT_TEXT_FONT_COLOR ) );
+ $label_font_size = ppw_sanitize_css_number( get_theme_mod( 'ppwp_form_instructions_password_label_font_size', PPW_Constants::DEFAULT_TEXT_FONT_SIZE ) );
+ $label_font_weight = ppw_sanitize_css_number( get_theme_mod( 'ppwp_form_instructions_password_label_font_weight', PPW_Constants::DEFAULT_TEXT_FONT_WEIGHT ) );
+ $label_color = ppw_sanitize_css_hex( get_theme_mod( 'ppwp_form_instructions_password_label_color', PPW_Constants::DEFAULT_TEXT_FONT_COLOR ) );
+ $error_font_size = ppw_sanitize_css_number( get_theme_mod( 'ppwp_form_error_message_text_font_size', PPW_Constants::DEFAULT_ERROR_TEXT_FONT_SIZE ) );
+ $error_font_weight = ppw_sanitize_css_number( get_theme_mod( 'ppwp_form_error_message_text_font_weight', PPW_Constants::DEFAULT_ERROR_TEXT_FONT_WEIGHT ) );
+ $error_color = ppw_sanitize_css_hex( get_theme_mod( 'ppwp_form_error_message_text_color', PPW_Constants::DEFAULT_ERROR_TEXT_FONT_COLOR ) );
+ $error_bg_color = ppw_sanitize_css_hex( get_theme_mod( 'ppwp_form_error_message_background_color', PPW_Constants::DEFAULT_ERROR_TEXT_BACKGROUND_COLOR ) );
+ $button_text_color = ppw_sanitize_css_hex( get_theme_mod( 'ppwp_form_button_text_color', PPW_Constants::DEFAULT_BUTTON_TEXT_FONT_COLOR ) );
+ $button_bg_color = ppw_sanitize_css_hex( get_theme_mod( 'ppwp_form_button_background_color', PPW_Constants::DEFAULT_BUTTON_BACKGROUND_COLOR ) );
+ $button_hover_color = ppw_sanitize_css_hex( get_theme_mod( 'ppwp_form_button_text_hover_color', PPW_Constants::DEFAULT_BUTTON_TEXT_HOVER_COLOR ) );
+ $button_hover_bg = ppw_sanitize_css_hex( get_theme_mod( 'ppwp_form_button_background_hover_color', PPW_Constants::DEFAULT_BUTTON_BACKGROUND_HOVER_COLOR ) );
+
$ppw_custom_css = "
<style>
.ppw-ppf-input-container {
- background-color: " . get_theme_mod( 'ppwp_form_instructions_background_color', PPW_Constants::DEFAULT_FORM_BACKGROUND_COLOR ) . "!important;
- padding: " . get_theme_mod( 'ppwp_form_instructions_padding', PPW_Constants::DEFAULT_FORM_PADDING ) . "px!important;
- border-radius: " . get_theme_mod( 'ppwp_form_instructions_border_radius', PPW_Constants::DEFAULT_FORM_BORDER_RADIUS ) . "px!important;
+ background-color: " . esc_attr( $bg_color ) . "!important;
+ padding: " . esc_attr( $padding ) . "px!important;
+ border-radius: " . esc_attr( $border_radius ) . "px!important;
}
.ppw-ppf-input-container div.ppw-ppf-headline {
- font-size: " . get_theme_mod( 'ppwp_form_instructions_headline_font_size', PPW_Constants::DEFAULT_HEADLINE_FONT_SIZE ) . "px!important;
- font-weight: " . get_theme_mod( 'ppwp_form_instructions_headline_font_weight', PPW_Constants::DEFAULT_HEADLINE_FONT_WEIGHT ) . "!important;
- color: " . get_theme_mod( 'ppwp_form_instructions_headline_color', PPW_Constants::DEFAULT_HEADLINE_FONT_COLOR ) . "!important;
+ font-size: " . esc_attr( $headline_font_size ) . "px!important;
+ font-weight: " . esc_attr( $headline_font_weight ) . "!important;
+ color: " . esc_attr( $headline_color ) . "!important;
}
.ppw-ppf-input-container div.ppw-ppf-desc {
- font-size: " . get_theme_mod( 'ppwp_form_instructions_text_font_size', PPW_Constants::DEFAULT_TEXT_FONT_SIZE ) . "px!important;
- font-weight: " . get_theme_mod( 'ppwp_form_instructions_text_font_weight', PPW_Constants::DEFAULT_TEXT_FONT_WEIGHT ) . "!important;
- color: " . get_theme_mod( 'ppwp_form_instructions_text_color', PPW_Constants::DEFAULT_TEXT_FONT_COLOR ) . "!important;
+ font-size: " . esc_attr( $text_font_size ) . "px!important;
+ font-weight: " . esc_attr( $text_font_weight ) . "!important;
+ color: " . esc_attr( $text_color ) . "!important;
}
.ppw-ppf-input-container label.ppw-pwd-label {
- font-size: " . get_theme_mod( 'ppwp_form_instructions_password_label_font_size', PPW_Constants::DEFAULT_TEXT_FONT_SIZE ) . "px!important;
- font-weight: " . get_theme_mod( 'ppwp_form_instructions_password_label_font_weight', PPW_Constants::DEFAULT_TEXT_FONT_WEIGHT ) . "!important;
- color: " . get_theme_mod( 'ppwp_form_instructions_password_label_color', PPW_Constants::DEFAULT_TEXT_FONT_COLOR ) . "!important;
+ font-size: " . esc_attr( $label_font_size ) . "px!important;
+ font-weight: " . esc_attr( $label_font_weight ) . "!important;
+ color: " . esc_attr( $label_color ) . "!important;
}
div.ppwp-wrong-pw-error {
- font-size: " . get_theme_mod( 'ppwp_form_error_message_text_font_size', PPW_Constants::DEFAULT_ERROR_TEXT_FONT_SIZE ) . "px!important;
- font-weight: " . get_theme_mod( 'ppwp_form_error_message_text_font_weight', PPW_Constants::DEFAULT_ERROR_TEXT_FONT_WEIGHT ) . "!important;
- color: " . get_theme_mod( 'ppwp_form_error_message_text_color', PPW_Constants::DEFAULT_ERROR_TEXT_FONT_COLOR ) . "!important;
- background: " . get_theme_mod( 'ppwp_form_error_message_background_color', PPW_Constants::DEFAULT_ERROR_TEXT_BACKGROUND_COLOR ) . "!important;
+ font-size: " . esc_attr( $error_font_size ) . "px!important;
+ font-weight: " . esc_attr( $error_font_weight ) . "!important;
+ color: " . esc_attr( $error_color ) . "!important;
+ background: " . esc_attr( $error_bg_color ) . "!important;
}
.ppw-ppf-input-container input[type='submit'] {
- color: " . get_theme_mod( 'ppwp_form_button_text_color', PPW_Constants::DEFAULT_BUTTON_TEXT_FONT_COLOR ) . "!important;
- background: " . get_theme_mod( 'ppwp_form_button_background_color', PPW_Constants::DEFAULT_BUTTON_BACKGROUND_COLOR ) . "!important;
+ color: " . esc_attr( $button_text_color ) . "!important;
+ background: " . esc_attr( $button_bg_color ) . "!important;
}
.ppw-ppf-input-container input[type='submit']:hover {
- color: " . get_theme_mod( 'ppwp_form_button_text_hover_color', PPW_Constants::DEFAULT_BUTTON_TEXT_HOVER_COLOR ) . "!important;
- background: " . get_theme_mod( 'ppwp_form_button_background_hover_color', PPW_Constants::DEFAULT_BUTTON_BACKGROUND_HOVER_COLOR ) . "!important;
+ color: " . esc_attr( $button_hover_color ) . "!important;
+ background: " . esc_attr( $button_hover_bg ) . "!important;
}
{$below_text_styles}
</style>
@@ -732,7 +755,7 @@
// compress $ppw_custom_css.
$ppw_custom_css = preg_replace( "/s{2,}/", " ", str_replace( "n", "", str_replace( ', ', ",", $ppw_custom_css ) ) );
- echo $ppw_custom_css; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- custom CSS already sanitized
+ echo $ppw_custom_css; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- values sanitized/escaped above
}
/**
--- a/password-protect-page/includes/services/class-ppw-passwords.php
+++ b/password-protect-page/includes/services/class-ppw-passwords.php
@@ -340,7 +340,11 @@
// Validate global password(empty and duplicate).
ppw_free_validate_password_type_global( $new_global_passwords, $current_global_passwords, $current_roles_password );
- update_post_meta( $id, PPW_Constants::GLOBAL_PASSWORDS, $new_global_passwords );
+ if ( empty( $new_global_passwords ) ) {
+ delete_post_meta( $id, PPW_Constants::GLOBAL_PASSWORDS );
+ } else {
+ update_post_meta( $id, PPW_Constants::GLOBAL_PASSWORDS, $new_global_passwords );
+ }
// Clear cache for Cache plugin.
ppw_core_clear_cache_by_id( $id );
--- a/password-protect-page/includes/services/class-ppw-recaptcha.php
+++ b/password-protect-page/includes/services/class-ppw-recaptcha.php
@@ -494,7 +494,7 @@
case PPW_Recaptcha::RECAPTCHA_V2_CHECKBOX_TYPE:
$site_key = $this->get_recaptcha_v2_api_key();
- return '<div class="ppw-recaptcha g-recaptcha" data-sitekey="' . $site_key . '"></div>';
+ return '<div class="ppw-recaptcha g-recaptcha" data-sitekey="' . esc_attr( $site_key ) . '"></div>';
default:
return '<input type="hidden" name="g-recaptcha-response" id="ppwRecaptchaResponse" />';
}
--- a/password-protect-page/wp-protect-password.php
+++ b/password-protect-page/wp-protect-password.php
@@ -15,7 +15,7 @@
* Plugin Name: Password Protect WordPress Lite
* Plugin URI: https://passwordprotectwp.com?utm_source=user-website&utm_medium=pluginsite_link&utm_campaign=ppwp_lite
* Description: Password protect the entire WordPress site, unlimited pages and posts by user roles. This plugin is required for our Pro version to work properly.
- * Version: 1.9.20
+ * Version: 1.9.21
* Author: BWPS
* Author URI: https://passwordprotectwp.com
* License: GPL-2.0+
@@ -35,8 +35,7 @@
* Rename this for your plugin and update it as you release new versions.
*/
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals
-
-define( 'PPW_VERSION', '1.9.20' );
+define( 'PPW_VERSION', '1.9.21' );
if ( ! defined( 'PPW_DIR_PATH' ) ) {
define( 'PPW_DIR_PATH', plugin_dir_path( __FILE__ ) );