Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve sanitization in jetpack_amp_build_stats_pixel_url() #1000

Closed
wants to merge 1 commit into from

Conversation

paulschreiber
Copy link
Contributor

  • avoid double-calling rawurlencode() on $dataarray_map() already does this
  • sanitize HTTP_HOST

@@ -63,7 +63,7 @@ function jetpack_amp_build_stats_pixel_url() {
$data = compact( 'v', 'j', 'blog', 'post', 'tz', 'srv' );
}

$data['host'] = isset( $_SERVER['HTTP_HOST'] ) ? rawurlencode( $_SERVER['HTTP_HOST'] ) : ''; // input var ok
$data['host'] = isset( $_SERVER['HTTP_HOST'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : ''; // input var ok
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sanitize_text_field is not equivalent to rawurlencode

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does rawurlencode() count as a sanitizing function? If not, should another one be used? If not, should WPCS be updated?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind. I supose this change is ok. You can cherry-pick this into #1002 as well.

@westonruter westonruter dismissed their stale review March 8, 2018 20:42

I missed the description

@westonruter
Copy link
Member

See #1002 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants